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