Fix vr9_phy22f_a2x.bin firmware linking
[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 endef
36
37 define uboot/arv4519pw_ram
38   TITLE:=U-Boot for Arcadyan arv4519pw (RAM)
39   SOC:=danube
40   DDR_SETTINGS:=board/arcadyan/arv4519pw/ddr_settings.h
41 endef
42
43 define uboot/arv4519pw_nor
44   TITLE:=U-Boot for Arcadyan arv4519pw (NOR)
45   SOC:=danube
46 endef
47
48 define uboot/arv4519pw_brn
49   TITLE:=U-Boot for Arcadyan arv4519pw (BRN)
50   SOC:=danube
51 endef
52
53 define uboot/arv7510pw_ram
54   TITLE:=U-Boot for Arcadyan arv7510pw (RAM)
55   SOC:=danube
56   DDR_SETTINGS:=board/arcadyan/arv7510pw/ddr_settings.h
57 endef
58
59 define uboot/arv7510pw_nor
60   TITLE:=U-Boot for Arcadyan arv7510pw (NOR)
61   SOC:=danube
62 endef
63
64 define uboot/arv7510pw_brn
65   TITLE:=U-Boot for Arcadyan arv7510pw (BRN)
66   SOC:=danube
67 endef
68
69 define uboot/arv7518pw_ram
70   TITLE:=U-Boot for Arcadyan arv7518pw (RAM)
71   SOC:=danube
72   DDR_SETTINGS:=board/arcadyan/arv7518pw/ddr_settings.h
73 endef
74
75 define uboot/arv7518pw_nor
76   TITLE:=U-Boot for Arcadyan arv7518pw (NOR)
77   SOC:=danube
78 endef
79
80 define uboot/arv7518pw_brn
81   TITLE:=U-Boot for Arcadyan arv7518pw (BRN)
82   SOC:=danube
83 endef
84
85 define uboot/arv752dpw_ram
86   TITLE:=U-Boot for Arcadyan arv752dpw (RAM)
87   SOC:=danube
88   DDR_SETTINGS:=board/arcadyan/arv752dpw/ddr_settings.h
89 endef
90
91 define uboot/arv752dpw_nor
92   TITLE:=U-Boot for Arcadyan arv752dpw (NOR)
93   SOC:=danube
94 endef
95
96 define uboot/arv752dpw_brn
97   TITLE:=U-Boot for Arcadyan arv752dpw (BRN)
98   SOC:=danube
99 endef
100
101 define uboot/arv752dpw22_ram
102   TITLE:=U-Boot for Arcadyan arv752dpw22 (RAM)
103   SOC:=danube
104   DDR_SETTINGS:=board/arcadyan/arv752dpw22/ddr_settings.h
105 endef
106
107 define uboot/arv752dpw22_nor
108   TITLE:=U-Boot for Arcadyan arv752dpw22 (NOR)
109   SOC:=danube
110 endef
111
112 define uboot/arv752dpw22_brn
113   TITLE:=U-Boot for Arcadyan arv752dpw22 (BRN)
114   SOC:=danube
115 endef
116
117 define uboot/gigasx76x_ram
118   TITLE:=U-Boot for Siemens Gigaset sx76x (RAM)
119   SOC:=danube
120   DDR_SETTINGS:=board/gigaset/sx76x/ddr_settings.h
121 endef
122
123 define uboot/gigasx76x_nor
124   TITLE:=U-Boot for Siemens Gigaset sx76x (NOR)
125   SOC:=danube
126 endef
127
128 define uboot/acmp252_ram
129   TITLE:=U-Boot for AudioCodes MP-252 (RAM)
130   SOC:=danube
131   DDR_SETTINGS:=board/audiocodes/acmp252/ddr_settings.h
132 endef
133
134 define uboot/acmp252_nor
135   TITLE:=U-Boot for AudioCodes MP-252 (NOR)
136   SOC:=danube
137 endef
138
139 define uboot/easy50712_ram
140   TITLE:=U-Boot for Lantiq EASY50712 (RAM)
141   SOC:=danube
142   DDR_SETTINGS:=board/lantiq/easy50712/ddr_settings.h
143 endef
144
145 define uboot/easy50712_nor
146   TITLE:=U-Boot for Lantiq EASY50712 (NOR)
147   SOC:=danube
148 endef
149
150 define uboot/easy50712_norspl
151   TITLE:=U-Boot for Lantiq EASY50712 (NOR SPL)
152   SOC:=danube
153   IMAGE:=u-boot.ltq.lzo.norspl
154 endef
155
156 define uboot/easy80920_ram
157   TITLE:=U-Boot for Lantiq EASY80920 (RAM)
158   SOC:=vr9
159   DDR_SETTINGS:=board/lantiq/easy80920/ddr_settings.h
160 endef
161
162 define uboot/easy80920_nor
163   TITLE:=U-Boot for Lantiq EASY80920 (NOR)
164   SOC:=vr9
165 endef
166
167 define uboot/easy80920_norspl
168   TITLE:=U-Boot for Lantiq EASY80920 (NOR SPL)
169   SOC:=vr9
170   IMAGE:=u-boot.ltq.lzo.norspl
171 endef
172
173 define uboot/easy80920_sfspl
174   TITLE:=U-Boot for Lantiq EASY80920 (SPI SPL)
175   SOC:=vr9
176   IMAGE:=u-boot.ltq.lzo.sfspl
177 endef
178
179
180 UBOOTS:= \
181         arv4519pw_ram arv4519pw_nor arv4519pw_brn \
182         arv7510pw_ram arv7510pw_nor arv7510pw_brn \
183         arv7518pw_ram arv7518pw_nor arv7518pw_brn \
184         arv752dpw_ram arv752dpw_nor arv752dpw_brn \
185         arv752dpw22_ram arv752dpw22_nor arv752dpw22_brn \
186         gigasx76x_ram gigasx76x_nor \
187         acmp252_ram acmp252_nor \
188         easy50712_ram easy50712_nor easy50712_norspl \
189         easy80920_ram easy80920_nor easy80920_norspl easy80920_sfspl
190
191 define Package/uboot/template
192 define Package/uboot-lantiq-$(1)
193   SECTION:=boot
194   CATEGORY:=Boot Loaders
195   DEPENDS:=@TARGET_lantiq_xway
196   TITLE:=$(2)
197   URL:=http://www.denx.de/wiki/U-Boot
198   VARIANT:=$(1)
199   MAINTAINER:=Luka Perkov <luka@openwrt.org>
200 endef
201 endef
202
203 define BuildUBootPackage
204         $(eval $(uboot/Default))
205         $(eval $(uboot/$(1)))
206         $(call Package/uboot/template,$(1),$(TITLE))
207 endef
208
209 define CopyVR9Firmware
210         $(CP) $(FIRMWARE_LANTIQ_SOURCE)/vr9_phy$(1)_a$(2)x.bin \
211                 $(PKG_BUILD_DIR)/arch/mips/cpu/mips32/vrx200/fw_phy$(1)_a$(2)x.blob
212 endef
213
214 define Build/Prepare
215         $(call Build/Prepare/Default)
216         $(call CopyVR9Firmware,11g,1)
217         $(call CopyVR9Firmware,11g,2)
218         $(call CopyVR9Firmware,22f,1)
219         $(call CopyVR9Firmware,22f,2)
220 endef
221
222 define Build/Configure
223         $(MAKE) -C $(PKG_BUILD_DIR) $(BUILD_VARIANT)_config
224 endef
225
226 define Build/Compile
227         $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS)
228 endef
229
230 define Package/uboot/install/default
231         $(CP) \
232                 $(PKG_BUILD_DIR)/$(2) \
233                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.img
234 endef
235
236 define Package/uboot/install/uart
237         awk -f $(PKG_BUILD_DIR)/tools/lantiq_ram_init_uart.awk \
238                 -v soc=$(2) $(PKG_BUILD_DIR)/$(3) \
239                 > $(PKG_BUILD_DIR)/ddr_settings
240         perl $(PKG_BUILD_DIR)/tools/gct.pl \
241                 $(PKG_BUILD_DIR)/ddr_settings $(PKG_BUILD_DIR)/u-boot.srec \
242                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.asc
243  endef
244
245 define Package/uboot/install/template
246 define Package/uboot-lantiq-$(1)/install
247         $(call Package/uboot/install/default,$(1),$(if $(IMAGE),$(IMAGE),u-boot.bin))
248         $(if $(DDR_SETTINGS), \
249                 $(call Package/uboot/install/uart,$(1),$(SOC),$(DDR_SETTINGS)) \
250         )
251 endef
252 endef
253
254 $(foreach u,$(UBOOTS), \
255         $(eval $(call BuildUBootPackage,$(u))) \
256         $(eval $(call Package/uboot/install/template,$(u))) \
257         $(eval $(call BuildPackage,uboot-lantiq-$(u))) \
258 )