qualcommax: ipq807x: fix sysupgrade for ZBT-Z800AX

This router has two rootfs partitions and dualboot is used.
Vendor firmware may swap the rootfs partition location, u-boot append
'ubi.mtd=rootfs' in the end of cmdline. Since we use fixed-partitions,
force boot from the first rootfs partition to avoid boot failure.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Link: https://github.com/openwrt/openwrt/pull/15700
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Chukun Pan 2024-06-10 23:18:19 +08:00 committed by Robert Marko
parent ce51f27fb0
commit 0a76244a72
2 changed files with 13 additions and 4 deletions

View File

@ -154,13 +154,11 @@
partition@60000 {
label = "0:bootconfig";
reg = <0x60000 0x20000>;
read-only;
};
partition@80000 {
label = "0:bootconfig1";
reg = <0x80000 0x20000>;
read-only;
};
partition@a0000 {

View File

@ -53,8 +53,7 @@ platform_do_upgrade() {
netgear,sxs80|\
netgear,wax218|\
netgear,wax620|\
netgear,wax630|\
zbtlink,zbt-z800ax)
netgear,wax630)
nand_do_upgrade "$1"
;;
buffalo,wxr-5950ax12)
@ -132,6 +131,18 @@ platform_do_upgrade() {
fw_setenv upgrade_available 1
nand_do_upgrade "$1"
;;
zbtlink,zbt-z800ax)
local mtdnum="$(find_mtd_index 0:bootconfig)"
local alt_mtdnum="$(find_mtd_index 0:bootconfig1)"
part_num="$(hexdump -e '1/1 "%01x|"' -n 1 -s 168 -C /dev/mtd$mtdnum | cut -f 1 -d "|" | head -n1)"
# vendor firmware may swap the rootfs partition location, u-boot append: ubi.mtd=rootfs
# since we use fixed-partitions, need to force boot from the first rootfs partition
if [ "$part_num" -eq "1" ]; then
mtd erase /dev/mtd$mtdnum
mtd erase /dev/mtd$alt_mtdnum
fi
nand_do_upgrade "$1"
;;
zte,mf269)
CI_KERN_UBIPART="ubi_kernel"
CI_ROOT_UBIPART="rootfs"