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