Depend on lantiq board
[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_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
207 UBOOTS:= \
208         arv4519pw_ram arv4519pw_nor arv4519pw_brn \
209         arv7510pw_ram arv7510pw_nor arv7510pw_brn \
210         arv7518pw_ram arv7518pw_nor arv7518pw_brn \
211         arv752dpw_ram arv752dpw_nor arv752dpw_brn \
212         arv752dpw22_ram arv752dpw22_nor arv752dpw22_brn \
213         gigasx76x_ram gigasx76x_nor \
214         acmp252_ram acmp252_nor \
215         easy50712_ram easy50712_nor easy50712_norspl \
216         easy80920_ram easy80920_nor easy80920_norspl easy80920_sfspl
217
218 define Package/uboot/template
219 define Package/uboot-lantiq-$(1)
220   SECTION:=boot
221   CATEGORY:=Boot Loaders
222   DEPENDS:=$(3)
223   TITLE:=$(2)
224   URL:=http://www.denx.de/wiki/U-Boot
225   VARIANT:=$(1)
226   MAINTAINER:=Luka Perkov <luka@openwrt.org>
227 endef
228 endef
229
230 define BuildUBootPackage
231         $(eval $(uboot/Default))
232         $(eval $(uboot/$(1)))
233         DEPS:=$(uboot/$(1)/DEPS)
234         $(call Package/uboot/template,$(1),$(TITLE),$(DEPS))
235 endef
236
237 define CopyVR9Firmware
238         $(CP) $(FIRMWARE_LANTIQ_SOURCE)/vr9_phy$(1)_a$(2)x.bin \
239                 $(PKG_BUILD_DIR)/arch/mips/cpu/mips32/vrx200/fw_phy$(1)_a$(2)x.blob
240 endef
241
242 define Build/Prepare
243         $(call Build/Prepare/Default)
244         $(call CopyVR9Firmware,11g,1)
245         $(call CopyVR9Firmware,11g,2)
246         $(call CopyVR9Firmware,22f,1)
247         $(call CopyVR9Firmware,22f,2)
248 endef
249
250 define Build/Configure
251         $(MAKE) -C $(PKG_BUILD_DIR) $(BUILD_VARIANT)_config
252 endef
253
254 define Build/Compile
255         $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS)
256 endef
257
258 define Package/uboot/install/default
259         $(CP) \
260                 $(PKG_BUILD_DIR)/$(2) \
261                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.img
262 endef
263
264 define Package/uboot/install/uart
265         awk -f $(PKG_BUILD_DIR)/tools/lantiq_ram_init_uart.awk \
266                 -v soc=$(2) $(PKG_BUILD_DIR)/$(3) \
267                 > $(PKG_BUILD_DIR)/ddr_settings
268         perl $(PKG_BUILD_DIR)/tools/gct.pl \
269                 $(PKG_BUILD_DIR)/ddr_settings $(PKG_BUILD_DIR)/u-boot.srec \
270                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.asc
271  endef
272
273 define Package/uboot/install/template
274 define Package/uboot-lantiq-$(1)/install
275         $(call Package/uboot/install/default,$(1),$(if $(IMAGE),$(IMAGE),u-boot.bin))
276         $(if $(DDR_SETTINGS), \
277                 $(call Package/uboot/install/uart,$(1),$(SOC),$(DDR_SETTINGS)) \
278         )
279 endef
280 endef
281
282 $(foreach u,$(UBOOTS), \
283         $(eval $(call BuildUBootPackage,$(u))) \
284         $(eval $(call Package/uboot/install/template,$(u))) \
285         $(eval $(call BuildPackage,uboot-lantiq-$(u))) \
286 )