summaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/mt7622/base-files
diff options
context:
space:
mode:
authorChuanhong Guo <gch981213@gmail.com>2024-03-02 21:12:54 +0800
committerChuanhong Guo <gch981213@gmail.com>2024-03-21 16:55:13 +0800
commita6991fc7d251f7ab65a588546e22abfd4f8ce472 (patch)
tree96ecdb4163486c172994ee05888a3433efa8c89a /target/linux/mediatek/mt7622/base-files
parentec8c3dc701cfd53e1ddc9817041e710fb4bbb0f3 (diff)
downloadopenwrt-a6991fc7d251f7ab65a588546e22abfd4f8ce472.tar.gz
openwrt-a6991fc7d251f7ab65a588546e22abfd4f8ce472.tar.bz2
openwrt-a6991fc7d251f7ab65a588546e22abfd4f8ce472.zip
mediatek: mt7622: add a second u-boot for redmi-ax6s
The vendor u-boot knows nothing about UBI, and we used to have a fixed-size kernel partition for vendor u-boot and UBI for rootfs. However, that fixed partition becomes too small eventually, and expanding it requires complicated procedure. This commit changed the flash layout and added a second u-boot where the kernel supposed to be. Now the vendor u-boot chainloads our mainline u-boot, and our u-boot reads kernel+rootfs from UBI, verifies it, and boot into OpenWrt. There are two possible ways to convert from the old fw: Flash the factory image using mtd (provided by @rany2): mount -o remount,ro / mount -o remount,ro /overlay cd /tmp dd if=factory.bin bs=1M count=4 | mtd write - kernel dd if=factory.bin bs=1M skip=4 | mtd -r write - ubi Or, flash the 2nd u-boot via mtd and upload the firmware to the 2nd u-boot using tftp: 1. prepare a tftp server at 192.168.1.254 to serve the sysupgrade image: openwrt-mediatek-mt7622-xiaomi_redmi-router-ax6s-squashfs-sysupgrade.itb 2. upload the ubi-loader.itb to OpenWrt /tmp, and flash it to the old kernel partition: mtd -r write openwrt-mediatek-mt7622-xiaomi_redmi-router-ax6s-ubi-loader.itb 3. The router should reboot and flash the sysupgrade image via TFTP. Procedure for flashing from vendor firmware shouldn't change. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Diffstat (limited to 'target/linux/mediatek/mt7622/base-files')
-rw-r--r--target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version3
-rwxr-xr-xtarget/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh9
2 files changed, 6 insertions, 6 deletions
diff --git a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version
index 6309728e4b..dd224f3d8c 100644
--- a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version
+++ b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/05_fix-compat-version
@@ -9,7 +9,8 @@ case "$(board_name)" in
uci set system.@system[0].compat_version="1.1"
uci commit system
;;
- linksys,e8450-ubi)
+ linksys,e8450-ubi|\
+ xiaomi,redmi-router-ax6s)
uci set system.@system[0].compat_version="2.0"
uci commit system
;;
diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
index 236e8fdfb0..59375ccd9b 100755
--- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
@@ -10,7 +10,8 @@ platform_do_upgrade() {
linksys,e8450-ubi|\
ubnt,unifi-6-lr-v1-ubootmod|\
ubnt,unifi-6-lr-v2-ubootmod|\
- ubnt,unifi-6-lr-v3-ubootmod)
+ ubnt,unifi-6-lr-v3-ubootmod|\
+ xiaomi,redmi-router-ax6s)
[ -e /dev/fit0 ] && fitblk /dev/fit0
[ -e /dev/fitrw ] && fitblk /dev/fitrw
bootdev="$(fitblk_get_bootdev)"
@@ -48,8 +49,7 @@ platform_do_upgrade() {
elecom,wrc-x3200gst3|\
mediatek,mt7622-rfb1-ubi|\
netgear,wax206|\
- totolink,a8000ru|\
- xiaomi,redmi-router-ax6s)
+ totolink,a8000ru)
nand_do_upgrade "$1"
;;
linksys,e8450)
@@ -84,8 +84,7 @@ platform_check_image() {
elecom,wrc-x3200gst3|\
mediatek,mt7622-rfb1-ubi|\
netgear,wax206|\
- totolink,a8000ru|\
- xiaomi,redmi-router-ax6s)
+ totolink,a8000ru)
nand_do_platform_check "$board" "$1"
return $?
;;