]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
ipq60xx: linksys: add partition selection 22594/head
authorRosen Penev <rosenp@gmail.com>
Tue, 24 Mar 2026 20:02:52 +0000 (13:02 -0700)
committerRobert Marko <robimarko@gmail.com>
Wed, 1 Apr 2026 12:20:20 +0000 (14:20 +0200)
Instead of upgrading both kernels, allow support for selecting the
partition during sysupgrade.

Copy/Paste of Linux MX devices on the same target.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22594
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh

index 66e88f61b461c9dc3fbec4e24ee42c38649e2f9c..f8b2771481e760b208799899a7405b8cb1b17c49 100644 (file)
@@ -116,6 +116,44 @@ tplink_do_upgrade() {
        nand_do_upgrade "$1"
 }
 
+linksys_mr_pre_upgrade() {
+       local setenv_script="/tmp/fw_env_upgrade"
+
+       CI_UBIPART="rootfs"
+       boot_part="$(fw_printenv -n boot_part)"
+       if [ -n "$UPGRADE_OPT_USE_CURR_PART" ]; then
+               if [ "$boot_part" -eq "2" ]; then
+                       CI_KERNPART="alt_kernel"
+                       CI_UBIPART="alt_rootfs"
+               fi
+       else
+               if [ "$boot_part" -eq "1" ]; then
+                       echo "boot_part 2" >> $setenv_script
+                       CI_KERNPART="alt_kernel"
+                       CI_UBIPART="alt_rootfs"
+               else
+                       echo "boot_part 1" >> $setenv_script
+               fi
+       fi
+
+       boot_part_ready="$(fw_printenv -n boot_part_ready)"
+       if [ "$boot_part_ready" -ne "3" ]; then
+               echo "boot_part_ready 3" >> $setenv_script
+       fi
+
+       auto_recovery="$(fw_printenv -n auto_recovery)"
+       if [ "$auto_recovery" != "yes" ]; then
+               echo "auto_recovery yes" >> $setenv_script
+       fi
+
+       if [ -f "$setenv_script" ]; then
+               fw_setenv -s $setenv_script || {
+                       echo "failed to update U-Boot environment"
+                       return 1
+               }
+       fi
+}
+
 platform_check_image() {
        return 0;
 }
@@ -192,17 +230,8 @@ platform_do_upgrade() {
                ;;
        linksys,mr7350|\
        linksys,mr7500)
-               boot_part="$(fw_printenv -n boot_part)"
-               if [ "$boot_part" -eq "1" ]; then
-                       fw_setenv boot_part 2
-                       CI_KERNPART="alt_kernel"
-                       CI_UBIPART="alt_rootfs"
-               else
-                       fw_setenv boot_part 1
-                       CI_UBIPART="rootfs"
-               fi
-               fw_setenv boot_part_ready 3
-               fw_setenv auto_recovery yes
+               linksys_mr_pre_upgrade "$1"
+               remove_oem_ubi_volume squashfs
                nand_do_upgrade "$1"
                ;;
        tplink,eap610-outdoor|\