blob: 7f2335ff56cc6614dc04a212a72b6b3abb778249 [file] [log] [blame]
developerfd40db22021-04-29 10:08:25 +08001--- a/target/linux/mediatek/image/mt7622.mk
2+++ b/target/linux/mediatek/image/mt7622.mk
3@@ -46,15 +46,15 @@ define Device/mediatek_mt7622-ubi
4 DEVICE_MODEL := MTK7622 AP (UBI)
5 DEVICE_DTS := mt7622-rfb1-ubi
6 DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
7+ SUPPORTED_DEVICES := mediatek,mt7622,ubi
8 UBINIZE_OPTS := -E 5
9 BLOCKSIZE := 128k
10 PAGESIZE := 2048
11- KERNEL_SIZE := 4194304
12- IMAGE_SIZE := 32768k
13+ IMAGE_SIZE := 36864k
14+ KERNEL_IN_UBI := 1
15 IMAGES += factory.bin
16- IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
17- check-size $$$$(IMAGE_SIZE)
18- IMAGE/sysupgrade.bin := sysupgrade-tar
19+ IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
20+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
21 DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk
22 endef
23 TARGET_DEVICES += mediatek_mt7622-ubi
24--- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
25+++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
26@@ -25,6 +25,17 @@ platform_check_image() {
27 [ "$#" -gt 1 ] && return 1
28
29 case "$board" in
30+ mediatek,mt7622,ubi)
31+ # tar magic `ustar`
32+ magic="$(dd if="$1" bs=1 skip=257 count=5 2>/dev/null)"
33+
34+ [ "$magic" != "ustar" ] && {
35+ echo "Invalid image type."
36+ return 1
37+ }
38+
39+ return 0
40+ ;;
41 *)
42 [ "$magic" != "d00dfeed" ] && {
43 echo "Invalid image type."