[openwrt/openwrt] qualcommax: ipq807x: fix sysupgrade for ZBT-Z800AX

LEDE Commits lede-commits at lists.infradead.org
Thu Jun 13 09:01:07 PDT 2024


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/0a76244a72157ff06d2c7d309b477522d4975a95

commit 0a76244a72157ff06d2c7d309b477522d4975a95
Author: Chukun Pan <amadeus at jmu.edu.cn>
AuthorDate: Mon Jun 10 23:18:19 2024 +0800

    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 at jmu.edu.cn>
    Link: https://github.com/openwrt/openwrt/pull/15700
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 .../files/arch/arm64/boot/dts/qcom/ipq8072-zbt-z800ax.dts |  2 --
 .../qualcommax/ipq807x/base-files/lib/upgrade/platform.sh | 15 +++++++++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-zbt-z800ax.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-zbt-z800ax.dts
index c352b72567..814a7cb2bd 100644
--- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-zbt-z800ax.dts
+++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-zbt-z800ax.dts
@@ -154,13 +154,11 @@
 			partition at 60000 {
 				label = "0:bootconfig";
 				reg = <0x60000 0x20000>;
-				read-only;
 			};
 
 			partition at 80000 {
 				label = "0:bootconfig1";
 				reg = <0x80000 0x20000>;
-				read-only;
 			};
 
 			partition at a0000 {
diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh
index 2008334213..5d89554133 100644
--- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh
@@ -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"




More information about the lede-commits mailing list