kirkwood: split files into 6.1 and 6.6 version
[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-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 ifdef CONFIG_LINUX_6_6
116 DEVICE_DTS_DIR := $(DTS_DIR)/marvell
117 endif
118 DEVICE_DTS = kirkwood-$(lastword $(subst _, ,$(1)))
119 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
120 KERNEL := kernel-bin | append-dtb | uImage none
121 KERNEL_NAME := zImage
122 KERNEL_SUFFIX := -uImage
123 KERNEL_IN_UBI := 1
124
125 PAGESIZE := 2048
126 SUBPAGESIZE := 512
127 BLOCKSIZE := 128k
128 IMAGES := sysupgrade.bin factory.bin
129 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
130 IMAGE/factory.bin := append-ubi
131 endef
132
133 define Device/checkpoint_l-50
134 DEVICE_VENDOR := Check Point
135 DEVICE_MODEL := L-50
136 DEVICE_PACKAGES := kmod-ath9k kmod-gpio-button-hotplug kmod-mvsdio \
137 kmod-rtc-s35390a kmod-usb-ledtrig-usbport wpad-basic-mbedtls
138 IMAGES := sysupgrade.bin
139 endef
140 TARGET_DEVICES += checkpoint_l-50
141
142 define Device/cisco_on100
143 DEVICE_VENDOR := Cisco Systems
144 DEVICE_MODEL := ON100
145 KERNEL_SIZE := 5376k
146 KERNEL_IN_UBI :=
147 UBINIZE_OPTS := -E 5
148 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
149 DEVICE_PACKAGES := kmod-mvsdio kmod-rtc-mv
150 SUPPORTED_DEVICES += on100
151 endef
152 TARGET_DEVICES += cisco_on100
153
154 define Device/cloudengines_pogoe02
155 DEVICE_VENDOR := Cloud Engines
156 DEVICE_MODEL := Pogoplug E02
157 DEVICE_DTS := kirkwood-pogo_e02
158 DEVICE_PACKAGES := kmod-rtc-mv
159 SUPPORTED_DEVICES += pogo_e02
160 endef
161 TARGET_DEVICES += cloudengines_pogoe02
162
163 define Device/cloudengines_pogoplugv4
164 DEVICE_VENDOR := Cloud Engines
165 DEVICE_MODEL := Pogoplug V4
166 DEVICE_DTS := kirkwood-pogoplug-series-4
167 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-mvsdio kmod-usb3 \
168 kmod-gpio-button-hotplug kmod-rtc-mv
169 endef
170 TARGET_DEVICES += cloudengines_pogoplugv4
171
172 define Device/ctera_c200-v1
173 DEVICE_VENDOR := Ctera
174 DEVICE_MODEL := C200
175 DEVICE_VARIANT := V1
176 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-gpio-button-hotplug \
177 kmod-hwmon-lm63 kmod-rtc-s35390a kmod-usb-ledtrig-usbport
178 KERNEL := kernel-bin | append-dtb | uImage none | ctera-firmware
179 KERNEL_IN_UBI :=
180 KERNEL_SUFFIX := -factory.firm
181 IMAGES := sysupgrade.bin
182 endef
183 TARGET_DEVICES += ctera_c200-v1
184
185 define Device/endian_4i-edge-200
186 DEVICE_VENDOR := Endian
187 DEVICE_MODEL := 4i Edge 200
188 DEVICE_ALT0_VENDOR := Endian
189 DEVICE_ALT0_MODEL := UTM Mini Firewall
190 DEVICE_PACKAGES := kmod-ath9k kmod-mvsdio wpad-basic-mbedtls kmod-rtc-mv
191 KERNEL_SIZE := 4096k
192 IMAGES := sysupgrade.bin
193 endef
194 TARGET_DEVICES += endian_4i-edge-200
195
196 define Device/globalscale_sheevaplug
197 DEVICE_VENDOR := Globalscale
198 DEVICE_MODEL := Sheevaplug
199 DEVICE_PACKAGES := kmod-mvsdio kmod-rtc-mv
200 endef
201 TARGET_DEVICES += globalscale_sheevaplug
202
203 define Device/iom_iconnect-1.1
204 DEVICE_VENDOR := Iomega
205 DEVICE_MODEL := Iconnect
206 DEVICE_PACKAGES := kmod-rtc-mv
207 DEVICE_DTS := kirkwood-iconnect
208 SUPPORTED_DEVICES += iconnect
209 endef
210 TARGET_DEVICES += iom_iconnect-1.1
211
212 define Device/iom_ix2-200
213 $(Device/kernel-size-migration-iomega)
214 DEVICE_VENDOR := Iomega
215 DEVICE_MODEL := StorCenter ix2-200
216 DEVICE_DTS := kirkwood-iomega_ix2_200
217 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
218 kmod-gpio-button-hotplug kmod-hwmon-lm63 kmod-rtc-mv
219 PAGESIZE := 512
220 SUBPAGESIZE := 256
221 BLOCKSIZE := 16k
222 KERNEL_SIZE := 4096k
223 KERNEL_IN_UBI :=
224 UBINIZE_OPTS := -E 5
225 IMAGE_SIZE := 31744k
226 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
227 check-size
228 endef
229 TARGET_DEVICES += iom_ix2-200
230
231 define Device/iom_ix4-200d
232 $(Device/kernel-size-migration-iomega)
233 DEVICE_VENDOR := Iomega
234 DEVICE_MODEL := StorCenter ix4-200d
235 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
236 kmod-gpio-button-hotplug kmod-gpio-nxp-74hc164 \
237 kmod-hwmon-adt7475 kmod-mvsdio kmod-spi-gpio kmod-rtc-mv
238 PAGESIZE := 512
239 SUBPAGESIZE := 256
240 BLOCKSIZE := 16k
241 KERNEL_SIZE := 4096k
242 KERNEL_IN_UBI :=
243 UBINIZE_OPTS := -E 5
244 IMAGE_SIZE := 31744k
245 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
246 check-size
247 endef
248 TARGET_DEVICES += iom_ix4-200d
249
250 define Device/iptime_nas1
251 DEVICE_VENDOR := ipTIME
252 DEVICE_MODEL := NAS1
253 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
254 kmod-gpio-button-hotplug kmod-gpio-pca953x kmod-hwmon-drivetemp \
255 kmod-hwmon-gpiofan kmod-usb-ledtrig-usbport kmod-rtc-mv kmod-thermal \
256 -uboot-envtools
257 KERNEL := $$(KERNEL) | iptime-naspkg nas1
258 BLOCKSIZE := 256k
259 IMAGE_SIZE := 15872k
260 IMAGES := sysupgrade.bin
261 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
262 check-size | append-metadata
263 endef
264 TARGET_DEVICES += iptime_nas1
265
266 define Device/linksys
267 $(Device/kernel-size-migration-linksys)
268 DEVICE_VENDOR := Linksys
269 DEVICE_PACKAGES := kmod-mwl8k wpad-basic-mbedtls kmod-gpio-button-hotplug \
270 kmod-rtc-mv
271 KERNEL_IN_UBI :=
272 KERNEL_SIZE := 4096k
273 UBINIZE_OPTS := -E 5
274 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
275 endef
276
277 define Device/linksys_e4200-v2
278 $(Device/linksys)
279 DEVICE_MODEL := E4200
280 DEVICE_VARIANT := v2
281 SUPPORTED_DEVICES += linksys,viper linksys-viper
282 endef
283 TARGET_DEVICES += linksys_e4200-v2
284
285 define Device/linksys_ea3500
286 $(Device/linksys)
287 DEVICE_MODEL := EA3500
288 PAGESIZE := 512
289 SUBPAGESIZE := 256
290 BLOCKSIZE := 16k
291 SUPPORTED_DEVICES += linksys,audi linksys-audi
292 endef
293 TARGET_DEVICES += linksys_ea3500
294
295 define Device/linksys_ea4500
296 $(Device/linksys)
297 DEVICE_MODEL := EA4500
298 SUPPORTED_DEVICES += linksys,viper linksys-viper
299 endef
300 TARGET_DEVICES += linksys_ea4500
301
302 define Device/netgear_readynas-duo-v2
303 DEVICE_VENDOR := NETGEAR
304 DEVICE_MODEL := ReadyNAS Duo
305 DEVICE_VARIANT := v2
306 DEVICE_DTS := kirkwood-netgear_readynas_duo_v2
307 KERNEL_IN_UBI :=
308 IMAGES := sysupgrade.bin
309 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
310 kmod-gpio-button-hotplug kmod-hwmon-g762 kmod-rtc-rs5c372a kmod-usb3
311 endef
312 TARGET_DEVICES += netgear_readynas-duo-v2
313
314 define Device/netgear_stora
315 DEVICE_VENDOR := Netgear
316 DEVICE_MODEL := Stora (MS2000/2110)
317 DEVICE_DTS := kirkwood-stora
318 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
319 kmod-rtc-pcf8563 kmod-hwmon-lm75 kmod-hwmon-tc654 \
320 kmod-gpio-button-hotplug
321 endef
322 TARGET_DEVICES += netgear_stora
323
324 define Device/raidsonic_ib-nas62x0
325 DEVICE_VENDOR := RaidSonic
326 DEVICE_MODEL := ICY BOX IB-NAS62x0
327 DEVICE_DTS := kirkwood-ib62x0
328 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-rtc-mv
329 SUPPORTED_DEVICES += ib62x0
330 endef
331 TARGET_DEVICES += raidsonic_ib-nas62x0
332
333 define Device/seagate_blackarmor-nas220
334 DEVICE_VENDOR := Seagate
335 DEVICE_MODEL := Blackarmor NAS220
336 DEVICE_PACKAGES := kmod-hwmon-adt7475 kmod-fs-ext4 kmod-ata-marvell-sata \
337 mdadm kmod-gpio-button-hotplug kmod-rtc-mv
338 PAGESIZE := 512
339 SUBPAGESIZE := 256
340 BLOCKSIZE := 16k
341 UBINIZE_OPTS := -e 1
342 endef
343 TARGET_DEVICES += seagate_blackarmor-nas220
344
345 define Device/seagate_dockstar
346 DEVICE_VENDOR := Seagate
347 DEVICE_MODEL := FreeAgent Dockstar
348 DEVICE_PACKAGES := kmod-rtc-mv
349 SUPPORTED_DEVICES += dockstar
350 endef
351 TARGET_DEVICES += seagate_dockstar
352
353 define Device/seagate_goflexnet
354 DEVICE_VENDOR := Seagate
355 DEVICE_MODEL := GoFlexNet
356 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-rtc-mv
357 SUPPORTED_DEVICES += goflexnet
358 endef
359 TARGET_DEVICES += seagate_goflexnet
360
361 define Device/seagate_goflexhome
362 DEVICE_VENDOR := Seagate
363 DEVICE_MODEL := GoFlexHome
364 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-rtc-mv
365 SUPPORTED_DEVICES += goflexhome
366 endef
367 TARGET_DEVICES += seagate_goflexhome
368
369 define Device/zyxel_nsa310b
370 DEVICE_VENDOR := ZyXEL
371 DEVICE_MODEL := NSA310b
372 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-r8169 kmod-fs-ext4 \
373 kmod-gpio-button-hotplug kmod-hwmon-lm85 kmod-rtc-mv
374 SUPPORTED_DEVICES += nsa310b
375 endef
376 TARGET_DEVICES += zyxel_nsa310b
377
378 define Device/zyxel_nsa310s
379 DEVICE_VENDOR := ZyXEL
380 DEVICE_MODEL := NSA310S
381 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-gpio-button-hotplug
382 endef
383 TARGET_DEVICES += zyxel_nsa310s
384
385 define Device/zyxel_nsa325
386 DEVICE_VENDOR := ZyXEL
387 DEVICE_MODEL := NSA325
388 DEVICE_VARIANT := v1/v2
389 DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
390 kmod-gpio-button-hotplug kmod-rtc-pcf8563 kmod-usb3
391 SUPPORTED_DEVICES += nsa325
392 endef
393 TARGET_DEVICES += zyxel_nsa325
394
395 $(eval $(call BuildImage))