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