0fa14b89f32cf167610cb26b4dc2387ea3f702b7
[openwrt/openwrt.git] / target / linux / kirkwood / image / Makefile
1 # SPDX-License-Identifier: GPL-2.0-only
2 #
3 # Copyright (C) 2009-2013 OpenWrt.org
4
5 include $(TOPDIR)/rules.mk
6 include $(INCLUDE_DIR)/image.mk
7
8 KERNEL_LOADADDR:=0x8000
9
10 # Some info about Ctera firmware:
11 # 1. It's simple tar file (GNU standard), but it must have ".firm" suffix.
12 # 2. It contains two images: kernel and romdisk. Both are required.
13 # 3. Every image has header and trailer file.
14 # 4. The struct of tar firmware is: header kernel trailer header romdisk trailer
15 # 5. In header file are some strings used to describe image. It was decoded from
16 # factory image.
17 # 6. Version format in header file is restricted by Original FW.
18 # 7. Trailer file contains MD5 sum string of header and image file.
19 # 8. Firmware file must have <=24MB size.
20
21 define Build/ctera-firmware
22 mkdir -p $@.tmp
23
24 # Prepare header and trailer file for kernel
25 echo "# CTera firmware information file" > $@.tmp/header
26 echo "image_type=kernel" >> $@.tmp/header
27 echo "arch=Kirkwood" >> $@.tmp/header
28 echo "board=Any" >> $@.tmp/header
29 echo "version=3.1.22.30669" >> $@.tmp/header
30 echo "kernel_cmd=console=ttyS0,115200 earlyprintk" >> $@.tmp/header
31 echo "date=$$(date $(if $(SOURCE_DATE_EPOCH),-d@$(SOURCE_DATE_EPOCH)))" \
32 >> $@.tmp/header
33
34 cp $@ $@.tmp/kernel
35
36 echo "MD5=$$(cat $@.tmp/header $@.tmp/kernel | $(MKHASH) md5)" \
37 > $@.tmp/trailer
38
39 tar $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
40 -H gnu -C $@.tmp -cf $@.tar header kernel trailer
41
42 # Prepare header and trailer file for fake romdisk
43 echo "# CTera firmware information file" > $@.tmp/header
44 echo "image_type=romdisk" >> $@.tmp/header
45 echo "initrd=yes" >> $@.tmp/header
46 echo "arch=Kirkwood" >> $@.tmp/header
47 echo "board=Any" >> $@.tmp/header
48 echo "version=3.1.22.30669" >> $@.tmp/header
49 echo "date=$$(date $(if $(SOURCE_DATE_EPOCH),-d@$(SOURCE_DATE_EPOCH)))" \
50 >> $@.tmp/header
51
52 rm -f $@
53 touch $@
54 $(call Build/append-uImage-fakehdr, ramdisk)
55 cp $@ $@.tmp/romdisk
56
57 echo "MD5=$$(cat $@.tmp/header $@.tmp/romdisk | $(MKHASH) md5)" \
58 > $@.tmp/trailer
59
60 tar $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
61 -H gnu -C $@.tmp -rf $@.tar header romdisk trailer
62
63 mv $@.tar $@
64 rm -rf $@.tmp
65 endef
66
67 define Device/kernel-size-migration
68 DEVICE_COMPAT_VERSION := 2.0
69 DEVICE_COMPAT_MESSAGE := Partition design has changed compared to \
70 older versions (up to 21.02) due to kernel size restrictions. \
71 Upgrade via sysupgrade mechanism is not possible, so new \
72 installation via factory style image is required.
73 endef
74
75 define Device/Default
76 PROFILES := Default
77 DEVICE_DTS = kirkwood-$(lastword $(subst _, ,$(1)))
78 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
79 KERNEL := kernel-bin | append-dtb | uImage none
80 KERNEL_NAME := zImage
81 KERNEL_SUFFIX := -uImage
82 KERNEL_IN_UBI := 1
83
84 PAGESIZE := 2048
85 SUBPAGESIZE := 512
86 BLOCKSIZE := 128k
87 IMAGES := sysupgrade.bin factory.bin
88 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
89 IMAGE/factory.bin := append-ubi
90 endef
91
92 define Device/checkpoint_l-50
93 DEVICE_VENDOR := Check Point
94 DEVICE_MODEL := L-50
95 DEVICE_PACKAGES := kmod-ath9k kmod-gpio-button-hotplug kmod-mvsdio \
96 kmod-rtc-s35390a kmod-usb-ledtrig-usbport wpad-basic-mbedtls
97 IMAGES := sysupgrade.bin
98 endef
99 TARGET_DEVICES += checkpoint_l-50
100
101 define Device/cisco_on100
102 DEVICE_VENDOR := Cisco Systems
103 DEVICE_MODEL := ON100
104 KERNEL_SIZE := 5376k
105 KERNEL_IN_UBI :=
106 UBINIZE_OPTS := -E 5
107 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
108 DEVICE_PACKAGES := kmod-mvsdio
109 SUPPORTED_DEVICES += on100
110 endef
111 TARGET_DEVICES += cisco_on100
112
113 define Device/cloudengines_pogoe02
114 DEVICE_VENDOR := Cloud Engines
115 DEVICE_MODEL := Pogoplug E02
116 DEVICE_DTS := kirkwood-pogo_e02
117 SUPPORTED_DEVICES += pogo_e02
118 endef
119 TARGET_DEVICES += cloudengines_pogoe02
120
121 define Device/cloudengines_pogoplugv4
122 DEVICE_VENDOR := Cloud Engines
123 DEVICE_MODEL := Pogoplug V4
124 DEVICE_DTS := kirkwood-pogoplug-series-4
125 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-mvsdio kmod-usb3 \
126 kmod-gpio-button-hotplug
127 endef
128 TARGET_DEVICES += cloudengines_pogoplugv4
129
130 define Device/ctera_c200-v1
131 DEVICE_VENDOR := Ctera
132 DEVICE_MODEL := C200
133 DEVICE_VARIANT := V1
134 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-gpio-button-hotplug \
135 kmod-hwmon-lm63 kmod-rtc-s35390a kmod-usb-ledtrig-usbport
136 KERNEL := kernel-bin | append-dtb | uImage none | ctera-firmware
137 KERNEL_IN_UBI :=
138 KERNEL_SUFFIX := -factory.firm
139 IMAGES := sysupgrade.bin
140 endef
141 TARGET_DEVICES += ctera_c200-v1
142
143 define Device/endian_4i-edge-200
144 DEVICE_VENDOR := Endian
145 DEVICE_MODEL := 4i Edge 200
146 DEVICE_ALT0_VENDOR := Endian
147 DEVICE_ALT0_MODEL := UTM Mini Firewall
148 DEVICE_PACKAGES := kmod-ath9k kmod-mvsdio wpad-basic-mbedtls
149 KERNEL_SIZE := 4096k
150 IMAGES := sysupgrade.bin
151 endef
152 TARGET_DEVICES += endian_4i-edge-200
153
154 define Device/globalscale_sheevaplug
155 DEVICE_VENDOR := Globalscale
156 DEVICE_MODEL := Sheevaplug
157 DEVICE_PACKAGES := kmod-mvsdio
158 endef
159 TARGET_DEVICES += globalscale_sheevaplug
160
161 define Device/iom_iconnect-1.1
162 DEVICE_VENDOR := Iomega
163 DEVICE_MODEL := Iconnect
164 DEVICE_DTS := kirkwood-iconnect
165 SUPPORTED_DEVICES += iconnect
166 endef
167 TARGET_DEVICES += iom_iconnect-1.1
168
169 define Device/iom_ix2-200
170 DEVICE_VENDOR := Iomega
171 DEVICE_MODEL := StorCenter ix2-200
172 DEVICE_DTS := kirkwood-iomega_ix2_200
173 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
174 kmod-gpio-button-hotplug kmod-hwmon-lm63
175 PAGESIZE := 512
176 SUBPAGESIZE := 256
177 BLOCKSIZE := 16k
178 KERNEL_SIZE := 3072k
179 KERNEL_IN_UBI :=
180 UBINIZE_OPTS := -E 5
181 IMAGE_SIZE := 31744k
182 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
183 check-size
184 endef
185 TARGET_DEVICES += iom_ix2-200
186
187 define Device/iom_ix4-200d
188 DEVICE_VENDOR := Iomega
189 DEVICE_MODEL := StorCenter ix4-200d
190 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
191 kmod-gpio-button-hotplug kmod-gpio-nxp-74hc164 \
192 kmod-hwmon-adt7475 kmod-mvsdio kmod-spi-gpio
193 PAGESIZE := 512
194 SUBPAGESIZE := 256
195 BLOCKSIZE := 16k
196 KERNEL_SIZE := 3072k
197 KERNEL_IN_UBI :=
198 UBINIZE_OPTS := -E 5
199 IMAGE_SIZE := 31744k
200 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
201 check-size
202 endef
203 TARGET_DEVICES += iom_ix4-200d
204
205 define Device/iptime_nas1
206 DEVICE_VENDOR := ipTIME
207 DEVICE_MODEL := NAS1
208 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
209 kmod-gpio-button-hotplug kmod-gpio-pca953x kmod-hwmon-drivetemp \
210 kmod-hwmon-gpiofan kmod-usb-ledtrig-usbport -uboot-envtools
211 KERNEL := $$(KERNEL) | iptime-naspkg nas1
212 BLOCKSIZE := 256k
213 IMAGE_SIZE := 15872k
214 IMAGES := sysupgrade.bin
215 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
216 check-size | append-metadata
217 endef
218 TARGET_DEVICES += iptime_nas1
219
220 define Device/linksys
221 DEVICE_VENDOR := Linksys
222 DEVICE_PACKAGES := kmod-mwl8k wpad-basic-mbedtls kmod-gpio-button-hotplug
223 KERNEL_IN_UBI :=
224 UBINIZE_OPTS := -E 5
225 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
226 endef
227
228 define Device/linksys_e4200-v2
229 $(Device/linksys)
230 $(Device/kernel-size-migration)
231 DEVICE_MODEL := E4200
232 DEVICE_VARIANT := v2
233 KERNEL_SIZE := 3072k
234 SUPPORTED_DEVICES += linksys,viper linksys-viper
235 endef
236 TARGET_DEVICES += linksys_e4200-v2
237
238 define Device/linksys_ea3500
239 $(Device/linksys)
240 $(Device/kernel-size-migration)
241 DEVICE_MODEL := EA3500
242 PAGESIZE := 512
243 SUBPAGESIZE := 256
244 BLOCKSIZE := 16k
245 KERNEL_SIZE := 3072k
246 SUPPORTED_DEVICES += linksys,audi linksys-audi
247 endef
248 TARGET_DEVICES += linksys_ea3500
249
250 define Device/linksys_ea4500
251 $(Device/linksys)
252 $(Device/kernel-size-migration)
253 DEVICE_MODEL := EA4500
254 KERNEL_SIZE := 3072k
255 SUPPORTED_DEVICES += linksys,viper linksys-viper
256 endef
257 TARGET_DEVICES += linksys_ea4500
258
259 define Device/netgear_readynas-duo-v2
260 DEVICE_VENDOR := NETGEAR
261 DEVICE_MODEL := ReadyNAS Duo
262 DEVICE_VARIANT := v2
263 DEVICE_DTS := kirkwood-netgear_readynas_duo_v2
264 KERNEL_IN_UBI :=
265 IMAGES := sysupgrade.bin
266 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
267 kmod-gpio-button-hotplug kmod-hwmon-g762 kmod-rtc-rs5c372a kmod-usb3
268 endef
269 TARGET_DEVICES += netgear_readynas-duo-v2
270
271 define Device/raidsonic_ib-nas62x0
272 DEVICE_VENDOR := RaidSonic
273 DEVICE_MODEL := ICY BOX IB-NAS62x0
274 DEVICE_DTS := kirkwood-ib62x0
275 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4
276 SUPPORTED_DEVICES += ib62x0
277 endef
278 TARGET_DEVICES += raidsonic_ib-nas62x0
279
280 define Device/seagate_blackarmor-nas220
281 DEVICE_VENDOR := Seagate
282 DEVICE_MODEL := Blackarmor NAS220
283 DEVICE_PACKAGES := kmod-hwmon-adt7475 kmod-fs-ext4 kmod-ata-marvell-sata \
284 mdadm kmod-gpio-button-hotplug
285 PAGESIZE := 512
286 SUBPAGESIZE := 256
287 BLOCKSIZE := 16k
288 UBINIZE_OPTS := -e 1
289 endef
290 TARGET_DEVICES += seagate_blackarmor-nas220
291
292 define Device/seagate_dockstar
293 DEVICE_VENDOR := Seagate
294 DEVICE_MODEL := FreeAgent Dockstar
295 SUPPORTED_DEVICES += dockstar
296 endef
297 TARGET_DEVICES += seagate_dockstar
298
299 define Device/seagate_goflexnet
300 DEVICE_VENDOR := Seagate
301 DEVICE_MODEL := GoFlexNet
302 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4
303 SUPPORTED_DEVICES += goflexnet
304 endef
305 TARGET_DEVICES += seagate_goflexnet
306
307 define Device/seagate_goflexhome
308 DEVICE_VENDOR := Seagate
309 DEVICE_MODEL := GoFlexHome
310 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4
311 SUPPORTED_DEVICES += goflexhome
312 endef
313 TARGET_DEVICES += seagate_goflexhome
314
315 define Device/zyxel_nsa310b
316 DEVICE_VENDOR := ZyXEL
317 DEVICE_MODEL := NSA310b
318 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-r8169 kmod-fs-ext4 \
319 kmod-gpio-button-hotplug kmod-hwmon-lm85
320 SUPPORTED_DEVICES += nsa310b
321 endef
322 TARGET_DEVICES += zyxel_nsa310b
323
324 define Device/zyxel_nsa310s
325 DEVICE_VENDOR := ZyXEL
326 DEVICE_MODEL := NSA310S
327 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-gpio-button-hotplug
328 endef
329 TARGET_DEVICES += zyxel_nsa310s
330
331 define Device/zyxel_nsa325
332 DEVICE_VENDOR := ZyXEL
333 DEVICE_MODEL := NSA325
334 DEVICE_VARIANT := v1/v2
335 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
336 kmod-gpio-button-hotplug kmod-rtc-pcf8563 kmod-usb3
337 SUPPORTED_DEVICES += nsa325
338 endef
339 TARGET_DEVICES += zyxel_nsa325
340
341 $(eval $(call BuildImage))