8aa2d69720fd1fd5fc0fc467f6742971994876c1
[openwrt/staging/xback.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-iomega
68 DEVICE_COMPAT_VERSION := 2.0
69 DEVICE_COMPAT_MESSAGE := \n$\
70 !The partitioning of the router has changed! \n$\
71 Partition design has changed compared to \
72 older versions (up to 23.05) due to kernel size restrictions. \
73 Upgrade via sysupgrade mechanism is not possible, so new \
74 installation via initramfs image is required.\n$\
75 Please adjust bootcmd in u-boot console:\n$\
76 setenv bootcmd \
77 'setenv bootargs $$$${console} $$$${mtdparts} $$$${bootargs_root}; \
78 nand read.e 0x800000 0x100000 0x400000; bootm 0x00800000'\n$\
79 saveenv\n$\
80 or use OpenWrt shell:\n$\
81 fw_setenv bootcmd \
82 "setenv bootargs $$$${console} $$$${mtdparts} $$$${bootargs_root};\
83 nand read.e 0x800000 0x100000 0x400000; bootm 0x00800000"\n$\
84 and reinstall image with initramfs image. \
85 Please see original instructions for more details.
86 endef
87
88 define Device/kernel-size-migration-linksys
89 DEVICE_COMPAT_VERSION := 3.0
90 DEVICE_COMPAT_MESSAGE := \n$\
91 !The partitioning of the router has changed! \n$\
92 Partition design has changed compared to \
93 older versions (up to 23.05) due to kernel size restrictions. \n$\
94 Upgrade via sysupgrade mechanism is not possible, so u-boot args \
95 adjustment and new installation via factory style image is required. \n$\
96 Upgrade instructions: \n$\
97 2. Run folowing commands in console (ssh or serial): \n$\
98 \t fw_printenv \n$\
99 \t fw_setenv nandboot \
100 "$$$$(fw_printenv nandboot | awk -F= '{sub(/^nandboot=/, "");print}' \
101 | sed 's/0x300000/0x400000/g')"\n$\
102 \t fw_setenv altnandboot \
103 "$$$$(fw_printenv altnandboot | awk -F= '{sub(/^altnandboot=/, "");print}' \
104 | sed 's/0x300000/0x400000/g')"\n$\
105 3. Test if envs are ok by 'fw_printenv'. \
106 It should be the same except last argument of\
107 'nand read.e' in 'nandboot' and 'altnandboot'.\n$\
108 4. If envs are ok, please apply FACTORY image with command:\n$\
109 \t sysupgrade -F -n OPENWRT_FACTORY_IMAGE.bin \n$\
110 5. System should start normally. If not, serial console will be required.
111 endef
112
113 define Device/Default
114 PROFILES := Default
115 DEVICE_DTS = kirkwood-$(lastword $(subst _, ,$(1)))
116 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
117 KERNEL := kernel-bin | append-dtb | uImage none
118 KERNEL_NAME := zImage
119 KERNEL_SUFFIX := -uImage
120 KERNEL_IN_UBI := 1
121
122 PAGESIZE := 2048
123 SUBPAGESIZE := 512
124 BLOCKSIZE := 128k
125 IMAGES := sysupgrade.bin factory.bin
126 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
127 IMAGE/factory.bin := append-ubi
128 endef
129
130 define Device/checkpoint_l-50
131 DEVICE_VENDOR := Check Point
132 DEVICE_MODEL := L-50
133 DEVICE_PACKAGES := kmod-ath9k kmod-gpio-button-hotplug kmod-mvsdio \
134 kmod-rtc-s35390a kmod-usb-ledtrig-usbport wpad-basic-mbedtls
135 IMAGES := sysupgrade.bin
136 endef
137 TARGET_DEVICES += checkpoint_l-50
138
139 define Device/cisco_on100
140 DEVICE_VENDOR := Cisco Systems
141 DEVICE_MODEL := ON100
142 KERNEL_SIZE := 5376k
143 KERNEL_IN_UBI :=
144 UBINIZE_OPTS := -E 5
145 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
146 DEVICE_PACKAGES := kmod-mvsdio kmod-rtc-mv
147 SUPPORTED_DEVICES += on100
148 endef
149 TARGET_DEVICES += cisco_on100
150
151 define Device/cloudengines_pogoe02
152 DEVICE_VENDOR := Cloud Engines
153 DEVICE_MODEL := Pogoplug E02
154 DEVICE_DTS := kirkwood-pogo_e02
155 DEVICE_PACKAGES := kmod-rtc-mv
156 SUPPORTED_DEVICES += pogo_e02
157 endef
158 TARGET_DEVICES += cloudengines_pogoe02
159
160 define Device/cloudengines_pogoplugv4
161 DEVICE_VENDOR := Cloud Engines
162 DEVICE_MODEL := Pogoplug V4
163 DEVICE_DTS := kirkwood-pogoplug-series-4
164 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-mvsdio kmod-usb3 \
165 kmod-gpio-button-hotplug kmod-rtc-mv
166 endef
167 TARGET_DEVICES += cloudengines_pogoplugv4
168
169 define Device/ctera_c200-v1
170 DEVICE_VENDOR := Ctera
171 DEVICE_MODEL := C200
172 DEVICE_VARIANT := V1
173 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-gpio-button-hotplug \
174 kmod-hwmon-lm63 kmod-rtc-s35390a kmod-usb-ledtrig-usbport
175 KERNEL := kernel-bin | append-dtb | uImage none | ctera-firmware
176 KERNEL_IN_UBI :=
177 KERNEL_SUFFIX := -factory.firm
178 IMAGES := sysupgrade.bin
179 endef
180 TARGET_DEVICES += ctera_c200-v1
181
182 define Device/endian_4i-edge-200
183 DEVICE_VENDOR := Endian
184 DEVICE_MODEL := 4i Edge 200
185 DEVICE_ALT0_VENDOR := Endian
186 DEVICE_ALT0_MODEL := UTM Mini Firewall
187 DEVICE_PACKAGES := kmod-ath9k kmod-mvsdio wpad-basic-mbedtls kmod-rtc-mv
188 KERNEL_SIZE := 4096k
189 IMAGES := sysupgrade.bin
190 endef
191 TARGET_DEVICES += endian_4i-edge-200
192
193 define Device/globalscale_sheevaplug
194 DEVICE_VENDOR := Globalscale
195 DEVICE_MODEL := Sheevaplug
196 DEVICE_PACKAGES := kmod-mvsdio kmod-rtc-mv
197 endef
198 TARGET_DEVICES += globalscale_sheevaplug
199
200 define Device/iom_iconnect-1.1
201 DEVICE_VENDOR := Iomega
202 DEVICE_MODEL := Iconnect
203 DEVICE_PACKAGES := kmod-rtc-mv
204 DEVICE_DTS := kirkwood-iconnect
205 SUPPORTED_DEVICES += iconnect
206 endef
207 TARGET_DEVICES += iom_iconnect-1.1
208
209 define Device/iom_ix2-200
210 $(Device/kernel-size-migration-iomega)
211 DEVICE_VENDOR := Iomega
212 DEVICE_MODEL := StorCenter ix2-200
213 DEVICE_DTS := kirkwood-iomega_ix2_200
214 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
215 kmod-gpio-button-hotplug kmod-hwmon-lm63 kmod-rtc-mv
216 PAGESIZE := 512
217 SUBPAGESIZE := 256
218 BLOCKSIZE := 16k
219 KERNEL_SIZE := 4096k
220 KERNEL_IN_UBI :=
221 UBINIZE_OPTS := -E 5
222 IMAGE_SIZE := 31744k
223 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
224 check-size
225 endef
226 TARGET_DEVICES += iom_ix2-200
227
228 define Device/iom_ix4-200d
229 $(Device/kernel-size-migration-iomega)
230 DEVICE_VENDOR := Iomega
231 DEVICE_MODEL := StorCenter ix4-200d
232 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
233 kmod-gpio-button-hotplug kmod-gpio-nxp-74hc164 \
234 kmod-hwmon-adt7475 kmod-mvsdio kmod-spi-gpio kmod-rtc-mv
235 PAGESIZE := 512
236 SUBPAGESIZE := 256
237 BLOCKSIZE := 16k
238 KERNEL_SIZE := 4096k
239 KERNEL_IN_UBI :=
240 UBINIZE_OPTS := -E 5
241 IMAGE_SIZE := 31744k
242 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
243 check-size
244 endef
245 TARGET_DEVICES += iom_ix4-200d
246
247 define Device/iptime_nas1
248 DEVICE_VENDOR := ipTIME
249 DEVICE_MODEL := NAS1
250 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
251 kmod-gpio-button-hotplug kmod-gpio-pca953x kmod-hwmon-drivetemp \
252 kmod-hwmon-gpiofan kmod-usb-ledtrig-usbport kmod-rtc-mv kmod-thermal \
253 -uboot-envtools
254 KERNEL := $$(KERNEL) | iptime-naspkg nas1
255 BLOCKSIZE := 256k
256 IMAGE_SIZE := 15872k
257 IMAGES := sysupgrade.bin
258 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
259 check-size | append-metadata
260 endef
261 TARGET_DEVICES += iptime_nas1
262
263 define Device/linksys
264 $(Device/kernel-size-migration-linksys)
265 DEVICE_VENDOR := Linksys
266 DEVICE_PACKAGES := kmod-mwl8k wpad-basic-mbedtls kmod-gpio-button-hotplug \
267 kmod-rtc-mv
268 KERNEL_IN_UBI :=
269 KERNEL_SIZE := 4096k
270 UBINIZE_OPTS := -E 5
271 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
272 endef
273
274 define Device/linksys_e4200-v2
275 $(Device/linksys)
276 DEVICE_MODEL := E4200
277 DEVICE_VARIANT := v2
278 SUPPORTED_DEVICES += linksys,viper linksys-viper
279 endef
280 TARGET_DEVICES += linksys_e4200-v2
281
282 define Device/linksys_ea3500
283 $(Device/linksys)
284 DEVICE_MODEL := EA3500
285 PAGESIZE := 512
286 SUBPAGESIZE := 256
287 BLOCKSIZE := 16k
288 SUPPORTED_DEVICES += linksys,audi linksys-audi
289 endef
290 TARGET_DEVICES += linksys_ea3500
291
292 define Device/linksys_ea4500
293 $(Device/linksys)
294 DEVICE_MODEL := EA4500
295 SUPPORTED_DEVICES += linksys,viper linksys-viper
296 endef
297 TARGET_DEVICES += linksys_ea4500
298
299 define Device/netgear_readynas-duo-v2
300 DEVICE_VENDOR := NETGEAR
301 DEVICE_MODEL := ReadyNAS Duo
302 DEVICE_VARIANT := v2
303 DEVICE_DTS := kirkwood-netgear_readynas_duo_v2
304 KERNEL_IN_UBI :=
305 IMAGES := sysupgrade.bin
306 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
307 kmod-gpio-button-hotplug kmod-hwmon-g762 kmod-rtc-rs5c372a kmod-usb3
308 endef
309 TARGET_DEVICES += netgear_readynas-duo-v2
310
311 define Device/netgear_stora
312 DEVICE_VENDOR := Netgear
313 DEVICE_MODEL := Stora (MS2000/2110)
314 DEVICE_DTS := kirkwood-stora
315 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
316 kmod-rtc-pcf8563 kmod-hwmon-lm75 kmod-hwmon-tc654 \
317 kmod-gpio-button-hotplug
318 endef
319 TARGET_DEVICES += netgear_stora
320
321 define Device/raidsonic_ib-nas62x0
322 DEVICE_VENDOR := RaidSonic
323 DEVICE_MODEL := ICY BOX IB-NAS62x0
324 DEVICE_DTS := kirkwood-ib62x0
325 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-rtc-mv
326 SUPPORTED_DEVICES += ib62x0
327 endef
328 TARGET_DEVICES += raidsonic_ib-nas62x0
329
330 define Device/seagate_blackarmor-nas220
331 DEVICE_VENDOR := Seagate
332 DEVICE_MODEL := Blackarmor NAS220
333 DEVICE_PACKAGES := kmod-hwmon-adt7475 kmod-fs-ext4 kmod-ata-marvell-sata \
334 mdadm kmod-gpio-button-hotplug kmod-rtc-mv
335 PAGESIZE := 512
336 SUBPAGESIZE := 256
337 BLOCKSIZE := 16k
338 UBINIZE_OPTS := -e 1
339 endef
340 TARGET_DEVICES += seagate_blackarmor-nas220
341
342 define Device/seagate_dockstar
343 DEVICE_VENDOR := Seagate
344 DEVICE_MODEL := FreeAgent Dockstar
345 DEVICE_PACKAGES := kmod-rtc-mv
346 SUPPORTED_DEVICES += dockstar
347 endef
348 TARGET_DEVICES += seagate_dockstar
349
350 define Device/seagate_goflexnet
351 DEVICE_VENDOR := Seagate
352 DEVICE_MODEL := GoFlexNet
353 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-rtc-mv
354 SUPPORTED_DEVICES += goflexnet
355 endef
356 TARGET_DEVICES += seagate_goflexnet
357
358 define Device/seagate_goflexhome
359 DEVICE_VENDOR := Seagate
360 DEVICE_MODEL := GoFlexHome
361 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-rtc-mv
362 SUPPORTED_DEVICES += goflexhome
363 endef
364 TARGET_DEVICES += seagate_goflexhome
365
366 define Device/zyxel_nsa310b
367 DEVICE_VENDOR := ZyXEL
368 DEVICE_MODEL := NSA310b
369 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-r8169 kmod-fs-ext4 \
370 kmod-gpio-button-hotplug kmod-hwmon-lm85 kmod-rtc-mv
371 SUPPORTED_DEVICES += nsa310b
372 endef
373 TARGET_DEVICES += zyxel_nsa310b
374
375 define Device/zyxel_nsa310s
376 DEVICE_VENDOR := ZyXEL
377 DEVICE_MODEL := NSA310S
378 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-gpio-button-hotplug
379 endef
380 TARGET_DEVICES += zyxel_nsa310s
381
382 define Device/zyxel_nsa325
383 DEVICE_VENDOR := ZyXEL
384 DEVICE_MODEL := NSA325
385 DEVICE_VARIANT := v1/v2
386 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
387 kmod-gpio-button-hotplug kmod-rtc-pcf8563 kmod-usb3
388 SUPPORTED_DEVICES += nsa325
389 endef
390 TARGET_DEVICES += zyxel_nsa325
391
392 $(eval $(call BuildImage))