mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 17:42:41 +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)"
|
part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | cut -d " " -f 1)"
|
||||||
case "$part" in
|
case "$part" in
|
||||||
rootfs1)
|
rootfs1)
|
||||||
fw_setenv active 2 || exit 1
|
|
||||||
CI_UBIPART="rootfs2"
|
CI_UBIPART="rootfs2"
|
||||||
|
CI_FWSETENV="active 2"
|
||||||
;;
|
;;
|
||||||
rootfs2)
|
rootfs2)
|
||||||
fw_setenv active 1 || exit 1
|
|
||||||
CI_UBIPART="rootfs1"
|
CI_UBIPART="rootfs1"
|
||||||
|
CI_FWSETENV="active 1"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# legacy bootloader
|
# legacy bootloader
|
||||||
|
|||||||
@@ -247,8 +247,8 @@ nand_do_upgrade_success() {
|
|||||||
local conf_tar="/tmp/sysupgrade.tgz"
|
local conf_tar="/tmp/sysupgrade.tgz"
|
||||||
sync
|
sync
|
||||||
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
|
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
|
||||||
|
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar" && sync
|
||||||
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
|
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
|
||||||
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
|
|
||||||
echo "sysupgrade successful"
|
echo "sysupgrade successful"
|
||||||
umount -a
|
umount -a
|
||||||
reboot -f
|
reboot -f
|
||||||
|
|||||||
@@ -260,8 +260,8 @@ platform_do_upgrade() {
|
|||||||
else
|
else
|
||||||
if [ -e /tmp/downgrade ]; then
|
if [ -e /tmp/downgrade ]; then
|
||||||
CI_UBIPART="rootfs1"
|
CI_UBIPART="rootfs1"
|
||||||
fw_setenv active 1 || exit 1
|
{ echo 'active 1'; echo 'upgrade_available 0'; } > /tmp/fw_setenv.txt || exit 1
|
||||||
fw_setenv upgrade_available 0 || exit 1
|
CI_FWSETENV="-s /tmp/fw_setenv.txt"
|
||||||
elif grep -q rootfs1 /proc/cmdline; then
|
elif grep -q rootfs1 /proc/cmdline; then
|
||||||
CI_UBIPART="rootfs2"
|
CI_UBIPART="rootfs2"
|
||||||
CI_FWSETENV="active 2"
|
CI_FWSETENV="active 2"
|
||||||
|
|||||||
@@ -247,8 +247,8 @@ nand_do_upgrade_success() {
|
|||||||
local conf_tar="/tmp/sysupgrade.tgz"
|
local conf_tar="/tmp/sysupgrade.tgz"
|
||||||
sync
|
sync
|
||||||
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
|
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
|
||||||
|
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar" && sync
|
||||||
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
|
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
|
||||||
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
|
|
||||||
echo "sysupgrade successful"
|
echo "sysupgrade successful"
|
||||||
umount -a
|
umount -a
|
||||||
reboot -f
|
reboot -f
|
||||||
|
|||||||
@@ -247,8 +247,8 @@ nand_do_upgrade_success() {
|
|||||||
local conf_tar="/tmp/sysupgrade.tgz"
|
local conf_tar="/tmp/sysupgrade.tgz"
|
||||||
sync
|
sync
|
||||||
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
|
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
|
||||||
|
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar" && sync
|
||||||
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
|
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
|
||||||
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
|
|
||||||
echo "sysupgrade successful"
|
echo "sysupgrade successful"
|
||||||
umount -a
|
umount -a
|
||||||
reboot -f
|
reboot -f
|
||||||
|
|||||||
@@ -122,10 +122,10 @@ platform_do_upgrade() {
|
|||||||
else
|
else
|
||||||
if grep -q rootfs1 /proc/cmdline; then
|
if grep -q rootfs1 /proc/cmdline; then
|
||||||
CI_UBIPART="rootfs2"
|
CI_UBIPART="rootfs2"
|
||||||
fw_setenv active 2 || exit 1
|
CI_FWSETENV="active 2"
|
||||||
else
|
else
|
||||||
CI_UBIPART="rootfs1"
|
CI_UBIPART="rootfs1"
|
||||||
fw_setenv active 1 || exit 1
|
CI_FWSETENV="active 1"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
nand_upgrade_tar "$1"
|
nand_upgrade_tar "$1"
|
||||||
|
|||||||
@@ -247,8 +247,8 @@ nand_do_upgrade_success() {
|
|||||||
local conf_tar="/tmp/sysupgrade.tgz"
|
local conf_tar="/tmp/sysupgrade.tgz"
|
||||||
sync
|
sync
|
||||||
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
|
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
|
||||||
|
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar" && sync
|
||||||
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
|
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
|
||||||
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
|
|
||||||
echo "sysupgrade successful"
|
echo "sysupgrade successful"
|
||||||
umount -a
|
umount -a
|
||||||
reboot -f
|
reboot -f
|
||||||
|
|||||||
@@ -61,12 +61,16 @@ platform_do_upgrade() {
|
|||||||
if [ "$(find_mtd_chardev rootfs)" ]; then
|
if [ "$(find_mtd_chardev rootfs)" ]; then
|
||||||
CI_UBIPART="rootfs"
|
CI_UBIPART="rootfs"
|
||||||
else
|
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"
|
CI_UBIPART="rootfs2"
|
||||||
fw_setenv active 2 || exit 1
|
CI_FWSETENV="active 2"
|
||||||
else
|
else
|
||||||
CI_UBIPART="rootfs1"
|
CI_UBIPART="rootfs1"
|
||||||
fw_setenv active 1 || exit 1
|
CI_FWSETENV="active 1"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
nand_upgrade_tar "$1"
|
nand_upgrade_tar "$1"
|
||||||
|
|||||||
@@ -247,8 +247,8 @@ nand_do_upgrade_success() {
|
|||||||
local conf_tar="/tmp/sysupgrade.tgz"
|
local conf_tar="/tmp/sysupgrade.tgz"
|
||||||
sync
|
sync
|
||||||
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
|
[ "$CI_BOOTCFG" = 1 ] && nand_qca_update_bootconfig
|
||||||
|
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar" && sync
|
||||||
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
|
[ -n "$CI_FWSETENV" ] && fw_setenv $CI_FWSETENV
|
||||||
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
|
|
||||||
echo "sysupgrade successful"
|
echo "sysupgrade successful"
|
||||||
umount -a
|
umount -a
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|||||||
Reference in New Issue
Block a user