7bfb79ade7a7fb7fcc56ca1e59e2d71fbbfa2259
[openwrt.git] / package / boot / uboot-lantiq / Makefile
1 #
2 # Copyright (C) 2012-2013 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=u-boot
11 PKG_VERSION:=2013.10
12 PKG_RELEASE:=1
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:= \
17         http://mirror2.openwrt.org/sources \
18         ftp://ftp.denx.de/pub/u-boot
19 PKG_MD5SUM:=a076a044b64371edc52f7e562b13f6b2
20 PKG_TARGETS:=bin
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define uboot/Default
27   TITLE:=
28   SOC:=
29   DDR_SETTINGS:=
30   IMAGE:=
31 endef
32
33 define uboot/arv4519pw_ram
34   TITLE:=U-Boot for Arcadyan arv4519pw (RAM)
35   SOC:=danube
36   DDR_SETTINGS:=board/arcadyan/arv4519pw/ddr_settings.h
37 endef
38
39 define uboot/arv4519pw_nor
40   TITLE:=U-Boot for Arcadyan arv4519pw (NOR)
41   SOC:=danube
42 endef
43
44 define uboot/arv4519pw_brn
45   TITLE:=U-Boot for Arcadyan arv4519pw (BRN)
46   SOC:=danube
47 endef
48
49 define uboot/arv7510pw_ram
50   TITLE:=U-Boot for Arcadyan arv7510pw (RAM)
51   SOC:=danube
52   DDR_SETTINGS:=board/arcadyan/arv7510pw/ddr_settings.h
53 endef
54
55 define uboot/arv7510pw_nor
56   TITLE:=U-Boot for Arcadyan arv7510pw (NOR)
57   SOC:=danube
58 endef
59
60 define uboot/arv7510pw_brn
61   TITLE:=U-Boot for Arcadyan arv7510pw (BRN)
62   SOC:=danube
63 endef
64
65 define uboot/arv7518pw_ram
66   TITLE:=U-Boot for Arcadyan arv7518pw (RAM)
67   SOC:=danube
68   DDR_SETTINGS:=board/arcadyan/arv7518pw/ddr_settings.h
69 endef
70
71 define uboot/arv7518pw_nor
72   TITLE:=U-Boot for Arcadyan arv7518pw (NOR)
73   SOC:=danube
74 endef
75
76 define uboot/arv7518pw_brn
77   TITLE:=U-Boot for Arcadyan arv7518pw (BRN)
78   SOC:=danube
79 endef
80
81 define uboot/arv752dpw_ram
82   TITLE:=U-Boot for Arcadyan arv752dpw (RAM)
83   SOC:=danube
84   DDR_SETTINGS:=board/arcadyan/arv752dpw/ddr_settings.h
85 endef
86
87 define uboot/arv752dpw_nor
88   TITLE:=U-Boot for Arcadyan arv752dpw (NOR)
89   SOC:=danube
90 endef
91
92 define uboot/arv752dpw_brn
93   TITLE:=U-Boot for Arcadyan arv752dpw (BRN)
94   SOC:=danube
95 endef
96
97 define uboot/arv752dpw22_ram
98   TITLE:=U-Boot for Arcadyan arv752dpw22 (RAM)
99   SOC:=danube
100   DDR_SETTINGS:=board/arcadyan/arv752dpw22/ddr_settings.h
101 endef
102
103 define uboot/arv752dpw22_nor
104   TITLE:=U-Boot for Arcadyan arv752dpw22 (NOR)
105   SOC:=danube
106 endef
107
108 define uboot/arv752dpw22_brn
109   TITLE:=U-Boot for Arcadyan arv752dpw22 (BRN)
110   SOC:=danube
111 endef
112
113 define uboot/gigasx76x_ram
114   TITLE:=U-Boot for Siemens Gigaset sx76x (RAM)
115   SOC:=danube
116   DDR_SETTINGS:=board/gigaset/sx76x/ddr_settings.h
117 endef
118
119 define uboot/gigasx76x_nor
120   TITLE:=U-Boot for Siemens Gigaset sx76x (NOR)
121   SOC:=danube
122 endef
123
124 define uboot/easy50712_ram
125   TITLE:=U-Boot for Lantiq EASY50712 (RAM)
126   SOC:=danube
127   DDR_SETTINGS:=board/lantiq/easy50712/ddr_settings.h
128 endef
129
130 define uboot/easy50712_nor
131   TITLE:=U-Boot for Lantiq EASY50712 (NOR)
132   SOC:=danube
133 endef
134
135 define uboot/easy50712_norspl
136   TITLE:=U-Boot for Lantiq EASY50712 (NOR SPL)
137   SOC:=danube
138   IMAGE:=u-boot.ltq.lzo.norspl
139 endef
140
141 define uboot/easy80920_ram
142   TITLE:=U-Boot for Lantiq EASY80920 (RAM)
143   SOC:=vr9
144   DDR_SETTINGS:=board/lantiq/easy80920/ddr_settings.h
145 endef
146
147 define uboot/easy80920_nor
148   TITLE:=U-Boot for Lantiq EASY80920 (NOR)
149   SOC:=vr9
150 endef
151
152 define uboot/easy80920_norspl
153   TITLE:=U-Boot for Lantiq EASY80920 (NOR SPL)
154   SOC:=vr9
155   IMAGE:=u-boot.ltq.lzo.norspl
156 endef
157
158 define uboot/easy80920_sfspl
159   TITLE:=U-Boot for Lantiq EASY80920 (SPI SPL)
160   SOC:=vr9
161   IMAGE:=u-boot.ltq.lzo.sfspl
162 endef
163
164
165 UBOOTS:= \
166         arv4519pw_ram arv4519pw_nor arv4519pw_brn \
167         arv7510pw_ram arv7510pw_nor arv7510pw_brn \
168         arv7518pw_ram arv7518pw_nor arv7518pw_brn \
169         arv752dpw_ram arv752dpw_nor arv752dpw_brn \
170         arv752dpw22_ram arv752dpw22_nor arv752dpw22_brn \
171         gigasx76x_ram gigasx76x_nor \
172         easy50712_ram easy50712_nor easy50712_norspl \
173         easy80920_ram easy80920_nor easy80920_norspl easy80920_sfspl
174
175 define Package/uboot/template
176 define Package/uboot-lantiq-$(1)
177   SECTION:=boot
178   CATEGORY:=Boot Loaders
179   DEPENDS:=@TARGET_lantiq_xway
180   TITLE:=$(2)
181   URL:=http://www.denx.de/wiki/U-Boot
182   VARIANT:=$(1)
183   MAINTAINER:=Luka Perkov <luka@openwrt.org>
184 endef
185 endef
186
187 define BuildUBootPackage
188         $(eval $(uboot/Default))
189         $(eval $(uboot/$(1)))
190         $(call Package/uboot/template,$(1),$(TITLE))
191 endef
192
193 define Build/Configure
194         $(MAKE) -C $(PKG_BUILD_DIR) $(BUILD_VARIANT)_config
195 endef
196
197 define Build/Compile
198         $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS)
199 endef
200
201 define Package/uboot/install/default
202         $(CP) \
203                 $(PKG_BUILD_DIR)/$(2) \
204                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.img
205 endef
206
207 define Package/uboot/install/uart
208         awk -f $(PKG_BUILD_DIR)/tools/lantiq_ram_init_uart.awk \
209                 -v soc=$(2) $(PKG_BUILD_DIR)/$(3) \
210                 > $(PKG_BUILD_DIR)/ddr_settings
211         perl $(PKG_BUILD_DIR)/tools/gct.pl \
212                 $(PKG_BUILD_DIR)/ddr_settings $(PKG_BUILD_DIR)/u-boot.srec \
213                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.asc
214  endef
215
216 define Package/uboot/install/template
217 define Package/uboot-lantiq-$(1)/install
218         $(call Package/uboot/install/default,$(1),$(if $(IMAGE),$(IMAGE),u-boot.bin))
219         $(if $(DDR_SETTINGS), \
220                 $(call Package/uboot/install/uart,$(1),$(SOC),$(DDR_SETTINGS)) \
221         )
222 endef
223 endef
224
225 $(foreach u,$(UBOOTS), \
226         $(eval $(call BuildUBootPackage,$(u))) \
227         $(eval $(call Package/uboot/install/template,$(u))) \
228         $(eval $(call BuildPackage,uboot-lantiq-$(u))) \
229 )