uboot-lantiq: package does not build inside the SDK
[lede.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_LICENSE:=GPL-2.0 GPL-2.0+
23 PKG_LICENSE_FILES:=Licenses/README
24
25 PKG_BUILD_PARALLEL:=1
26
27 FIRMWARE_LANTIQ_SOURCE:=$(TOPDIR)/target/linux/lantiq/files/firmware/lantiq
28
29 include $(INCLUDE_DIR)/package.mk
30
31 define uboot/Default
32   TITLE:=
33   SOC:=
34   DDR_SETTINGS:=
35   IMAGE:=
36   DEPS:=
37 endef
38
39 define uboot/arv4519pw_ram
40   TITLE:=U-Boot for Arcadyan arv4519pw (RAM)
41   SOC:=danube
42   DDR_SETTINGS:=board/arcadyan/arv4519pw/ddr_settings.h
43   DEPS:=@TARGET_lantiq_xway
44 endef
45
46 define uboot/arv4519pw_nor
47   TITLE:=U-Boot for Arcadyan arv4519pw (NOR)
48   SOC:=danube
49   DEPS:=@TARGET_lantiq_xway
50 endef
51
52 define uboot/arv4519pw_brn
53   TITLE:=U-Boot for Arcadyan arv4519pw (BRN)
54   SOC:=danube
55   DEPS:=@TARGET_lantiq_xway
56 endef
57
58 define uboot/arv7506pw11_ram
59   TITLE:=U-Boot for Arcadyan ARV7506PW11 (RAM)
60   SOC:=danube
61   DDR_SETTINGS:=board/arcadyan/arv7506pw11/ddr_settings.h
62   DEPS:=@TARGET_lantiq_xway
63 endef
64
65 define uboot/arv7506pw11_nor
66   TITLE:=U-Boot for Arcadyan ARV7506PW11 (NOR)
67   SOC:=danube
68   DEPS:=@TARGET_lantiq_xway
69 endef
70
71 define uboot/arv7506pw11_brn
72   TITLE:=U-Boot for Arcadyan ARV7506PW11 (BRN)
73   SOC:=danube
74   DEPS:=@TARGET_lantiq_xway
75 endef
76
77 define uboot/arv7510pw_ram
78   TITLE:=U-Boot for Arcadyan arv7510pw (RAM)
79   SOC:=danube
80   DDR_SETTINGS:=board/arcadyan/arv7510pw/ddr_settings.h
81   DEPS:=@TARGET_lantiq_xway
82 endef
83
84 define uboot/arv7510pw_nor
85   TITLE:=U-Boot for Arcadyan arv7510pw (NOR)
86   SOC:=danube
87   DEPS:=@TARGET_lantiq_xway
88 endef
89
90 define uboot/arv7510pw_brn
91   TITLE:=U-Boot for Arcadyan arv7510pw (BRN)
92   SOC:=danube
93   DEPS:=@TARGET_lantiq_xway
94 endef
95
96 define uboot/arv7510pw22_ram
97   TITLE:=U-Boot for Arcadyan arv7510pw22 (RAM)
98   SOC:=danube
99   DDR_SETTINGS:=board/arcadyan/arv7510pw22/ddr_settings.h
100   DEPS:=@TARGET_lantiq_xway
101 endef
102
103 define uboot/arv7510pw22_nor
104   TITLE:=U-Boot for Arcadyan arv7510pw22 (NOR)
105   SOC:=danube
106   DEPS:=@TARGET_lantiq_xway
107 endef
108
109 define uboot/arv7510pw22_brn
110   TITLE:=U-Boot for Arcadyan arv7510pw22 (BRN)
111   SOC:=danube
112   DEPS:=@TARGET_lantiq_xway
113 endef
114
115 define uboot/arv7518pw_ram
116   TITLE:=U-Boot for Arcadyan arv7518pw (RAM)
117   SOC:=danube
118   DDR_SETTINGS:=board/arcadyan/arv7518pw/ddr_settings.h
119   DEPS:=@TARGET_lantiq_xway
120 endef
121
122 define uboot/arv7518pw_nor
123   TITLE:=U-Boot for Arcadyan arv7518pw (NOR)
124   SOC:=danube
125   DEPS:=@TARGET_lantiq_xway
126 endef
127
128 define uboot/arv7518pw_brn
129   TITLE:=U-Boot for Arcadyan arv7518pw (BRN)
130   SOC:=danube
131   DEPS:=@TARGET_lantiq_xway
132 endef
133
134 define uboot/arv752dpw_ram
135   TITLE:=U-Boot for Arcadyan arv752dpw (RAM)
136   SOC:=danube
137   DDR_SETTINGS:=board/arcadyan/arv752dpw/ddr_settings.h
138   DEPS:=@TARGET_lantiq_xway
139 endef
140
141 define uboot/arv752dpw_nor
142   TITLE:=U-Boot for Arcadyan arv752dpw (NOR)
143   SOC:=danube
144   DEPS:=@TARGET_lantiq_xway
145 endef
146
147 define uboot/arv752dpw_brn
148   TITLE:=U-Boot for Arcadyan arv752dpw (BRN)
149   SOC:=danube
150   DEPS:=@TARGET_lantiq_xway
151 endef
152
153 define uboot/arv752dpw22_ram
154   TITLE:=U-Boot for Arcadyan arv752dpw22 (RAM)
155   SOC:=danube
156   DDR_SETTINGS:=board/arcadyan/arv752dpw22/ddr_settings.h
157   DEPS:=@TARGET_lantiq_xway
158 endef
159
160 define uboot/arv752dpw22_nor
161   TITLE:=U-Boot for Arcadyan arv752dpw22 (NOR)
162   SOC:=danube
163   DEPS:=@TARGET_lantiq_xway
164 endef
165
166 define uboot/arv752dpw22_brn
167   TITLE:=U-Boot for Arcadyan arv752dpw22 (BRN)
168   SOC:=danube
169   DEPS:=@TARGET_lantiq_xway
170 endef
171
172 define uboot/arv8539pw22_ram
173   TITLE:=U-Boot for Speedport W 504V Typ A (RAM)
174   SOC:=danube
175   DDR_SETTINGS:=board/arcadyan/arv8539pw22/ddr_settings.h
176   DEPS:=@TARGET_lantiq_xway
177 endef
178
179 define uboot/arv8539pw22_nor
180   TITLE:=U-Boot for Speedport W 504V Typ A (NOR)
181   SOC:=danube
182   DEPS:=@TARGET_lantiq_xway
183 endef
184
185 define uboot/arv8539pw22_brn
186   TITLE:=U-Boot for Speedport W 504V Typ A (BRN)
187   SOC:=danube
188   DEPS:=@TARGET_lantiq_xway
189 endef
190
191 define uboot/gigasx76x_ram
192   TITLE:=U-Boot for Siemens Gigaset sx76x (RAM)
193   SOC:=danube
194   DDR_SETTINGS:=board/gigaset/sx76x/ddr_settings.h
195   DEPS:=@TARGET_lantiq_xway
196 endef
197
198 define uboot/gigasx76x_nor
199   TITLE:=U-Boot for Siemens Gigaset sx76x (NOR)
200   SOC:=danube
201   DEPS:=@TARGET_lantiq_xway
202 endef
203
204 define uboot/acmp252_ram
205   TITLE:=U-Boot for AudioCodes MP-252 (RAM)
206   SOC:=danube
207   DDR_SETTINGS:=board/audiocodes/acmp252/ddr_settings.h
208   DEPS:=@TARGET_lantiq_xway
209 endef
210
211 define uboot/acmp252_nor
212   TITLE:=U-Boot for AudioCodes MP-252 (NOR)
213   SOC:=danube
214   DEPS:=@TARGET_lantiq_xway
215 endef
216
217 define uboot/easy50712_ram
218   TITLE:=U-Boot for Lantiq EASY50712 (RAM)
219   SOC:=danube
220   DDR_SETTINGS:=board/lantiq/easy50712/ddr_settings.h
221   DEPS:=@TARGET_lantiq_xway
222 endef
223
224 define uboot/easy50712_nor
225   TITLE:=U-Boot for Lantiq EASY50712 (NOR)
226   SOC:=danube
227   DEPS:=@TARGET_lantiq_xway
228 endef
229
230 define uboot/easy50712_norspl
231   TITLE:=U-Boot for Lantiq EASY50712 (NOR SPL)
232   SOC:=danube
233   IMAGE:=u-boot.ltq.lzo.norspl
234   DEPS:=@TARGET_lantiq_xway
235 endef
236
237 define uboot/easy80920_ram
238   TITLE:=U-Boot for Lantiq EASY80920 (RAM)
239   SOC:=vr9
240   DDR_SETTINGS:=board/lantiq/easy80920/ddr_settings.h
241   DEPS:=@TARGET_lantiq_xrx200
242 endef
243
244 define uboot/easy80920_nor
245   TITLE:=U-Boot for Lantiq EASY80920 (NOR)
246   SOC:=vr9
247   DEPS:=@TARGET_lantiq_xrx200
248 endef
249
250 define uboot/easy80920_norspl
251   TITLE:=U-Boot for Lantiq EASY80920 (NOR SPL)
252   SOC:=vr9
253   IMAGE:=u-boot.ltq.lzo.norspl
254   DEPS:=@TARGET_lantiq_xrx200
255 endef
256
257 define uboot/easy80920_sfspl
258   TITLE:=U-Boot for Lantiq EASY80920 (SPI SPL)
259   SOC:=vr9
260   IMAGE:=u-boot.ltq.lzo.sfspl
261   DEPS:=@TARGET_lantiq_xrx200
262 endef
263
264 define uboot/fb3370_eva
265   TITLE:=U-Boot for AVM FRITZ3370 (EVA)
266   SOC:=vr9
267   DEPS:=@TARGET_lantiq_xrx200
268 endef
269
270 define uboot/fb3370_ram
271   TITLE:=U-Boot for AVM FRITZ3370 (RAM)
272   SOC:=vr9
273   DDR_SETTINGS:=board/avm/fb3370/ddr_settings.h
274   DEPS:=@TARGET_lantiq_xrx200
275 endef
276
277 define uboot/fb3370_sfspl
278   TITLE:=U-Boot for AVM FRITZ3370 (SPI SPL)
279   SOC:=vr9
280   IMAGE:=u-boot.ltq.lzo.sfspl
281   DEPS:=@TARGET_lantiq_xrx200
282 endef
283
284 define uboot/p2812hnufx_ram
285   TITLE:=U-Boot for ZyXEL P-2812HNU-Fx (RAM)
286   SOC:=vr9
287   DDR_SETTINGS:=board/zyxel/p2812hnufx/ddr_settings.h
288   DEPS:=@TARGET_lantiq_xrx200
289 endef
290
291 define uboot/p2812hnufx_nandspl
292   TITLE:=U-Boot for ZyXEL P-2812HNU-Fx (NAND SPL)
293   SOC:=vr9
294   IMAGE:=u-boot.ltq.lzo.nandspl
295   DEPS:=@TARGET_lantiq_xrx200
296 endef
297
298 define uboot/vgv7510kw22_brn
299   TITLE:=U-Boot for Arcadyan VGV7510KW22 (BRN)
300   SOC:=vr9
301   DEPS:=@TARGET_lantiq_xrx200
302 endef
303
304 define uboot/vgv7510kw22_nor
305   TITLE:=U-Boot for Arcadyan VGV7510KW22 (NOR)
306   SOC:=vr9
307   DEPS:=@TARGET_lantiq_xrx200
308 endef
309
310 define uboot/vgv7510kw22_ram
311   TITLE:=U-Boot for Arcadyan VGV7510KW22 (RAM)
312   SOC:=vr9
313   DDR_SETTINGS:=board/arcadyan/vgv7510kw22/ddr_settings.h
314   DEPS:=@TARGET_lantiq_xrx200
315 endef
316
317 define uboot/vgv7519_brn
318   TITLE:=U-Boot for Arcadyan VGV7519 (BRN)
319   SOC:=vr9
320   DEPS:=@TARGET_lantiq_xrx200
321 endef
322
323 define uboot/vgv7519_nor
324   TITLE:=U-Boot for Arcadyan VGV7519 (NOR)
325   SOC:=vr9
326   DEPS:=@TARGET_lantiq_xrx200
327 endef
328
329 define uboot/vgv7519_ram
330   TITLE:=U-Boot for Arcadyan VGV7519 (RAM)
331   SOC:=vr9
332   DDR_SETTINGS:=board/arcadyan/vgv7519/ddr_settings.h
333   DEPS:=@TARGET_lantiq_xrx200
334 endef
335
336 UBOOTS:= \
337         arv4519pw_ram arv4519pw_nor arv4519pw_brn \
338         arv7506pw11_ram arv7506pw11_nor arv7506pw11_brn \
339         arv7510pw_ram arv7510pw_nor arv7510pw_brn \
340         arv7510pw22_ram arv7510pw22_nor arv7510pw22_brn \
341         arv7518pw_ram arv7518pw_nor arv7518pw_brn \
342         arv752dpw_ram arv752dpw_nor arv752dpw_brn \
343         arv752dpw22_ram arv752dpw22_nor arv752dpw22_brn \
344         arv8539pw22_brn arv8539pw22_nor arv8539pw22_ram \
345         gigasx76x_ram gigasx76x_nor \
346         acmp252_ram acmp252_nor \
347         easy50712_ram easy50712_nor easy50712_norspl \
348         easy80920_ram easy80920_nor easy80920_norspl easy80920_sfspl \
349         fb3370_eva fb3370_ram fb3370_sfspl \
350         p2812hnufx_ram p2812hnufx_nandspl \
351         vgv7510kw22_brn vgv7510kw22_nor vgv7510kw22_ram \
352         vgv7519_brn vgv7519_nor vgv7519_ram
353
354 define Package/uboot/template
355 define Package/uboot-lantiq-$(1)
356   SECTION:=boot
357   CATEGORY:=Boot Loaders
358   DEPENDS:=$(3) @!IN_SDK
359   TITLE:=$(2)
360   URL:=http://www.denx.de/wiki/U-Boot
361   VARIANT:=$(1)
362   MAINTAINER:=Luka Perkov <luka@openwrt.org>
363 endef
364 endef
365
366 define BuildUBootPackage
367         $(eval $(uboot/Default))
368         $(eval $(uboot/$(1)))
369         DEPS:=$(uboot/$(1)/DEPS)
370         $(call Package/uboot/template,$(1),$(TITLE),$(DEPS))
371 endef
372
373 define CompressVR9Firmware
374         $(STAGING_DIR_HOST)/bin/lzma e \
375                 $(FIRMWARE_LANTIQ_SOURCE)/vr9_phy$(1)_a$(2)x.bin \
376                 $(PKG_BUILD_DIR)/arch/mips/cpu/mips32/vrx200/fw_phy$(1)_a$(2)x.blob
377 endef
378
379 define Build/Prepare
380         $(call Build/Prepare/Default)
381         mkdir -p $(PKG_BUILD_DIR)/arch/mips/cpu/mips32/vrx200/
382         $(call CompressVR9Firmware,11g,1)
383         $(call CompressVR9Firmware,11g,2)
384         $(call CompressVR9Firmware,22f,1)
385         $(call CompressVR9Firmware,22f,2)
386 endef
387
388 define Build/Configure
389         $(MAKE) -C $(PKG_BUILD_DIR) $(BUILD_VARIANT)_config
390 endef
391
392 define Build/Compile
393         $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS)
394 endef
395
396 define Package/uboot/install/default
397         $(CP) \
398                 $(PKG_BUILD_DIR)/$(2) \
399                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.img
400 endef
401
402 define Package/uboot/install/uart
403         awk -f $(PKG_BUILD_DIR)/tools/lantiq_ram_init_uart.awk \
404                 -v soc=$(2) $(PKG_BUILD_DIR)/$(3) \
405                 > $(PKG_BUILD_DIR)/ddr_settings
406         perl $(PKG_BUILD_DIR)/tools/gct.pl \
407                 $(PKG_BUILD_DIR)/ddr_settings $(PKG_BUILD_DIR)/u-boot.srec \
408                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.asc
409  endef
410
411 define Package/uboot/install/template
412 define Package/uboot-lantiq-$(1)/install
413         $(call Package/uboot/install/default,$(1),$(if $(IMAGE),$(IMAGE),u-boot.bin))
414         $(if $(DDR_SETTINGS), \
415                 $(call Package/uboot/install/uart,$(1),$(SOC),$(DDR_SETTINGS)) \
416         )
417 endef
418 endef
419
420 $(foreach u,$(UBOOTS), \
421         $(eval $(call BuildUBootPackage,$(u))) \
422         $(eval $(call Package/uboot/install/template,$(u))) \
423         $(eval $(call BuildPackage,uboot-lantiq-$(u))) \
424 )