treewide: Fix dual boot fw upgrade for Edgecore APs

Fixes: WIFI-13497
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
This commit is contained in:
Tanya Singh
2024-03-12 18:33:44 +08:00
committed by John Crispin
parent afcffbc418
commit 0412bf03eb
9 changed files with 18 additions and 14 deletions

View File

@@ -83,12 +83,12 @@ platform_do_upgrade() {
part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | cut -d " " -f 1)"
case "$part" in
rootfs1)
fw_setenv active 2 || exit 1
CI_UBIPART="rootfs2"
CI_FWSETENV="active 2"
;;
rootfs2)
fw_setenv active 1 || exit 1
CI_UBIPART="rootfs1"
CI_FWSETENV="active 1"
;;
*)
# legacy bootloader

View File

@@ -247,8 +247,8 @@ nand_do_upgrade_success() {
local conf_tar="/tmp/sysupgrade.tgz"
sync
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar" && sync
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
echo "sysupgrade successful"
umount -a
reboot -f

View File

@@ -260,8 +260,8 @@ platform_do_upgrade() {
else
if [ -e /tmp/downgrade ]; then
CI_UBIPART="rootfs1"
fw_setenv active 1 || exit 1
fw_setenv upgrade_available 0 || exit 1
{ 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"

View File

@@ -247,8 +247,8 @@ nand_do_upgrade_success() {
local conf_tar="/tmp/sysupgrade.tgz"
sync
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar" && sync
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
echo "sysupgrade successful"
umount -a
reboot -f

View File

@@ -247,8 +247,8 @@ nand_do_upgrade_success() {
local conf_tar="/tmp/sysupgrade.tgz"
sync
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar" && sync
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
echo "sysupgrade successful"
umount -a
reboot -f

View File

@@ -122,10 +122,10 @@ platform_do_upgrade() {
else
if grep -q rootfs1 /proc/cmdline; then
CI_UBIPART="rootfs2"
fw_setenv active 2 || exit 1
CI_FWSETENV="active 2"
else
CI_UBIPART="rootfs1"
fw_setenv active 1 || exit 1
CI_FWSETENV="active 1"
fi
fi
nand_upgrade_tar "$1"

View File

@@ -247,8 +247,8 @@ nand_do_upgrade_success() {
local conf_tar="/tmp/sysupgrade.tgz"
sync
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar" && sync
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
echo "sysupgrade successful"
umount -a
reboot -f

View File

@@ -61,12 +61,16 @@ platform_do_upgrade() {
if [ "$(find_mtd_chardev rootfs)" ]; then
CI_UBIPART="rootfs"
else
if grep -q rootfs1 /proc/cmdline; then
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"
elif grep -q rootfs1 /proc/cmdline; then
CI_UBIPART="rootfs2"
fw_setenv active 2 || exit 1
CI_FWSETENV="active 2"
else
CI_UBIPART="rootfs1"
fw_setenv active 1 || exit 1
CI_FWSETENV="active 1"
fi
fi
nand_upgrade_tar "$1"

View File

@@ -247,8 +247,8 @@ nand_do_upgrade_success() {
local conf_tar="/tmp/sysupgrade.tgz"
sync
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar" && sync
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
echo "sysupgrade successful"
umount -a
sleep 5