mediatek: add support for BananaPi BPI-R4 board
[openwrt/openwrt.git] / target / linux / mediatek / image / filogic.mk
1 DTS_DIR := $(DTS_DIR)/mediatek
2
3 define Image/Prepare
4 # For UBI we want only one extra block
5 rm -f $(KDIR)/ubi_mark
6 echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark
7 endef
8
9 define Build/mt7981-bl2
10 cat $(STAGING_DIR_IMAGE)/mt7981-$1-bl2.img >> $@
11 endef
12
13 define Build/mt7981-bl31-uboot
14 cat $(STAGING_DIR_IMAGE)/mt7981_$1-u-boot.fip >> $@
15 endef
16
17 define Build/mt7986-bl2
18 cat $(STAGING_DIR_IMAGE)/mt7986-$1-bl2.img >> $@
19 endef
20
21 define Build/mt7986-bl31-uboot
22 cat $(STAGING_DIR_IMAGE)/mt7986_$1-u-boot.fip >> $@
23 endef
24
25 define Build/mt7988-bl2
26 cat $(STAGING_DIR_IMAGE)/mt7988-$1-bl2.img >> $@
27 endef
28
29 define Build/mt7988-bl31-uboot
30 cat $(STAGING_DIR_IMAGE)/mt7988_$1-u-boot.fip >> $@
31 endef
32
33 define Build/mt798x-gpt
34 cp $@ $@.tmp 2>/dev/null || true
35 ptgen -g -o $@.tmp -a 1 -l 1024 \
36 $(if $(findstring sdmmc,$1), \
37 -H \
38 -t 0x83 -N bl2 -r -p 4079k@17k \
39 ) \
40 -t 0x83 -N ubootenv -r -p 512k@4M \
41 -t 0x83 -N factory -r -p 2M@4608k \
42 -t 0xef -N fip -r -p 4M@6656k \
43 -N recovery -r -p 32M@12M \
44 $(if $(findstring sdmmc,$1), \
45 -N install -r -p 20M@44M \
46 -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@64M \
47 ) \
48 $(if $(findstring emmc,$1), \
49 -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@64M \
50 )
51 cat $@.tmp >> $@
52 rm $@.tmp
53 endef
54
55 metadata_gl_json = \
56 '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
57 "metadata_version": "1.1", \
58 "compat_version": "$(call json_quote,$(compat_version))", \
59 $(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \
60 $(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \
61 [$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma) \
62 "supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \
63 $(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma)) \
64 "version": { \
65 "release": "$(call json_quote,$(VERSION_NUMBER))", \
66 "date": "$(shell TZ='Asia/Chongqing' date '+%Y%m%d%H%M%S')", \
67 "dist": "$(call json_quote,$(VERSION_DIST))", \
68 "version": "$(call json_quote,$(VERSION_NUMBER))", \
69 "revision": "$(call json_quote,$(REVISION))", \
70 "target": "$(call json_quote,$(TARGETID))", \
71 "board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
72 } \
73 }'
74
75 define Build/append-gl-metadata
76 $(if $(SUPPORTED_DEVICES),-echo $(call metadata_gl_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@)
77 sha256sum "$@" | cut -d" " -f1 > "$@.sha256sum"
78 [ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \
79 cp "$(BUILD_KEY).ucert" "$@.ucert" ;\
80 usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\
81 ucert -A -c "$@.ucert" -x "$@.sig" ;\
82 fwtool -S "$@.ucert" "$@" ;\
83 }
84 endef
85
86 define Build/zyxel-nwa-fit-filogic
87 $(TOPDIR)/scripts/mkits-zyxel-fit-filogic.sh \
88 $@.its $@ "80 e1 ff ff ff ff ff ff ff ff"
89 PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
90 @mv $@.new $@
91 endef
92
93 define Build/cetron-header
94 $(eval magic=$(word 1,$(1)))
95 $(eval model=$(word 2,$(1)))
96 ( \
97 dd if=/dev/zero bs=856 count=1 2>/dev/null; \
98 printf "$(model)," | dd bs=128 count=1 conv=sync 2>/dev/null; \
99 md5sum $@ | cut -f1 -d" " | dd bs=32 count=1 2>/dev/null; \
100 printf "$(magic)" | dd bs=4 count=1 conv=sync 2>/dev/null; \
101 cat $@; \
102 ) > $@.tmp
103 fw_crc=$$(gzip -c $@.tmp | tail -c 8 | od -An -N4 -tx4 --endian little | tr -d ' \n'); \
104 printf "$$(echo $$fw_crc | sed 's/../\\x&/g')" | cat - $@.tmp > $@
105 rm $@.tmp
106 endef
107
108 define Device/acelink_ew-7886cax
109 DEVICE_VENDOR := Acelink
110 DEVICE_MODEL := EW-7886CAX
111 DEVICE_DTS := mt7986a-acelink-ew-7886cax
112 DEVICE_DTS_DIR := ../dts
113 DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
114 UBINIZE_OPTS := -E 5
115 BLOCKSIZE := 128k
116 PAGESIZE := 2048
117 IMAGE_SIZE := 65536k
118 KERNEL_IN_UBI := 1
119 IMAGES += factory.bin
120 IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
121 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
122 endef
123 TARGET_DEVICES += acelink_ew-7886cax
124
125 define Device/acer_predator-w6
126 DEVICE_VENDOR := Acer
127 DEVICE_MODEL := Predator W6
128 DEVICE_DTS := mt7986a-acer-predator-w6
129 DEVICE_DTS_DIR := ../dts
130 DEVICE_DTS_LOADADDR := 0x47000000
131 DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware kmod-mt7916-firmware mt7986-wo-firmware e2fsprogs f2fsck mkf2fs
132 IMAGES := sysupgrade.bin
133 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
134 KERNEL_INITRAMFS := kernel-bin | lzma | \
135 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
136 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
137 endef
138 TARGET_DEVICES += acer_predator-w6
139
140 define Device/adtran_smartrg
141 DEVICE_VENDOR := Adtran
142 DEVICE_DTS_DIR := ../dts
143 DEVICE_PACKAGES := e2fsprogs f2fsck mkf2fs kmod-hwmon-pwmfan \
144 kmod-mt7986-firmware mt7986-wo-firmware
145 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
146 endef
147
148 define Device/smartrg_sdg-8612
149 $(call Device/adtran_smartrg)
150 DEVICE_MODEL := SDG-8612
151 DEVICE_DTS := mt7986a-smartrg-SDG-8612
152 endef
153 TARGET_DEVICES += smartrg_sdg-8612
154
155 define Device/smartrg_sdg-8614
156 $(call Device/adtran_smartrg)
157 DEVICE_MODEL := SDG-8614
158 DEVICE_DTS := mt7986a-smartrg-SDG-8614
159 endef
160 TARGET_DEVICES += smartrg_sdg-8614
161
162 define Device/smartrg_sdg-8622
163 $(call Device/adtran_smartrg)
164 DEVICE_MODEL := SDG-8622
165 DEVICE_DTS := mt7986a-smartrg-SDG-8622
166 DEVICE_PACKAGES += kmod-mt7915-firmware
167 endef
168 TARGET_DEVICES += smartrg_sdg-8622
169
170 define Device/smartrg_sdg-8632
171 $(call Device/adtran_smartrg)
172 DEVICE_MODEL := SDG-8632
173 DEVICE_DTS := mt7986a-smartrg-SDG-8632
174 DEVICE_PACKAGES += kmod-mt7915-firmware
175 endef
176 TARGET_DEVICES += smartrg_sdg-8632
177
178 define Device/asus_rt-ax59u
179 DEVICE_VENDOR := ASUS
180 DEVICE_MODEL := RT-AX59U
181 DEVICE_DTS := mt7986a-asus-rt-ax59u
182 DEVICE_DTS_DIR := ../dts
183 DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware
184 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
185 endef
186 TARGET_DEVICES += asus_rt-ax59u
187
188 define Device/asus_tuf-ax4200
189 DEVICE_VENDOR := ASUS
190 DEVICE_MODEL := TUF-AX4200
191 DEVICE_DTS := mt7986a-asus-tuf-ax4200
192 DEVICE_DTS_DIR := ../dts
193 DEVICE_DTS_LOADADDR := 0x47000000
194 DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware
195 IMAGES := sysupgrade.bin
196 KERNEL := kernel-bin | lzma | \
197 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
198 KERNEL_INITRAMFS := kernel-bin | lzma | \
199 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
200 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
201 endef
202 TARGET_DEVICES += asus_tuf-ax4200
203
204 define Device/asus_tuf-ax6000
205 DEVICE_VENDOR := ASUS
206 DEVICE_MODEL := TUF-AX6000
207 DEVICE_DTS := mt7986a-asus-tuf-ax6000
208 DEVICE_DTS_DIR := ../dts
209 DEVICE_DTS_LOADADDR := 0x47000000
210 DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware
211 IMAGES := sysupgrade.bin
212 KERNEL := kernel-bin | lzma | \
213 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
214 KERNEL_INITRAMFS := kernel-bin | lzma | \
215 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
216 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
217 endef
218 TARGET_DEVICES += asus_tuf-ax6000
219
220 define Device/bananapi_bpi-r3
221 DEVICE_VENDOR := Bananapi
222 DEVICE_MODEL := BPi-R3
223 DEVICE_DTS := mt7986a-bananapi-bpi-r3
224 DEVICE_DTS_CONFIG := config-mt7986a-bananapi-bpi-r3
225 DEVICE_DTS_OVERLAY:= mt7986a-bananapi-bpi-r3-emmc mt7986a-bananapi-bpi-r3-nand \
226 mt7986a-bananapi-bpi-r3-nor mt7986a-bananapi-bpi-r3-sd \
227 mt7986a-bananapi-bpi-r3-respeaker-2mics
228 DEVICE_DTS_DIR := $(DTS_DIR)/
229 DEVICE_DTS_LOADADDR := 0x43f00000
230 DEVICE_PACKAGES := kmod-hwmon-pwmfan kmod-i2c-gpio kmod-mt7986-firmware kmod-sfp kmod-usb3 e2fsprogs f2fsck mkf2fs mt7986-wo-firmware
231 IMAGES := sysupgrade.itb
232 KERNEL_LOADADDR := 0x44000000
233 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
234 ARTIFACTS := \
235 emmc-preloader.bin emmc-bl31-uboot.fip \
236 nor-preloader.bin nor-bl31-uboot.fip \
237 sdcard.img.gz \
238 snand-preloader.bin snand-bl31-uboot.fip
239 ARTIFACT/emmc-preloader.bin := mt7986-bl2 emmc-ddr4
240 ARTIFACT/emmc-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-emmc
241 ARTIFACT/nor-preloader.bin := mt7986-bl2 nor-ddr4
242 ARTIFACT/nor-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-nor
243 ARTIFACT/snand-preloader.bin := mt7986-bl2 spim-nand-ddr4
244 ARTIFACT/snand-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-snand
245 ARTIFACT/sdcard.img.gz := mt798x-gpt sdmmc |\
246 pad-to 17k | mt7986-bl2 sdmmc-ddr4 |\
247 pad-to 6656k | mt7986-bl31-uboot bananapi_bpi-r3-sdmmc |\
248 $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\
249 pad-to 12M | append-image-stage initramfs-recovery.itb | check-size 44m |\
250 ) \
251 pad-to 44M | mt7986-bl2 spim-nand-ddr4 |\
252 pad-to 45M | mt7986-bl31-uboot bananapi_bpi-r3-snand |\
253 pad-to 49M | mt7986-bl2 nor-ddr4 |\
254 pad-to 50M | mt7986-bl31-uboot bananapi_bpi-r3-nor |\
255 pad-to 51M | mt7986-bl2 emmc-ddr4 |\
256 pad-to 52M | mt7986-bl31-uboot bananapi_bpi-r3-emmc |\
257 pad-to 56M | mt798x-gpt emmc |\
258 $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
259 pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\
260 ) \
261 gzip
262 ifeq ($(DUMP),)
263 IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
264 endif
265 KERNEL := kernel-bin | gzip
266 KERNEL_INITRAMFS := kernel-bin | lzma | \
267 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
268 IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | pad-rootfs | append-metadata
269 DEVICE_DTC_FLAGS := --pad 4096
270 DEVICE_COMPAT_VERSION := 1.1
271 DEVICE_COMPAT_MESSAGE := Device tree overlay mechanism needs bootloader update
272 endef
273 TARGET_DEVICES += bananapi_bpi-r3
274
275 define Device/bananapi_bpi-r4
276 DEVICE_VENDOR := Bananapi
277 DEVICE_MODEL := BPi-R4
278 DEVICE_DTS := mt7988a-bananapi-bpi-r4
279 DEVICE_DTS_CONFIG := config-mt7988a-bananapi-bpi-r4
280 DEVICE_DTS_DIR := $(DTS_DIR)/
281 DEVICE_DTS_LOADADDR := 0x45f00000
282 DEVICE_DTS_OVERLAY:= mt7988a-bananapi-bpi-r4-emmc mt7988a-bananapi-bpi-r4-rtc mt7988a-bananapi-bpi-r4-sd mt7988a-bananapi-bpi-r4-wifi-mt7996a
283 DEVICE_DTC_FLAGS := --pad 4096
284 DEVICE_PACKAGES := fitblk kmod-hwmon-pwmfan kmod-i2c-mux-pca954x kmod-eeprom-at24 kmod-mt7996-firmware \
285 kmod-rtc-pcf8563 kmod-sfp kmod-usb3 e2fsprogs f2fsck mkf2fs
286 IMAGES := sysupgrade.itb
287 KERNEL_LOADADDR := 0x46000000
288 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
289 ARTIFACTS := \
290 emmc-preloader.bin emmc-bl31-uboot.fip \
291 sdcard.img.gz \
292 snand-preloader.bin snand-bl31-uboot.fip
293 ARTIFACT/emmc-preloader.bin := mt7988-bl2 emmc-comb
294 ARTIFACT/emmc-bl31-uboot.fip := mt7988-bl31-uboot bananapi_bpi-r4-emmc
295 ARTIFACT/snand-preloader.bin := mt7988-bl2 spim-nand-ubi-comb
296 ARTIFACT/snand-bl31-uboot.fip := mt7988-bl31-uboot bananapi_bpi-r4-snand
297 ARTIFACT/sdcard.img.gz := mt798x-gpt sdmmc |\
298 pad-to 17k | mt7988-bl2 sdmmc-comb |\
299 pad-to 6656k | mt7988-bl31-uboot bananapi_bpi-r4-sdmmc |\
300 $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\
301 pad-to 12M | append-image-stage initramfs-recovery.itb | check-size 44m |\
302 ) \
303 pad-to 44M | mt7988-bl2 spim-nand-ubi-comb |\
304 pad-to 45M | mt7988-bl31-uboot bananapi_bpi-r4-snand |\
305 pad-to 51M | mt7988-bl2 emmc-comb |\
306 pad-to 52M | mt7988-bl31-uboot bananapi_bpi-r4-emmc |\
307 pad-to 56M | mt798x-gpt emmc |\
308 $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
309 pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\
310 ) \
311 gzip
312 IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
313 KERNEL := kernel-bin | gzip
314 KERNEL_INITRAMFS := kernel-bin | lzma | \
315 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
316 IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-with-rootfs | pad-rootfs | append-metadata
317 endef
318 TARGET_DEVICES += bananapi_bpi-r4
319
320 define Device/cetron_ct3003
321 DEVICE_VENDOR := Cetron
322 DEVICE_MODEL := CT3003
323 DEVICE_DTS := mt7981b-cetron-ct3003
324 DEVICE_DTS_DIR := ../dts
325 SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb
326 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
327 UBINIZE_OPTS := -E 5
328 BLOCKSIZE := 128k
329 PAGESIZE := 2048
330 KERNEL_IN_UBI := 1
331 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
332 IMAGES += factory.bin
333 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | cetron-header rd30 CT3003
334 endef
335 TARGET_DEVICES += cetron_ct3003
336
337 define Device/cmcc_rax3000m
338 DEVICE_VENDOR := CMCC
339 DEVICE_MODEL := RAX3000M
340 DEVICE_DTS := mt7981b-cmcc-rax3000m
341 DEVICE_DTS_OVERLAY := mt7981b-cmcc-rax3000m-emmc mt7981b-cmcc-rax3000m-nand
342 DEVICE_DTS_DIR := ../dts
343 DEVICE_DTC_FLAGS := --pad 4096
344 DEVICE_DTS_LOADADDR := 0x43f00000
345 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 \
346 e2fsprogs f2fsck mkf2fs
347 KERNEL_LOADADDR := 0x44000000
348 KERNEL := kernel-bin | gzip
349 KERNEL_INITRAMFS := kernel-bin | lzma | \
350 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
351 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
352 KERNEL_IN_UBI := 1
353 UBOOTENV_IN_UBI := 1
354 IMAGES := sysupgrade.itb
355 IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
356 IMAGE/sysupgrade.itb := append-kernel | \
357 fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | \
358 pad-rootfs | append-metadata
359 ARTIFACTS := \
360 emmc-gpt.bin emmc-preloader.bin emmc-bl31-uboot.fip \
361 nand-preloader.bin nand-bl31-uboot.fip
362 ARTIFACT/emmc-gpt.bin := mt798x-gpt emmc
363 ARTIFACT/emmc-preloader.bin := mt7981-bl2 emmc-ddr4
364 ARTIFACT/emmc-bl31-uboot.fip := mt7981-bl31-uboot cmcc_rax3000m-emmc
365 ARTIFACT/nand-preloader.bin := mt7981-bl2 spim-nand-ddr4
366 ARTIFACT/nand-bl31-uboot.fip := mt7981-bl31-uboot cmcc_rax3000m-nand
367 endef
368 TARGET_DEVICES += cmcc_rax3000m
369
370 define Device/comfast_cf-e393ax
371 DEVICE_VENDOR := Comfast
372 DEVICE_MODEL := CF-E393AX
373 DEVICE_DTS := mt7981a-comfast-cf-e393ax
374 DEVICE_DTS_DIR := ../dts
375 DEVICE_DTC_FLAGS := --pad 4096
376 DEVICE_DTS_LOADADDR := 0x43f00000
377 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
378 KERNEL_LOADADDR := 0x44000000
379 KERNEL = kernel-bin | lzma | \
380 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
381 KERNEL_INITRAMFS = kernel-bin | lzma | \
382 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd
383 UBINIZE_OPTS := -E 5
384 BLOCKSIZE := 128k
385 PAGESIZE := 2048
386 IMAGE_SIZE := 65536k
387 KERNEL_IN_UBI := 1
388 IMAGES := sysupgrade.bin factory.bin
389 IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
390 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
391 endef
392 TARGET_DEVICES += comfast_cf-e393ax
393
394 define Device/confiabits_mt7981
395 DEVICE_VENDOR := Confiabits
396 DEVICE_MODEL := MT7981
397 DEVICE_DTS := mt7981b-confiabits-mt7981
398 DEVICE_DTS_DIR := ../dts
399 SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-2500wan-gmac2-rfb
400 UBINIZE_OPTS := -E 5
401 BLOCKSIZE := 128k
402 PAGESIZE := 2048
403 IMAGE_SIZE := 65536k
404 KERNEL_IN_UBI := 1
405 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
406 DEVICE_PACKAGES := kmod-usb3 kmod-mt7981-firmware mt7981-wo-firmware
407 endef
408 TARGET_DEVICES += confiabits_mt7981
409
410 define Device/cudy_wr3000-v1
411 DEVICE_VENDOR := Cudy
412 DEVICE_MODEL := WR3000
413 DEVICE_VARIANT := v1
414 DEVICE_DTS := mt7981b-cudy-wr3000-v1
415 DEVICE_DTS_DIR := ../dts
416 DEVICE_DTS_LOADADDR := 0x47000000
417 IMAGES := sysupgrade.bin
418 IMAGE_SIZE := 15424k
419 SUPPORTED_DEVICES += R31
420 KERNEL := kernel-bin | lzma | \
421 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
422 KERNEL_INITRAMFS := kernel-bin | lzma | \
423 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
424 IMAGE/sysupgrade.bin := append-kernel | pad-to 128k | append-rootfs | pad-rootfs | check-size | append-metadata
425 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
426 endef
427 TARGET_DEVICES += cudy_wr3000-v1
428
429 define Device/glinet_gl-mt2500
430 DEVICE_VENDOR := GL.iNet
431 DEVICE_MODEL := GL-MT2500
432 DEVICE_DTS := mt7981b-glinet-gl-mt2500
433 DEVICE_DTS_DIR := ../dts
434 DEVICE_DTS_LOADADDR := 0x47000000
435 DEVICE_PACKAGES := -kmod-mt7915e -wpad-basic-mbedtls e2fsprogs f2fsck mkf2fs kmod-usb3
436 SUPPORTED_DEVICES += glinet,mt2500-emmc
437 IMAGES := sysupgrade.bin
438 IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
439 endef
440 TARGET_DEVICES += glinet_gl-mt2500
441
442 define Device/glinet_gl-mt3000
443 DEVICE_VENDOR := GL.iNet
444 DEVICE_MODEL := GL-MT3000
445 DEVICE_DTS := mt7981b-glinet-gl-mt3000
446 DEVICE_DTS_DIR := ../dts
447 SUPPORTED_DEVICES += glinet,mt3000-snand
448 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-hwmon-pwmfan kmod-usb3
449 UBINIZE_OPTS := -E 5
450 BLOCKSIZE := 128k
451 PAGESIZE := 2048
452 IMAGE_SIZE := 246272k
453 KERNEL_IN_UBI := 1
454 IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
455 endef
456 TARGET_DEVICES += glinet_gl-mt3000
457
458 define Device/glinet_gl-mt6000
459 DEVICE_VENDOR := GL.iNet
460 DEVICE_MODEL := GL-MT6000
461 DEVICE_DTS := mt7986a-glinet-gl-mt6000
462 DEVICE_DTS_DIR := ../dts
463 DEVICE_PACKAGES := e2fsprogs f2fsck mkf2fs kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware
464 IMAGES += factory.bin
465 IMAGE/factory.bin := append-kernel | pad-to 32M | append-rootfs
466 IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
467 ARTIFACTS := preloader.bin bl31-uboot.fip
468 ARTIFACT/preloader.bin := mt7986-bl2 emmc-ddr4
469 ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot glinet_gl-mt6000
470 endef
471 TARGET_DEVICES += glinet_gl-mt6000
472
473 define Device/h3c_magic-nx30-pro
474 DEVICE_VENDOR := H3C
475 DEVICE_MODEL := Magic NX30 Pro
476 DEVICE_DTS := mt7981b-h3c-magic-nx30-pro
477 DEVICE_DTS_DIR := ../dts
478 UBINIZE_OPTS := -E 5
479 BLOCKSIZE := 128k
480 PAGESIZE := 2048
481 KERNEL_IN_UBI := 1
482 UBOOTENV_IN_UBI := 1
483 IMAGE_SIZE := 65536k
484 IMAGES := sysupgrade.itb
485 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
486 KERNEL := kernel-bin | gzip
487 KERNEL_INITRAMFS := kernel-bin | lzma | \
488 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
489 IMAGE/sysupgrade.itb := append-kernel | \
490 fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
491 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
492 ARTIFACTS := preloader.bin bl31-uboot.fip
493 ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
494 ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot h3c_magic-nx30-pro
495 endef
496 TARGET_DEVICES += h3c_magic-nx30-pro
497
498 define Device/jcg_q30-pro
499 DEVICE_VENDOR := JCG
500 DEVICE_MODEL := Q30 PRO
501 DEVICE_DTS := mt7981b-jcg-q30-pro
502 DEVICE_DTS_DIR := ../dts
503 UBINIZE_OPTS := -E 5
504 BLOCKSIZE := 128k
505 PAGESIZE := 2048
506 KERNEL_IN_UBI := 1
507 UBOOTENV_IN_UBI := 1
508 IMAGES := sysupgrade.itb
509 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
510 KERNEL := kernel-bin | gzip
511 KERNEL_INITRAMFS := kernel-bin | lzma | \
512 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
513 IMAGE/sysupgrade.itb := append-kernel | \
514 fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
515 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
516 ARTIFACTS := preloader.bin bl31-uboot.fip
517 ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
518 ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot jcg_q30-pro
519 endef
520 TARGET_DEVICES += jcg_q30-pro
521
522 define Device/jdcloud_re-cp-03
523 DEVICE_VENDOR := JDCloud
524 DEVICE_MODEL := RE-CP-03
525 DEVICE_DTS := mt7986a-jdcloud-re-cp-03
526 DEVICE_DTS_DIR := ../dts
527 DEVICE_DTC_FLAGS := --pad 4096
528 DEVICE_DTS_LOADADDR := 0x43f00000
529 DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware \
530 e2fsprogs f2fsck mkf2fs
531 KERNEL_LOADADDR := 0x44000000
532 KERNEL := kernel-bin | gzip
533 KERNEL_INITRAMFS := kernel-bin | lzma | \
534 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
535 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
536 IMAGES := sysupgrade.itb
537 IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
538 IMAGE/sysupgrade.itb := append-kernel | \
539 fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | \
540 pad-rootfs | append-metadata
541 ARTIFACTS :=gpt.bin preloader.bin bl31-uboot.fip
542 ARTIFACT/gpt.bin := mt798x-gpt emmc
543 ARTIFACT/preloader.bin := mt7986-bl2 emmc-ddr4
544 ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot jdcloud_re-cp-03
545 endef
546 TARGET_DEVICES += jdcloud_re-cp-03
547
548 define Device/mediatek_mt7981-rfb
549 DEVICE_VENDOR := MediaTek
550 DEVICE_MODEL := MT7981 rfb
551 DEVICE_DTS := mt7981-rfb
552 DEVICE_DTS_OVERLAY:= \
553 mt7981-rfb-spim-nand \
554 mt7981-rfb-mxl-2p5g-phy-eth1 \
555 mt7981-rfb-mxl-2p5g-phy-swp5
556 DEVICE_DTS_DIR := $(DTS_DIR)/
557 DEVICE_DTC_FLAGS := --pad 4096
558 DEVICE_DTS_LOADADDR := 0x43f00000
559 DEVICE_PACKAGES := kmod-mt7981-firmware kmod-usb3 e2fsprogs f2fsck mkf2fs mt7981-wo-firmware
560 KERNEL_LOADADDR := 0x44000000
561 KERNEL := kernel-bin | gzip
562 KERNEL_INITRAMFS := kernel-bin | lzma | \
563 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
564 KERNEL_INITRAMFS_SUFFIX := .itb
565 KERNEL_IN_UBI := 1
566 UBOOTENV_IN_UBI := 1
567 IMAGES := sysupgrade.itb
568 IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
569 IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-with-rootfs | pad-rootfs | append-metadata
570 ARTIFACTS := \
571 emmc-preloader.bin emmc-bl31-uboot.fip \
572 nor-preloader.bin nor-bl31-uboot.fip \
573 sdcard.img.gz \
574 snfi-nand-preloader.bin snfi-nand-bl31-uboot.fip \
575 spim-nand-preloader.bin spim-nand-bl31-uboot.fip
576 ARTIFACT/emmc-preloader.bin := mt7981-bl2 emmc-ddr3
577 ARTIFACT/emmc-bl31-uboot.fip := mt7981-bl31-uboot rfb-emmc
578 ARTIFACT/nor-preloader.bin := mt7981-bl2 nor-ddr3
579 ARTIFACT/nor-bl31-uboot.fip := mt7981-bl31-uboot rfb-emmc
580 ARTIFACT/snfi-nand-preloader.bin := mt7981-bl2 snand-ddr3
581 ARTIFACT/snfi-nand-bl31-uboot.fip := mt7981-bl31-uboot rfb-snfi
582 ARTIFACT/spim-nand-preloader.bin := mt7981-bl2 spim-nand-ddr3
583 ARTIFACT/spim-nand-bl31-uboot.fip := mt7981-bl31-uboot rfb-spim-nand
584 ARTIFACT/sdcard.img.gz := mt798x-gpt sdmmc |\
585 pad-to 17k | mt7981-bl2 sdmmc-ddr3 |\
586 pad-to 6656k | mt7981-bl31-uboot rfb-sd |\
587 $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\
588 pad-to 12M | append-image-stage initramfs.itb | check-size 44m |\
589 ) \
590 pad-to 44M | mt7981-bl2 spim-nand-ddr3 |\
591 pad-to 45M | mt7981-bl31-uboot rfb-spim-nand |\
592 pad-to 49M | mt7981-bl2 nor-ddr3 |\
593 pad-to 50M | mt7981-bl31-uboot rfb-nor |\
594 pad-to 51M | mt7981-bl2 snand-ddr3 |\
595 pad-to 53M | mt7981-bl31-uboot rfb-snfi |\
596 $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
597 pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\
598 ) \
599 gzip
600 endef
601 TARGET_DEVICES += mediatek_mt7981-rfb
602
603 define Device/mediatek_mt7986a-rfb-nand
604 DEVICE_VENDOR := MediaTek
605 DEVICE_MODEL := MT7986 rfba AP (NAND)
606 DEVICE_DTS := mt7986a-rfb-spim-nand
607 DEVICE_DTS_DIR := $(DTS_DIR)/
608 DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
609 SUPPORTED_DEVICES := mediatek,mt7986a-rfb-snand
610 UBINIZE_OPTS := -E 5
611 BLOCKSIZE := 128k
612 PAGESIZE := 2048
613 IMAGE_SIZE := 65536k
614 KERNEL_IN_UBI := 1
615 IMAGES += factory.bin
616 IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
617 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
618 KERNEL = kernel-bin | lzma | \
619 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
620 KERNEL_INITRAMFS = kernel-bin | lzma | \
621 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd
622 endef
623 TARGET_DEVICES += mediatek_mt7986a-rfb-nand
624
625 define Device/mediatek_mt7986b-rfb
626 DEVICE_VENDOR := MediaTek
627 DEVICE_MODEL := MTK7986 rfbb AP
628 DEVICE_DTS := mt7986b-rfb
629 DEVICE_DTS_DIR := $(DTS_DIR)/
630 DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
631 SUPPORTED_DEVICES := mediatek,mt7986b-rfb
632 UBINIZE_OPTS := -E 5
633 BLOCKSIZE := 128k
634 PAGESIZE := 2048
635 IMAGE_SIZE := 65536k
636 KERNEL_IN_UBI := 1
637 IMAGES += factory.bin
638 IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
639 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
640 endef
641 TARGET_DEVICES += mediatek_mt7986b-rfb
642
643 define Device/mediatek_mt7988a-rfb
644 DEVICE_VENDOR := MediaTek
645 DEVICE_MODEL := MT7988A rfb
646 DEVICE_DTS := mt7988a-rfb
647 DEVICE_DTS_OVERLAY:= \
648 mt7988a-rfb-emmc \
649 mt7988a-rfb-sd \
650 mt7988a-rfb-snfi-nand \
651 mt7988a-rfb-spim-nand \
652 mt7988a-rfb-spim-nor \
653 mt7988a-rfb-eth1-aqr \
654 mt7988a-rfb-eth1-i2p5g-phy \
655 mt7988a-rfb-eth1-mxl \
656 mt7988a-rfb-eth1-sfp \
657 mt7988a-rfb-eth2-aqr \
658 mt7988a-rfb-eth2-mxl \
659 mt7988a-rfb-eth2-sfp
660 DEVICE_DTS_DIR := $(DTS_DIR)/
661 DEVICE_DTC_FLAGS := --pad 4096
662 DEVICE_DTS_LOADADDR := 0x45f00000
663 DEVICE_PACKAGES := kmod-sfp
664 KERNEL_LOADADDR := 0x46000000
665 KERNEL := kernel-bin | gzip
666 KERNEL_INITRAMFS := kernel-bin | lzma | \
667 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
668 KERNEL_INITRAMFS_SUFFIX := .itb
669 KERNEL_IN_UBI := 1
670 IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
671 IMAGES := sysupgrade.itb
672 IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-with-rootfs | pad-rootfs | append-metadata
673 ARTIFACTS := \
674 emmc-gpt.bin emmc-preloader.bin emmc-bl31-uboot.fip \
675 nor-preloader.bin nor-bl31-uboot.fip \
676 sdcard.img.gz \
677 snand-preloader.bin snand-bl31-uboot.fip
678 ARTIFACT/emmc-gpt.bin := mt798x-gpt emmc
679 ARTIFACT/emmc-preloader.bin := mt7988-bl2 emmc-comb
680 ARTIFACT/emmc-bl31-uboot.fip := mt7988-bl31-uboot rfb-emmc
681 ARTIFACT/nor-preloader.bin := mt7988-bl2 nor-comb
682 ARTIFACT/nor-bl31-uboot.fip := mt7988-bl31-uboot rfb-nor
683 ARTIFACT/snand-preloader.bin := mt7988-bl2 spim-nand-comb
684 ARTIFACT/snand-bl31-uboot.fip := mt7988-bl31-uboot rfb-snand
685 ARTIFACT/sdcard.img.gz := mt798x-gpt sdmmc |\
686 pad-to 17k | mt7988-bl2 sdmmc-comb |\
687 pad-to 6656k | mt7988-bl31-uboot rfb-sd |\
688 $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\
689 pad-to 12M | append-image-stage initramfs.itb | check-size 44m |\
690 ) \
691 pad-to 44M | mt7988-bl2 spim-nand-comb |\
692 pad-to 45M | mt7988-bl31-uboot rfb-snand |\
693 pad-to 51M | mt7988-bl2 nor-comb |\
694 pad-to 51M | mt7988-bl31-uboot rfb-nor |\
695 pad-to 55M | mt7988-bl2 emmc-comb |\
696 pad-to 56M | mt7988-bl31-uboot rfb-emmc |\
697 pad-to 62M | mt798x-gpt emmc |\
698 $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
699 pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\
700 ) \
701 gzip
702 endef
703 TARGET_DEVICES += mediatek_mt7988a-rfb
704
705 define Device/mercusys_mr90x-v1
706 DEVICE_VENDOR := MERCUSYS
707 DEVICE_MODEL := MR90X v1
708 DEVICE_DTS := mt7986b-mercusys-mr90x-v1
709 DEVICE_DTS_DIR := ../dts
710 DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
711 UBINIZE_OPTS := -E 5
712 BLOCKSIZE := 128k
713 PAGESIZE := 2048
714 IMAGE_SIZE := 51200k
715 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
716 endef
717 TARGET_DEVICES += mercusys_mr90x-v1
718
719 define Device/netgear_wax220
720 DEVICE_VENDOR := NETGEAR
721 DEVICE_MODEL := WAX220
722 DEVICE_DTS := mt7986b-netgear-wax220
723 DEVICE_DTS_DIR := ../dts
724 NETGEAR_ENC_MODEL := WAX220
725 NETGEAR_ENC_REGION := US
726 DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
727 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
728 IMAGE_SIZE := 32768k
729 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
730 IMAGES += factory.img
731 # Padding to 10M seems to be required by OEM web interface
732 IMAGE/factory.img := sysupgrade-tar | \
733 pad-to 10M | check-size | netgear-encrypted-factory
734 endef
735 TARGET_DEVICES += netgear_wax220
736
737 define Device/qihoo_360t7
738 DEVICE_VENDOR := Qihoo
739 DEVICE_MODEL := 360T7
740 DEVICE_DTS := mt7981b-qihoo-360t7
741 DEVICE_DTS_DIR := ../dts
742 UBINIZE_OPTS := -E 5
743 BLOCKSIZE := 128k
744 PAGESIZE := 2048
745 KERNEL_IN_UBI := 1
746 UBOOTENV_IN_UBI := 1
747 IMAGES := sysupgrade.itb
748 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
749 KERNEL := kernel-bin | gzip
750 KERNEL_INITRAMFS := kernel-bin | lzma | \
751 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
752 IMAGE/sysupgrade.itb := append-kernel | \
753 fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
754 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
755 ARTIFACTS := preloader.bin bl31-uboot.fip
756 ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
757 ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot qihoo_360t7
758 endef
759 TARGET_DEVICES += qihoo_360t7
760
761 define Device/routerich_ax3000
762 DEVICE_VENDOR := Routerich
763 DEVICE_MODEL := AX3000
764 DEVICE_DTS := mt7981b-routerich-ax3000
765 DEVICE_DTS_DIR := ../dts
766 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3
767 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
768 SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb
769 endef
770 TARGET_DEVICES += routerich_ax3000
771
772 define Device/tplink_tl-xdr-common
773 DEVICE_VENDOR := TP-Link
774 DEVICE_DTS_DIR := ../dts
775 UBINIZE_OPTS := -E 5
776 BLOCKSIZE := 128k
777 PAGESIZE := 2048
778 KERNEL_IN_UBI := 1
779 UBOOTENV_IN_UBI := 1
780 IMAGES := sysupgrade.itb
781 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
782 KERNEL := kernel-bin | gzip
783 KERNEL_INITRAMFS := kernel-bin | lzma | \
784 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
785 IMAGE/sysupgrade.itb := append-kernel | \
786 fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-with-rootfs | append-metadata
787 DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware
788 ARTIFACTS := preloader.bin bl31-uboot.fip
789 ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ddr3
790 endef
791
792 define Device/tplink_tl-xdr4288
793 DEVICE_MODEL := TL-XDR4288
794 DEVICE_DTS := mt7986a-tplink-tl-xdr4288
795 ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot tplink_tl-xdr4288
796 $(call Device/tplink_tl-xdr-common)
797 endef
798 TARGET_DEVICES += tplink_tl-xdr4288
799
800 define Device/tplink_tl-xdr6086
801 DEVICE_MODEL := TL-XDR6086
802 DEVICE_DTS := mt7986a-tplink-tl-xdr6086
803 ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot tplink_tl-xdr6086
804 $(call Device/tplink_tl-xdr-common)
805 endef
806 TARGET_DEVICES += tplink_tl-xdr6086
807
808 define Device/tplink_tl-xdr6088
809 DEVICE_MODEL := TL-XDR6088
810 DEVICE_DTS := mt7986a-tplink-tl-xdr6088
811 ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot tplink_tl-xdr6088
812 $(call Device/tplink_tl-xdr-common)
813 endef
814 TARGET_DEVICES += tplink_tl-xdr6088
815
816 define Device/ubnt_unifi-6-plus
817 DEVICE_VENDOR := Ubiquiti
818 DEVICE_MODEL := UniFi 6 Plus
819 DEVICE_DTS := mt7981a-ubnt-unifi-6-plus
820 DEVICE_DTS_DIR := ../dts
821 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware e2fsprogs f2fsck mkf2fs fdisk partx-utils
822 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
823 endef
824 TARGET_DEVICES += ubnt_unifi-6-plus
825
826 define Device/xiaomi_mi-router-ax3000t
827 DEVICE_VENDOR := Xiaomi
828 DEVICE_MODEL := Mi Router AX3000T
829 DEVICE_DTS := mt7981b-xiaomi-mi-router-ax3000t
830 DEVICE_DTS_DIR := ../dts
831 UBINIZE_OPTS := -E 5
832 BLOCKSIZE := 128k
833 PAGESIZE := 2048
834 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
835 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
836 ARTIFACTS := initramfs-factory.ubi
837 ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel
838 endif
839 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
840 endef
841 TARGET_DEVICES += xiaomi_mi-router-ax3000t
842
843 define Device/xiaomi_mi-router-ax3000t-ubootmod
844 DEVICE_VENDOR := Xiaomi
845 DEVICE_MODEL := Mi Router AX3000T (OpenWrt U-Boot layout)
846 DEVICE_DTS := mt7981b-xiaomi-mi-router-ax3000t-ubootmod
847 DEVICE_DTS_DIR := ../dts
848 UBINIZE_OPTS := -E 5
849 BLOCKSIZE := 128k
850 PAGESIZE := 2048
851 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
852 KERNEL_IN_UBI := 1
853 UBOOTENV_IN_UBI := 1
854 IMAGES := sysupgrade.itb
855 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
856 KERNEL := kernel-bin | gzip
857 KERNEL_INITRAMFS := kernel-bin | lzma | \
858 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
859 IMAGE/sysupgrade.itb := append-kernel | \
860 fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
861 ARTIFACTS := preloader.bin bl31-uboot.fip
862 ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
863 ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot xiaomi_mi-router-ax3000t
864 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
865 ARTIFACTS += initramfs-factory.ubi
866 ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
867 endif
868 endef
869 TARGET_DEVICES += xiaomi_mi-router-ax3000t-ubootmod
870
871 define Device/xiaomi_mi-router-wr30u-stock
872 DEVICE_VENDOR := Xiaomi
873 DEVICE_MODEL := Mi Router WR30U (stock layout)
874 DEVICE_DTS := mt7981b-xiaomi-mi-router-wr30u-stock
875 DEVICE_DTS_DIR := ../dts
876 UBINIZE_OPTS := -E 5
877 BLOCKSIZE := 128k
878 PAGESIZE := 2048
879 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
880 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
881 ARTIFACTS := initramfs-factory.ubi
882 ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel
883 endif
884 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
885 endef
886 TARGET_DEVICES += xiaomi_mi-router-wr30u-stock
887
888 define Device/xiaomi_mi-router-wr30u-ubootmod
889 DEVICE_VENDOR := Xiaomi
890 DEVICE_MODEL := Mi Router WR30U (OpenWrt U-Boot layout)
891 DEVICE_DTS := mt7981b-xiaomi-mi-router-wr30u-ubootmod
892 DEVICE_DTS_DIR := ../dts
893 UBINIZE_OPTS := -E 5
894 BLOCKSIZE := 128k
895 PAGESIZE := 2048
896 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
897 KERNEL_IN_UBI := 1
898 UBOOTENV_IN_UBI := 1
899 IMAGES := sysupgrade.itb
900 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
901 KERNEL := kernel-bin | gzip
902 KERNEL_INITRAMFS := kernel-bin | lzma | \
903 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
904 IMAGE/sysupgrade.itb := append-kernel | \
905 fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
906 ARTIFACTS := preloader.bin bl31-uboot.fip
907 ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
908 ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot xiaomi_mi-router-wr30u
909 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
910 ARTIFACTS += initramfs-factory.ubi
911 ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
912 endif
913 endef
914 TARGET_DEVICES += xiaomi_mi-router-wr30u-ubootmod
915
916 define Device/xiaomi_redmi-router-ax6000-stock
917 DEVICE_VENDOR := Xiaomi
918 DEVICE_MODEL := Redmi Router AX6000 (stock layout)
919 DEVICE_DTS := mt7986a-xiaomi-redmi-router-ax6000-stock
920 DEVICE_DTS_DIR := ../dts
921 DEVICE_PACKAGES := kmod-leds-ws2812b kmod-mt7986-firmware mt7986-wo-firmware
922 UBINIZE_OPTS := -E 5
923 BLOCKSIZE := 128k
924 PAGESIZE := 2048
925 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
926 ARTIFACTS := initramfs-factory.ubi
927 ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel
928 endif
929 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
930 endef
931 TARGET_DEVICES += xiaomi_redmi-router-ax6000-stock
932
933 define Device/xiaomi_redmi-router-ax6000-ubootmod
934 DEVICE_VENDOR := Xiaomi
935 DEVICE_MODEL := Redmi Router AX6000 (OpenWrt U-Boot layout)
936 DEVICE_DTS := mt7986a-xiaomi-redmi-router-ax6000-ubootmod
937 DEVICE_DTS_DIR := ../dts
938 DEVICE_PACKAGES := kmod-leds-ws2812b kmod-mt7986-firmware mt7986-wo-firmware
939 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
940 IMAGES := sysupgrade.itb
941 UBINIZE_OPTS := -E 5
942 BLOCKSIZE := 128k
943 PAGESIZE := 2048
944 KERNEL_IN_UBI := 1
945 UBOOTENV_IN_UBI := 1
946 KERNEL := kernel-bin | gzip
947 KERNEL_INITRAMFS := kernel-bin | lzma | \
948 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
949 IMAGE/sysupgrade.itb := append-kernel | \
950 fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
951 ARTIFACTS := preloader.bin bl31-uboot.fip
952 ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ddr4
953 ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot xiaomi_redmi-router-ax6000
954 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
955 ARTIFACTS += initramfs-factory.ubi
956 ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
957 endif
958 endef
959 TARGET_DEVICES += xiaomi_redmi-router-ax6000-ubootmod
960
961 define Device/yuncore_ax835
962 DEVICE_VENDOR := YunCore
963 DEVICE_MODEL := AX835
964 DEVICE_DTS := mt7981b-yuncore-ax835
965 DEVICE_DTS_DIR := ../dts
966 DEVICE_DTS_LOADADDR := 0x47000000
967 IMAGES := sysupgrade.bin
968 IMAGE_SIZE := 14336k
969 SUPPORTED_DEVICES += mediatek,mt7981-spim-nor-rfb
970 KERNEL := kernel-bin | lzma | \
971 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
972 KERNEL_INITRAMFS := kernel-bin | lzma | \
973 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
974 IMAGE/sysupgrade.bin := append-kernel | pad-to 128k | append-rootfs | pad-rootfs | check-size | append-metadata
975 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
976 endef
977 TARGET_DEVICES += yuncore_ax835
978
979
980 define Device/zbtlink_zbt-z8102ax
981 DEVICE_VENDOR := Zbtlink
982 DEVICE_MODEL := ZBT-Z8102AX
983 DEVICE_DTS := mt7981b-zbtlink-zbt-z8102ax
984 DEVICE_DTS_DIR := ../dts
985 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 kmod-usb-net-qmi-wwan kmod-usb-serial-option
986 KERNEL_IN_UBI := 1
987 UBINIZE_OPTS := -E 5
988 BLOCKSIZE := 128k
989 PAGESIZE := 2048
990 IMAGE_SIZE := 65536k
991 IMAGES += factory.bin
992 IMAGE/factory.bin := append-ubi | check-size $$(IMAGE_SIZE)
993 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
994 endef
995 TARGET_DEVICES += zbtlink_zbt-z8102ax
996
997 define Device/zbtlink_zbt-z8103ax
998 DEVICE_VENDOR := Zbtlink
999 DEVICE_MODEL := ZBT-Z8103AX
1000 DEVICE_DTS := mt7981b-zbtlink-zbt-z8103ax
1001 DEVICE_DTS_DIR := ../dts
1002 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
1003 KERNEL_IN_UBI := 1
1004 UBINIZE_OPTS := -E 5
1005 BLOCKSIZE := 128k
1006 PAGESIZE := 2048
1007 IMAGE_SIZE := 65536k
1008 IMAGES += factory.bin
1009 IMAGE/factory.bin := append-ubi | check-size $$(IMAGE_SIZE)
1010 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
1011 endef
1012 TARGET_DEVICES += zbtlink_zbt-z8103ax
1013
1014 define Device/zyxel_ex5601-t0-stock
1015 DEVICE_VENDOR := Zyxel
1016 DEVICE_MODEL := EX5601-T0
1017 DEVICE_VARIANT := (stock layout)
1018 DEVICE_DTS := mt7986a-zyxel-ex5601-t0-stock
1019 DEVICE_DTS_DIR := ../dts
1020 DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware kmod-usb3
1021 SUPPORTED_DEVICES := mediatek,mt7986a-rfb-snand
1022 UBINIZE_OPTS := -E 5
1023 BLOCKSIZE := 256k
1024 PAGESIZE := 4096
1025 IMAGE_SIZE := 65536k
1026 KERNEL_IN_UBI := 1
1027 IMAGES += factory.bin
1028 IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
1029 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
1030 KERNEL = kernel-bin | lzma | \
1031 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
1032 KERNEL_INITRAMFS = kernel-bin | lzma | \
1033 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd
1034 endef
1035 TARGET_DEVICES += zyxel_ex5601-t0-stock
1036
1037 define Device/zyxel_ex5601-t0-ubootmod
1038 DEVICE_VENDOR := Zyxel
1039 DEVICE_MODEL := EX5601-T0
1040 DEVICE_VARIANT := (OpenWrt U-Boot layout)
1041 DEVICE_DTS := mt7986a-zyxel-ex5601-t0-ubootmod
1042 DEVICE_DTS_DIR := ../dts
1043 DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware kmod-usb3
1044 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
1045 IMAGES := sysupgrade.itb
1046 UBINIZE_OPTS := -E 5
1047 BLOCKSIZE := 256k
1048 PAGESIZE := 4096
1049 KERNEL_IN_UBI := 1
1050 UBOOTENV_IN_UBI := 1
1051 KERNEL := kernel-bin | lzma
1052 KERNEL_INITRAMFS := kernel-bin | lzma | \
1053 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd
1054 IMAGE/sysupgrade.itb := append-kernel | \
1055 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
1056 ARTIFACTS := preloader.bin bl31-uboot.fip
1057 ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-4k-ddr4
1058 ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot zyxel_ex5601-t0
1059 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
1060 ARTIFACTS += initramfs-factory.ubi
1061 ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
1062 endif
1063 endef
1064 TARGET_DEVICES += zyxel_ex5601-t0-ubootmod
1065
1066 define Device/zyxel_ex5700-telenor
1067 DEVICE_VENDOR := ZyXEL
1068 DEVICE_MODEL := EX5700 (Telenor)
1069 DEVICE_DTS := mt7986a-zyxel-ex5700-telenor
1070 DEVICE_DTS_DIR := ../dts
1071 DEVICE_PACKAGES := kmod-mt7916-firmware kmod-ubootenv-nvram kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware
1072 UBINIZE_OPTS := -E 5
1073 BLOCKSIZE := 128k
1074 PAGESIZE := 2048
1075 IMAGE_SIZE := 65536k
1076 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
1077 endef
1078 TARGET_DEVICES += zyxel_ex5700-telenor
1079
1080 define Device/zyxel_nwa50ax-pro
1081 DEVICE_VENDOR := ZyXEL
1082 DEVICE_MODEL := NWA50AX Pro
1083 DEVICE_DTS := mt7981b-zyxel-nwa50ax-pro
1084 DEVICE_DTS_DIR := ../dts
1085 DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware zyxel-bootconfig
1086 DEVICE_DTS_LOADADDR := 0x44000000
1087 UBINIZE_OPTS := -E 5
1088 BLOCKSIZE := 128k
1089 PAGESIZE := 2048
1090 IMAGE_SIZE := 51200k
1091 KERNEL_IN_UBI := 1
1092 IMAGES += factory.bin
1093 IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) | zyxel-nwa-fit-filogic
1094 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
1095 endef
1096 TARGET_DEVICES += zyxel_nwa50ax-pro