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