treewide: move nand_do_upgrade call to platform_do_upgrade
authorMathias Kresin <dev@kresin.me>
Mon, 18 Dec 2017 19:32:18 +0000 (20:32 +0100)
committerMathias Kresin <dev@kresin.me>
Fri, 16 Feb 2018 13:44:02 +0000 (14:44 +0100)
Calling nand_do_upgrade() from platform_pre_upgrade() was deprecated
with 30f61a34b4cf ("base-files: always use staged sysupgrade").

Update the platform upgrade code to use platform_do_upgrade() for NAND
images as well.

Signed-off-by: Mathias Kresin <dev@kresin.me>
target/linux/apm821xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/imx6/base-files/lib/upgrade/platform.sh
target/linux/lantiq/base-files/lib/upgrade/platform.sh
target/linux/mediatek/base-files/lib/upgrade/platform.sh
target/linux/oxnas/base-files/lib/upgrade/platform.sh
target/linux/pistachio/base-files/lib/upgrade/platform.sh
target/linux/rb532/base-files/lib/upgrade/platform.sh

index a45af7d0540c998847ce6318ee6ac2e266ab8445..ced8ce197ae41fe608fa15f94196dc140ab1c2c0 100755 (executable)
@@ -18,21 +18,6 @@ platform_check_image() {
        esac
 }
 
-platform_pre_upgrade() {
-       local board=$(board_name)
-
-       case "$board" in
-       meraki,mr24|\
-       meraki,mx60|\
-       netgear,wndr4700)
-               nand_do_upgrade "$1"
-               ;;
-
-       *)
-               ;;
-       esac
-}
-
 platform_do_upgrade() {
        local board=$(board_name)
 
@@ -41,7 +26,11 @@ platform_do_upgrade() {
        wd,mybooklive-duo)
                mbl_do_upgrade "$ARGV"
                ;;
-
+       meraki,mr24|\
+       meraki,mx60|\
+       netgear,wndr4700)
+               nand_do_upgrade "$1"
+               ;;
        *)
                default_do_upgrade "$ARGV"
                ;;
index 2e7d298ec2b82a00d370dba11da3c57a824411cd..6f1a3ba1c92e1057fe4d0d1040b9143318ed367a 100755 (executable)
@@ -687,45 +687,6 @@ platform_pre_upgrade() {
        local board=$(board_name)
 
        case "$board" in
-       c-60|\
-       hiveap-121|\
-       nbg6716|\
-       r6100|\
-       rambutan|\
-       rb-411|\
-       rb-411u|\
-       rb-433|\
-       rb-433u|\
-       rb-435g|\
-       rb-450|\
-       rb-450g|\
-       rb-493|\
-       rb-493g|\
-       rb-750|\
-       rb-750gl|\
-       rb-751|\
-       rb-751g|\
-       rb-911g-2hpnd|\
-       rb-911g-5hpacd|\
-       rb-911g-5hpnd|\
-       rb-912uag-2hpnd|\
-       rb-912uag-5hpnd|\
-       rb-921gs-5hpacd-r2|\
-       rb-951g-2hnd|\
-       rb-951ui-2hnd|\
-       rb-2011il|\
-       rb-2011l|\
-       rb-2011uas|\
-       rb-2011uas-2hnd|\
-       rb-2011uias|\
-       rb-2011uias-2hnd|\
-       rb-sxt2n|\
-       rb-sxt5n|\
-       wi2a-ac200i|\
-       wndr3700v4|\
-       wndr4300)
-               nand_do_upgrade "$1"
-               ;;
        rb-750-r2|\
        rb-750p-pbr2|\
        rb-750up-r2|\
@@ -743,10 +704,6 @@ platform_pre_upgrade() {
                # erase firmware if booted from initramfs
                [ -z "$(rootfs_type)" ] && mtd erase firmware
                ;;
-       mr18|\
-       z1)
-               merakinand_do_upgrade "$1"
-               ;;
        esac
 }
 
@@ -835,6 +792,49 @@ platform_do_upgrade() {
        om5p-an)
                platform_do_upgrade_openmesh "$ARGV"
                ;;
+       c-60|\
+       hiveap-121|\
+       nbg6716|\
+       r6100|\
+       rambutan|\
+       rb-411|\
+       rb-411u|\
+       rb-433|\
+       rb-433u|\
+       rb-435g|\
+       rb-450|\
+       rb-450g|\
+       rb-493|\
+       rb-493g|\
+       rb-750|\
+       rb-750gl|\
+       rb-751|\
+       rb-751g|\
+       rb-911g-2hpnd|\
+       rb-911g-5hpacd|\
+       rb-911g-5hpnd|\
+       rb-912uag-2hpnd|\
+       rb-912uag-5hpnd|\
+       rb-921gs-5hpacd-r2
+       rb-951g-2hnd|\
+       rb-951ui-2hnd|\
+       rb-2011il|\
+       rb-2011l|\
+       rb-2011uas|\
+       rb-2011uas-2hnd|\
+       rb-2011uias|\
+       rb-2011uias-2hnd|\
+       rb-sxt2n|\
+       rb-sxt5n|\
+       wi2a-ac200i|\
+       wndr3700v4|\
+       wndr4300)
+               nand_do_upgrade "$1"
+               ;;
+       mr18|\
+       z1)
+               merakinand_do_upgrade "$1"
+               ;;
        uap-pro|\
        unifi-outdoor-plus)
                MTD_CONFIG_ARGS="-s 0x180000"
index a9ca5ee875b34f56ad43c13b2990a54ea148ad7f..ab5229110912d8d55ce605739eb70dd5d65c40f5 100755 (executable)
@@ -16,7 +16,7 @@ platform_check_image() {
        return 1
 }
 
-platform_pre_upgrade() {
+platform_do_upgrade() {
        local board=$(board_name)
 
        case "$board" in
index 9755dc40b20c215e08eaca54e462fb3586055570..2e58cb799a3aaf7425bd1af71781164d0f072c68 100755 (executable)
@@ -5,14 +5,15 @@ platform_check_image() {
        return 0
 }
 
-platform_pre_upgrade() {
+platform_do_upgrade() {
        local board=$(board_name)
 
        case "$board" in
        bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)
                nand_do_upgrade $1
                ;;
+       *)
+               default_do_upgrade "$ARGV"
+               ;;
        esac
 }
-
-# use default for platform_do_upgrade()
index 3f3c5a021ca7af419c221e60d774e351860efc0e..0429ca8b89ec26e07ab463373657e3d25ca6de06 100755 (executable)
@@ -6,13 +6,21 @@ platform_do_upgrade() {
        local tar_file="$1"
        local board="$(board_name)"
 
-       echo "flashing kernel"
-       tar xf $tar_file sysupgrade-$board/kernel -O | mtd write - kernel
+       case "$(board_name)" in
+       mediatek,mt7623-rfb-nand-ephy |\
+       mediatek,mt7623-rfb-nand)
+               nand_do_upgrade $1
+               ;;
+       *)
+               echo "flashing kernel"
+               tar xf $tar_file sysupgrade-$board/kernel -O | mtd write - kernel
 
-       echo "flashing rootfs"
-       tar xf $tar_file sysupgrade-$board/root -O | mtd write - rootfs
+               echo "flashing rootfs"
+               tar xf $tar_file sysupgrade-$board/root -O | mtd write - rootfs
 
-       return 0
+               return 0
+               ;;
+       esac
 }
 
 platform_check_image() {
index 8c2e34762acb64ee53ade52f18fe581103f2718c..059d75f9a90d94723c564c2a41a45509ccba1e16 100644 (file)
@@ -13,6 +13,6 @@ platform_check_image() {
        return $?
 }
 
-platform_pre_upgrade() {
+platform_do_upgrade() {
        nand_do_upgrade $1
 }
index 4edc06bf9f874d4526f24110d39ad505d6e75b8c..d7d2ba065aa3c7f4128b73b6e44a0d1c26fccb1c 100755 (executable)
@@ -18,7 +18,7 @@ platform_check_image()
        return $?
 }
 
-platform_pre_upgrade() {
+platform_do_upgrade() {
        # TODO no need to switch to ramfs with dual partitions in
        # fact we don't even want to reboot as part of seamless
        # upgrades. Instead just upgrade opposite partition and mark
index 2beccc5985e78e599b4fc4c8eae723b8f0267189..a6a6e9b8d34267e2aa41f2a960534e739caeda96 100644 (file)
@@ -10,15 +10,11 @@ platform_check_image() {
        return 0;
 }
 
-platform_pre_upgrade() {
-       nand_do_upgrade "$1"
-}
-
 platform_nand_pre_upgrade() {
        mtd erase kernel
        tar xf "$1" "sysupgrade-$(board_name)/kernel" -O | nandwrite -o /dev/mtd0 -
 }
 
 platform_do_upgrade() {
-       default_do_upgrade "$ARGV"
+       nand_do_upgrade "$1"
 }