add chaos_calmer branch
[15.05/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_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_ARV4519PW
44 endef
45
46 define uboot/arv4519pw_nor
47   TITLE:=U-Boot for Arcadyan arv4519pw (NOR)
48   SOC:=danube
49   DEPS:=@TARGET_lantiq_xway_ARV4519PW
50 endef
51
52 define uboot/arv4519pw_brn
53   TITLE:=U-Boot for Arcadyan arv4519pw (BRN)
54   SOC:=danube
55   DEPS:=@TARGET_lantiq_xway_ARV4519PW
56 endef
57
58 define uboot/arv7510pw_ram
59   TITLE:=U-Boot for Arcadyan arv7510pw (RAM)
60   SOC:=danube
61   DDR_SETTINGS:=board/arcadyan/arv7510pw/ddr_settings.h
62   DEPS:=@TARGET_lantiq_xway_ARV4510PW
63 endef
64
65 define uboot/arv7510pw_nor
66   TITLE:=U-Boot for Arcadyan arv7510pw (NOR)
67   SOC:=danube
68   DEPS:=@TARGET_lantiq_xway_ARV4510PW
69 endef
70
71 define uboot/arv7510pw_brn
72   TITLE:=U-Boot for Arcadyan arv7510pw (BRN)
73   SOC:=danube
74   DEPS:=@TARGET_lantiq_xway_ARV4510PW
75 endef
76
77 define uboot/arv7510pw22_ram
78   TITLE:=U-Boot for Arcadyan arv7510pw22 (RAM)
79   SOC:=danube
80   DDR_SETTINGS:=board/arcadyan/arv7510pw22/ddr_settings.h
81   DEPS:=@TARGET_lantiq_xway_ARV7510PW22
82 endef
83
84 define uboot/arv7510pw22_nor
85   TITLE:=U-Boot for Arcadyan arv7510pw22 (NOR)
86   SOC:=danube
87   DEPS:=@TARGET_lantiq_xway_ARV7510PW22
88 endef
89
90 define uboot/arv7510pw22_brn
91   TITLE:=U-Boot for Arcadyan arv7510pw22 (BRN)
92   SOC:=danube
93   DEPS:=@TARGET_lantiq_xway_ARV7510PW22
94 endef
95
96 define uboot/arv7518pw_ram
97   TITLE:=U-Boot for Arcadyan arv7518pw (RAM)
98   SOC:=danube
99   DDR_SETTINGS:=board/arcadyan/arv7518pw/ddr_settings.h
100   DEPS:=@TARGET_lantiq_xway_ARV7518PW
101 endef
102
103 define uboot/arv7518pw_nor
104   TITLE:=U-Boot for Arcadyan arv7518pw (NOR)
105   SOC:=danube
106   DEPS:=@TARGET_lantiq_xway_ARV7518PW
107 endef
108
109 define uboot/arv7518pw_brn
110   TITLE:=U-Boot for Arcadyan arv7518pw (BRN)
111   SOC:=danube
112   DEPS:=@TARGET_lantiq_xway_ARV7518PW
113 endef
114
115 define uboot/arv752dpw_ram
116   TITLE:=U-Boot for Arcadyan arv752dpw (RAM)
117   SOC:=danube
118   DDR_SETTINGS:=board/arcadyan/arv752dpw/ddr_settings.h
119   DEPS:=@TARGET_lantiq_xway_ARV752DPW
120 endef
121
122 define uboot/arv752dpw_nor
123   TITLE:=U-Boot for Arcadyan arv752dpw (NOR)
124   SOC:=danube
125   DEPS:=@TARGET_lantiq_xway_ARV752DPW
126 endef
127
128 define uboot/arv752dpw_brn
129   TITLE:=U-Boot for Arcadyan arv752dpw (BRN)
130   SOC:=danube
131   DEPS:=@TARGET_lantiq_xway_ARV752DPW
132 endef
133
134 define uboot/arv752dpw22_ram
135   TITLE:=U-Boot for Arcadyan arv752dpw22 (RAM)
136   SOC:=danube
137   DDR_SETTINGS:=board/arcadyan/arv752dpw22/ddr_settings.h
138   DEPS:=@TARGET_lantiq_xway_ARV752DPW22
139 endef
140
141 define uboot/arv752dpw22_nor
142   TITLE:=U-Boot for Arcadyan arv752dpw22 (NOR)
143   SOC:=danube
144   DEPS:=@TARGET_lantiq_xway_ARV752DPW22
145 endef
146
147 define uboot/arv752dpw22_brn
148   TITLE:=U-Boot for Arcadyan arv752dpw22 (BRN)
149   SOC:=danube
150   DEPS:=@TARGET_lantiq_xway_ARV752DPW22
151 endef
152
153 define uboot/gigasx76x_ram
154   TITLE:=U-Boot for Siemens Gigaset sx76x (RAM)
155   SOC:=danube
156   DDR_SETTINGS:=board/gigaset/sx76x/ddr_settings.h
157   DEPS:=@TARGET_lantiq_xway_GIGASX76X
158 endef
159
160 define uboot/gigasx76x_nor
161   TITLE:=U-Boot for Siemens Gigaset sx76x (NOR)
162   SOC:=danube
163   DEPS:=@TARGET_lantiq_xway_GIGASX76X
164 endef
165
166 define uboot/acmp252_ram
167   TITLE:=U-Boot for AudioCodes MP-252 (RAM)
168   SOC:=danube
169   DDR_SETTINGS:=board/audiocodes/acmp252/ddr_settings.h
170   DEPS:=@TARGET_lantiq_xway_ACMP252
171 endef
172
173 define uboot/acmp252_nor
174   TITLE:=U-Boot for AudioCodes MP-252 (NOR)
175   SOC:=danube
176   DEPS:=@TARGET_lantiq_xway_ACMP252
177 endef
178
179 define uboot/easy50712_ram
180   TITLE:=U-Boot for Lantiq EASY50712 (RAM)
181   SOC:=danube
182   DDR_SETTINGS:=board/lantiq/easy50712/ddr_settings.h
183   DEPS:=@TARGET_lantiq_xway_EASY50712
184 endef
185
186 define uboot/easy50712_nor
187   TITLE:=U-Boot for Lantiq EASY50712 (NOR)
188   SOC:=danube
189   DEPS:=@TARGET_lantiq_xway_EASY50712
190 endef
191
192 define uboot/easy50712_norspl
193   TITLE:=U-Boot for Lantiq EASY50712 (NOR SPL)
194   SOC:=danube
195   IMAGE:=u-boot.ltq.lzo.norspl
196   DEPS:=@TARGET_lantiq_xway_EASY50712
197 endef
198
199 define uboot/easy80920_ram
200   TITLE:=U-Boot for Lantiq EASY80920 (RAM)
201   SOC:=vr9
202   DDR_SETTINGS:=board/lantiq/easy80920/ddr_settings.h
203   DEPS:=@(TARGET_lantiq_xrx200_EASY80920NOR||TARGET_lantiq_xrx200_EASY80920NAND)
204 endef
205
206 define uboot/easy80920_nor
207   TITLE:=U-Boot for Lantiq EASY80920 (NOR)
208   SOC:=vr9
209   DEPS:=@(TARGET_lantiq_xrx200_EASY80920NOR||TARGET_lantiq_xrx200_EASY80920NAND)
210 endef
211
212 define uboot/easy80920_norspl
213   TITLE:=U-Boot for Lantiq EASY80920 (NOR SPL)
214   SOC:=vr9
215   IMAGE:=u-boot.ltq.lzo.norspl
216   DEPS:=@(TARGET_lantiq_xrx200_EASY80920NOR||TARGET_lantiq_xrx200_EASY80920NAND)
217 endef
218
219 define uboot/easy80920_sfspl
220   TITLE:=U-Boot for Lantiq EASY80920 (SPI SPL)
221   SOC:=vr9
222   IMAGE:=u-boot.ltq.lzo.sfspl
223   DEPS:=@(TARGET_lantiq_xrx200_EASY80920NOR||TARGET_lantiq_xrx200_EASY80920NAND)
224 endef
225
226 define uboot/fb3370_eva
227   TITLE:=U-Boot for AVM FRITZ3370 (EVA)
228   SOC:=vr9
229   DEPS:=@TARGET_lantiq_xrx200_FRITZ3370
230 endef
231
232 define uboot/fb3370_ram
233   TITLE:=U-Boot for AVM FRITZ3370 (RAM)
234   SOC:=vr9
235   DDR_SETTINGS:=board/avm/fb3370/ddr_settings.h
236   DEPS:=@TARGET_lantiq_xrx200_FRITZ3370
237 endef
238
239 define uboot/fb3370_sfspl
240   TITLE:=U-Boot for AVM FRITZ3370 (SPI SPL)
241   SOC:=vr9
242   IMAGE:=u-boot.ltq.lzo.sfspl
243   DEPS:=@TARGET_lantiq_xrx200_FRITZ3370
244 endef
245
246 define uboot/p2812hnufx_ram
247   TITLE:=U-Boot for ZyXEL P-2812HNU-Fx (RAM)
248   SOC:=vr9
249   DDR_SETTINGS:=board/zyxel/p2812hnufx/ddr_settings.h
250   DEPS:=@TARGET_lantiq_xrx200_P2812HNUF1||@TARGET_lantiq_xrx200_P2812HNUF3
251 endef
252
253 define uboot/p2812hnufx_nandspl
254   TITLE:=U-Boot for ZyXEL P-2812HNU-Fx (NAND SPL)
255   SOC:=vr9
256   IMAGE:=u-boot.ltq.lzo.nandspl
257   DEPS:=@TARGET_lantiq_xrx200_P2812HNUF1||@TARGET_lantiq_xrx200_P2812HNUF3
258 endef
259
260 define uboot/vgv7510kw22_brn
261   TITLE:=U-Boot for Arcadyan VGV7510KW22 (BRN)
262   SOC:=vr9
263   DEPS:=@TARGET_lantiq_xrx200_VGV7510KW22NOR||@TARGET_lantiq_xrx200_VGV7510KW22BRN
264 endef
265
266 define uboot/vgv7510kw22_nor
267   TITLE:=U-Boot for Arcadyan VGV7510KW22 (NOR)
268   SOC:=vr9
269   DEPS:=@TARGET_lantiq_xrx200_VGV7510KW22NOR||@TARGET_lantiq_xrx200_VGV7510KW22BRN
270 endef
271
272 define uboot/vgv7510kw22_ram
273   TITLE:=U-Boot for Arcadyan VGV7510KW22 (RAM)
274   SOC:=vr9
275   DDR_SETTINGS:=board/arcadyan/vgv7510kw22/ddr_settings.h
276   DEPS:=@TARGET_lantiq_xrx200_VGV7510KW22NOR||@TARGET_lantiq_xrx200_VGV7510KW22BRN
277 endef
278
279 UBOOTS:= \
280         arv4519pw_ram arv4519pw_nor arv4519pw_brn \
281         arv7510pw_ram arv7510pw_nor arv7510pw_brn \
282         arv7510pw22_ram arv7510pw22_nor arv7510pw22_brn \
283         arv7518pw_ram arv7518pw_nor arv7518pw_brn \
284         arv752dpw_ram arv752dpw_nor arv752dpw_brn \
285         arv752dpw22_ram arv752dpw22_nor arv752dpw22_brn \
286         gigasx76x_ram gigasx76x_nor \
287         acmp252_ram acmp252_nor \
288         easy50712_ram easy50712_nor easy50712_norspl \
289         easy80920_ram easy80920_nor easy80920_norspl easy80920_sfspl \
290         fb3370_eva fb3370_ram fb3370_sfspl \
291         p2812hnufx_ram p2812hnufx_nandspl \
292         vgv7510kw22_brn vgv7510kw22_nor vgv7510kw22_ram
293
294 define Package/uboot/template
295 define Package/uboot-lantiq-$(1)
296   SECTION:=boot
297   CATEGORY:=Boot Loaders
298   DEPENDS:=$(3)
299   TITLE:=$(2)
300   URL:=http://www.denx.de/wiki/U-Boot
301   VARIANT:=$(1)
302   MAINTAINER:=Luka Perkov <luka@openwrt.org>
303 endef
304 endef
305
306 define BuildUBootPackage
307         $(eval $(uboot/Default))
308         $(eval $(uboot/$(1)))
309         DEPS:=$(uboot/$(1)/DEPS)
310         $(call Package/uboot/template,$(1),$(TITLE),$(DEPS))
311 endef
312
313 define CopyVR9Firmware
314         $(CP) $(FIRMWARE_LANTIQ_SOURCE)/vr9_phy$(1)_a$(2)x.bin \
315                 $(PKG_BUILD_DIR)/arch/mips/cpu/mips32/vrx200/fw_phy$(1)_a$(2)x.blob
316 endef
317
318 define Build/Prepare
319         $(call Build/Prepare/Default)
320         mkdir -p $(PKG_BUILD_DIR)/arch/mips/cpu/mips32/vrx200/
321         $(call CopyVR9Firmware,11g,1)
322         $(call CopyVR9Firmware,11g,2)
323         $(call CopyVR9Firmware,22f,1)
324         $(call CopyVR9Firmware,22f,2)
325 endef
326
327 define Build/Configure
328         $(MAKE) -C $(PKG_BUILD_DIR) $(BUILD_VARIANT)_config
329 endef
330
331 define Build/Compile
332         $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS)
333 endef
334
335 define Package/uboot/install/default
336         $(CP) \
337                 $(PKG_BUILD_DIR)/$(2) \
338                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.img
339 endef
340
341 define Package/uboot/install/uart
342         awk -f $(PKG_BUILD_DIR)/tools/lantiq_ram_init_uart.awk \
343                 -v soc=$(2) $(PKG_BUILD_DIR)/$(3) \
344                 > $(PKG_BUILD_DIR)/ddr_settings
345         perl $(PKG_BUILD_DIR)/tools/gct.pl \
346                 $(PKG_BUILD_DIR)/ddr_settings $(PKG_BUILD_DIR)/u-boot.srec \
347                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.asc
348  endef
349
350 define Package/uboot/install/template
351 define Package/uboot-lantiq-$(1)/install
352         $(call Package/uboot/install/default,$(1),$(if $(IMAGE),$(IMAGE),u-boot.bin))
353         $(if $(DDR_SETTINGS), \
354                 $(call Package/uboot/install/uart,$(1),$(SOC),$(DDR_SETTINGS)) \
355         )
356 endef
357 endef
358
359 $(foreach u,$(UBOOTS), \
360         $(eval $(call BuildUBootPackage,$(u))) \
361         $(eval $(call Package/uboot/install/template,$(u))) \
362         $(eval $(call BuildPackage,uboot-lantiq-$(u))) \
363 )