[openwrt/openwrt] qualcommax: ipq807x: Update u-boot env only when changes for Linksys MX devices

LEDE Commits lede-commits at lists.infradead.org
Wed Jan 29 07:53:27 PST 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/2fc99e4f1832b32a68c881fd5e9594b081e1559b

commit 2fc99e4f1832b32a68c881fd5e9594b081e1559b
Author: Paweł Owoc <frut3k7 at gmail.com>
AuthorDate: Thu Dec 12 19:51:27 2024 +0100

    qualcommax: ipq807x: Update u-boot env only when changes for Linksys MX devices
    
    Update u-boot env variables only when changes are made.
    Applies to Linksys MX4200/MX4300/MX5300/MX8500.
    
    Signed-off-by: Paweł Owoc <frut3k7 at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/14720
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 .../ipq807x/base-files/lib/upgrade/platform.sh     | 25 ++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

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 3bfeb1366b..1bc71efdb5 100644
--- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh
@@ -109,6 +109,8 @@ tplink_do_upgrade() {
 }
 
 linksys_mx_do_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
@@ -118,15 +120,30 @@ linksys_mx_do_upgrade() {
 		fi
 	else
 		if [ "$boot_part" -eq "1" ]; then
-			fw_setenv boot_part 2
+			echo "boot_part 2" >> $setenv_script
 			CI_KERNPART="alt_kernel"
 			CI_UBIPART="alt_rootfs"
 		else
-			fw_setenv boot_part 1
+			echo "boot_part 1" >> $setenv_script
 		fi
 	fi
-	fw_setenv boot_part_ready 3
-	fw_setenv auto_recovery yes
+
+	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
 	nand_do_upgrade "$1"
 }
 




More information about the lede-commits mailing list