mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 01:22:25 +00:00
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:
committed by
John Crispin
parent
afcffbc418
commit
0412bf03eb
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user