From 1d4cbc46d10ee20e4eaedabbbc282930a4500079 Mon Sep 17 00:00:00 2001 From: Tanya Singh Date: Wed, 21 Jan 2026 17:02:27 +0800 Subject: [PATCH] ipq807x_v5.4, qca-wifi-7: enable/disable boot bank switch based on upgrade_available value during fw upgrade for Edgecore APs Fixes: WIFI-15304 Signed-off-by: Tanya Singh --- .../ipq50xx/base-files/etc/init.d/bootcount | 3 +- .../base-files/lib/upgrade/platform.sh | 44 ++++++++++++++++--- .../base-files/lib/upgrade/platform.sh | 29 +++++++++--- .../ipq807x/base-files/etc/init.d/bootcount | 2 +- .../base-files/lib/upgrade/platform.sh | 25 ++++++++--- .../base-files/lib/upgrade/platform.sh | 32 ++++++++++---- 6 files changed, 109 insertions(+), 26 deletions(-) diff --git a/feeds/ipq807x_v5.4/ipq50xx/base-files/etc/init.d/bootcount b/feeds/ipq807x_v5.4/ipq50xx/base-files/etc/init.d/bootcount index 2232c038b..24c4b5a0a 100755 --- a/feeds/ipq807x_v5.4/ipq50xx/base-files/etc/init.d/bootcount +++ b/feeds/ipq807x_v5.4/ipq50xx/base-files/etc/init.d/bootcount @@ -6,8 +6,9 @@ boot() { case "$(board_name)" in hfcl,ion4xi_w) fw_setenv boot_count 0 - ;; + ;; edgecore,oap101|\ + edgecore,oap101e|\ edgecore,eap104) avail=$(fw_printenv -n upgrade_available) [ "${avail}" -eq 0 ] && fw_setenv upgrade_available 1 diff --git a/feeds/ipq807x_v5.4/ipq50xx/base-files/lib/upgrade/platform.sh b/feeds/ipq807x_v5.4/ipq50xx/base-files/lib/upgrade/platform.sh index ca37ad2cc..176ed217b 100755 --- a/feeds/ipq807x_v5.4/ipq50xx/base-files/lib/upgrade/platform.sh +++ b/feeds/ipq807x_v5.4/ipq50xx/base-files/lib/upgrade/platform.sh @@ -114,12 +114,7 @@ platform_do_upgrade() { indio,um-325ax-v2|\ indio,um-335ax|\ indio,um-525axp|\ - indio,um-525axm|\ - edgecore,oap101|\ - edgecore,oap101-6e|\ - edgecore,oap101e|\ - edgecore,oap101e-6e|\ - edgecore,eap104) + indio,um-525axm) if [ "$(find_mtd_chardev rootfs)" ]; then CI_UBIPART="rootfs" else @@ -133,6 +128,43 @@ platform_do_upgrade() { fi nand_upgrade_tar "$1" ;; + edgecore,oap101|\ + edgecore,oap101-6e|\ + edgecore,oap101e|\ + edgecore,oap101e-6e|\ + edgecore,eap104) + if [ "$(find_mtd_chardev rootfs)" ]; then + CI_UBIPART="rootfs" + else + if [ -e /tmp/downgrade ]; then + CI_UBIPART="rootfs1" + { echo 'active 1'; echo 'upgrade_available 0'; } > /tmp/fw_setenv.txt || exit 1 + CI_FWSETENV="-s /tmp/fw_setenv.txt" + else + local CI_UBIPART_B="" + if grep -q rootfs1 /proc/cmdline; then + CI_UBIPART="rootfs2" + CI_UBIPART_B="rootfs1" + CI_FWSETENV="active 2" + elif grep -q rootfs2 /proc/cmdline; then + CI_UBIPART="rootfs1" + CI_UBIPART_B="rootfs2" + CI_FWSETENV="active 1" + else + CI_UBIPART="rootfs1" + CI_UBIPART_B="" + CI_FWSETENV="active 1" + fi + if [ "$(fw_printenv -n upgrade_available 2>/dev/null)" = "0" ]; then + if [ -n "$CI_UBIPART_B" ]; then + CI_UBIPART="$CI_UBIPART_B" + CI_FWSETENV="" + fi + fi + fi + fi + nand_upgrade_tar "$1" + ;; glinet,b3000) CI_UBIPART="rootfs1" [ "$(find_mtd_chardev rootfs)" ] && CI_UBIPART="rootfs" diff --git a/feeds/ipq807x_v5.4/ipq60xx/base-files/lib/upgrade/platform.sh b/feeds/ipq807x_v5.4/ipq60xx/base-files/lib/upgrade/platform.sh index 63bf813ca..797b2e425 100755 --- a/feeds/ipq807x_v5.4/ipq60xx/base-files/lib/upgrade/platform.sh +++ b/feeds/ipq807x_v5.4/ipq60xx/base-files/lib/upgrade/platform.sh @@ -182,12 +182,31 @@ platform_do_upgrade() { if [ "$(find_mtd_chardev rootfs)" ]; then CI_UBIPART="rootfs" else - if grep -q rootfs1 /proc/cmdline; then - CI_UBIPART="rootfs2" - CI_FWSETENV="active 2" - else + if [ -e /tmp/downgrade ]; then CI_UBIPART="rootfs1" - CI_FWSETENV="active 1" + { echo 'active 1'; echo 'upgrade_available 0'; } > /tmp/fw_setenv.txt || exit 1 + CI_FWSETENV="-s /tmp/fw_setenv.txt" + else + local CI_UBIPART_B="" + if grep -q rootfs1 /proc/cmdline; then + CI_UBIPART="rootfs2" + CI_UBIPART_B="rootfs1" + CI_FWSETENV="active 2" + elif grep -q rootfs2 /proc/cmdline; then + CI_UBIPART="rootfs1" + CI_UBIPART_B="rootfs2" + CI_FWSETENV="active 1" + else + CI_UBIPART="rootfs1" + CI_UBIPART_B="" + CI_FWSETENV="active 1" + fi + if [ "$(fw_printenv -n upgrade_available 2>/dev/null)" = "0" ]; then + if [ -n "$CI_UBIPART_B" ]; then + CI_UBIPART="$CI_UBIPART_B" + CI_FWSETENV="" + fi + fi fi fi nand_upgrade_tar "$1" diff --git a/feeds/ipq807x_v5.4/ipq807x/base-files/etc/init.d/bootcount b/feeds/ipq807x_v5.4/ipq807x/base-files/etc/init.d/bootcount index 1843b3866..bf3936201 100755 --- a/feeds/ipq807x_v5.4/ipq807x/base-files/etc/init.d/bootcount +++ b/feeds/ipq807x_v5.4/ipq807x/base-files/etc/init.d/bootcount @@ -7,7 +7,7 @@ boot() { hfcl,ion4xe|\ hfcl,ion4xi) fw_setenv boot_count 0 - ;; + ;; edgecore,eap101|\ edgecore,eap102|\ edgecore,oap102|\ diff --git a/feeds/ipq807x_v5.4/ipq807x/base-files/lib/upgrade/platform.sh b/feeds/ipq807x_v5.4/ipq807x/base-files/lib/upgrade/platform.sh index cc5015353..528bcbc03 100755 --- a/feeds/ipq807x_v5.4/ipq807x/base-files/lib/upgrade/platform.sh +++ b/feeds/ipq807x_v5.4/ipq807x/base-files/lib/upgrade/platform.sh @@ -78,12 +78,27 @@ platform_do_upgrade() { CI_UBIPART="rootfs1" { echo 'active 1'; echo 'upgrade_available 0'; } > /tmp/fw_setenv.txt || exit 1 CI_FWSETENV="-s /tmp/fw_setenv.txt" - elif grep -q rootfs1 /proc/cmdline; then - CI_UBIPART="rootfs2" - CI_FWSETENV="active 2" else - CI_UBIPART="rootfs1" - CI_FWSETENV="active 1" + local CI_UBIPART_B="" + if grep -q rootfs1 /proc/cmdline; then + CI_UBIPART="rootfs2" + CI_UBIPART_B="rootfs1" + CI_FWSETENV="active 2" + elif grep -q rootfs2 /proc/cmdline; then + CI_UBIPART="rootfs1" + CI_UBIPART_B="rootfs2" + CI_FWSETENV="active 1" + else + CI_UBIPART="rootfs1" + CI_UBIPART_B="" + CI_FWSETENV="active 1" + fi + if [ "$(fw_printenv -n upgrade_available 2>/dev/null)" = "0" ]; then + if [ -n "$CI_UBIPART_B" ]; then + CI_UBIPART="$CI_UBIPART_B" + CI_FWSETENV="" + fi + fi fi fi nand_upgrade_tar "$1" diff --git a/feeds/qca-wifi-7/ipq53xx/base-files/lib/upgrade/platform.sh b/feeds/qca-wifi-7/ipq53xx/base-files/lib/upgrade/platform.sh index 0a5d32a70..f7efdfb02 100755 --- a/feeds/qca-wifi-7/ipq53xx/base-files/lib/upgrade/platform.sh +++ b/feeds/qca-wifi-7/ipq53xx/base-files/lib/upgrade/platform.sh @@ -151,15 +151,31 @@ platform_do_upgrade() { spi_nor_emmc_do_upgrade_bootconfig $1 ;; edgecore,eap105) - if [ "$(find_mtd_chardev rootfs)" ]; then - CI_UBIPART="rootfs" - else - if grep -q rootfs1 /proc/cmdline; then - CI_UBIPART="rootfs2" - CI_FWSETENV="active 2" - else + if [ -e /tmp/downgrade ]; then CI_UBIPART="rootfs1" - CI_FWSETENV="active 1" + { echo 'active 1'; echo 'upgrade_available 0'; } > /tmp/fw_setenv.txt || exit 1 + CI_FWSETENV="-s /tmp/fw_setenv.txt" + else + local CI_UBIPART_B="" + if grep -q rootfs1 /proc/cmdline; then + CI_UBIPART="rootfs2" + CI_UBIPART_B="rootfs1" + CI_FWSETENV="active 2" + elif grep -q rootfs2 /proc/cmdline; then + CI_UBIPART="rootfs1" + CI_UBIPART_B="rootfs2" + CI_FWSETENV="active 1" + else + CI_UBIPART="rootfs1" + CI_UBIPART_B="" + CI_FWSETENV="active 1" + fi + if [ "$(fw_printenv -n upgrade_available 2>/dev/null)" = "0" ]; then + if [ -n "$CI_UBIPART_B" ]; then + CI_UBIPART="$CI_UBIPART_B" + CI_FWSETENV="" + fi + fi fi fi nand_upgrade_tar "$1"