diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2019-07-17 11:32:54 +0200 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2019-07-22 14:27:37 +0200 |
commit | 1cbe0d659c4438cc6348093385a24e969aeadac0 (patch) | |
tree | f901d8057341186f0fe8a8bee22ae9398f54b649 /target | |
parent | 3b30ff29757258a0e16f51a86cdbb2a74a67ff7e (diff) | |
download | upstream-1cbe0d659c4438cc6348093385a24e969aeadac0.tar.gz upstream-1cbe0d659c4438cc6348093385a24e969aeadac0.tar.bz2 upstream-1cbe0d659c4438cc6348093385a24e969aeadac0.zip |
treewide: sysupgrade: get rid of platform_nand_pre_upgrade()
1) nand_do_upgrade() is always called by a target code
2) nand_do_upgrade() starts with calling platform_nand_pre_upgrade()
It means there is no need for the platform_nand_pre_upgrade() callback
at all. All code that was present there could bo moved & simplly called
by a target right before the nand_do_upgrade().
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'target')
8 files changed, 64 insertions, 88 deletions
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 5de7af667f..6898c0e0c2 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -746,36 +746,35 @@ platform_check_image() { return 1 } -platform_nand_pre_upgrade() { - local board=$(board_name) +platform_do_upgrade_mikrotik_rb() { + CI_KERNPART=none + local fw_mtd=$(find_mtd_part kernel) + fw_mtd="${fw_mtd/block/}" + [ -n "$fw_mtd" ] || return + mtd erase kernel + tar xf "$1" sysupgrade-routerboard/kernel -O | nandwrite -o "$fw_mtd" - + + nand_do_upgrade "$1" +} - case "$board" in - rb*) - CI_KERNPART=none - local fw_mtd=$(find_mtd_part kernel) - fw_mtd="${fw_mtd/block/}" - [ -n "$fw_mtd" ] || return - mtd erase kernel - tar xf "$1" sysupgrade-routerboard/kernel -O | nandwrite -o "$fw_mtd" - +platform_do_upgrade_nokia() { + case "$(fw_printenv -n dualPartition)" in + imgA) + fw_setenv dualPartition imgB + fw_setenv ActImg NokiaImageB ;; - wi2a-ac200i) - case "$(fw_printenv -n dualPartition)" in - imgA) - fw_setenv dualPartition imgB - fw_setenv ActImg NokiaImageB - ;; - imgB) - fw_setenv dualPartition imgA - fw_setenv ActImg NokiaImageA - ;; - esac - ubiblock -r /dev/ubiblock0_0 2>/dev/null >/dev/null - rm -f /dev/ubiblock0_0 - ubidetach -d 0 2>/dev/null >/dev/null - CI_UBIPART=ubi_alt - CI_KERNPART=kernel_alt + imgB) + fw_setenv dualPartition imgA + fw_setenv ActImg NokiaImageA ;; esac + ubiblock -r /dev/ubiblock0_0 2>/dev/null >/dev/null + rm -f /dev/ubiblock0_0 + ubidetach -d 0 2>/dev/null >/dev/null + CI_UBIPART=ubi_alt + CI_KERNPART=kernel_alt + + nand_do_upgrade "$1" } platform_do_upgrade() { @@ -859,6 +858,14 @@ platform_do_upgrade() { nbg6716|\ r6100|\ rambutan|\ + wndr3700v4|\ + wndr4300) + nand_do_upgrade "$1" + ;; + mr18|\ + z1) + merakinand_do_upgrade "$1" + ;; rb-411|\ rb-411u|\ rb-433|\ @@ -890,21 +897,17 @@ platform_do_upgrade() { rb-2011uias-2hnd|\ rb-2011uias-2hnd-r2|\ rb-sxt2n|\ - rb-sxt5n|\ - wi2a-ac200i|\ - wndr3700v4|\ - wndr4300) - nand_do_upgrade "$1" - ;; - mr18|\ - z1) - merakinand_do_upgrade "$1" + rb-sxt5n) + platform_do_upgrade_mikrotik_rb "$1" ;; uap-pro|\ unifi-outdoor-plus) MTD_CONFIG_ARGS="-s 0x180000" default_do_upgrade "$1" ;; + wi2a-ac200i) + platform_do_upgrade_nokia "$1" + ;; wp543|\ wpe72) platform_do_upgrade_compex "$1" diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index a5e39c280c..dac773d2fe 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -47,12 +47,22 @@ zyxel_do_upgrade() { platform_do_upgrade() { case "$(board_name)" in 8dev,jalapeno |\ - alfa-network,ap120c-ac |\ avm,fritzbox-7530 |\ avm,fritzrepeater-3000 |\ qxwlan,e2600ac-c2) nand_do_upgrade "$1" ;; + alfa-network,ap120c-ac) + part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')" + if [ "$part" = "rootfs1" ]; then + fw_setenv active 2 || exit 1 + CI_UBIPART="rootfs2" + else + fw_setenv active 1 || exit 1 + CI_UBIPART="rootfs1" + fi + nand_do_upgrade "$1" + ;; asus,map-ac2200) CI_KERNPART="linux" nand_do_upgrade "$1" @@ -83,25 +93,3 @@ platform_do_upgrade() { ;; esac } - -platform_nand_pre_upgrade() { - case "$(board_name)" in - alfa-network,ap120c-ac) - part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')" - if [ "$part" = "rootfs1" ]; then - fw_setenv active 2 || exit 1 - CI_UBIPART="rootfs2" - else - fw_setenv active 1 || exit 1 - CI_UBIPART="rootfs1" - fi - ;; - asus,rt-ac58u) - CI_UBIPART="UBI_DEV" - CI_KERNPART="linux" - ;; - meraki,mr33) - CI_KERNPART="part.safe" - ;; - esac -} diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh index 5919613cb9..b61047ff70 100644 --- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh @@ -21,10 +21,12 @@ platform_do_upgrade() { netgear,r7500v2 |\ netgear,r7800 |\ qcom,ipq8064-ap148 |\ - qcom,ipq8064-ap161 |\ - zyxel,nbg6817) + qcom,ipq8064-ap161) nand_do_upgrade "$1" ;; + zyxel,nbg6817) + zyxel_do_upgrade "$1" + ;; linksys,ea8500) platform_do_upgrade_linksys "$1" ;; @@ -44,11 +46,3 @@ platform_do_upgrade() { ;; esac } - -platform_nand_pre_upgrade() { - case "$(board_name)" in - zyxel,nbg6817) - zyxel_do_upgrade "$1" - ;; - esac -} diff --git a/target/linux/ipq806x/base-files/lib/upgrade/zyxel.sh b/target/linux/ipq806x/base-files/lib/upgrade/zyxel.sh index ba8e825956..33cd98339c 100644 --- a/target/linux/ipq806x/base-files/lib/upgrade/zyxel.sh +++ b/target/linux/ipq806x/base-files/lib/upgrade/zyxel.sh @@ -118,5 +118,7 @@ zyxel_do_upgrade() { zyxel_do_flash $tar_file $kernel $rootfs $dualflagmtd + nand_do_upgrade "$1" + return 0 } diff --git a/target/linux/pistachio/base-files/lib/upgrade/platform.sh b/target/linux/pistachio/base-files/lib/upgrade/platform.sh index 4de019a27c..174c321d38 100755 --- a/target/linux/pistachio/base-files/lib/upgrade/platform.sh +++ b/target/linux/pistachio/base-files/lib/upgrade/platform.sh @@ -26,10 +26,7 @@ platform_do_upgrade() { # stage2 directly but need to refactor nand_upgrade_success # for this to work. # Also the nand functions don't allow url to be used - nand_do_upgrade $1 -} -platform_nand_pre_upgrade() { local board=$(board_name) case "$board" in @@ -48,4 +45,6 @@ platform_nand_pre_upgrade() { echo "Upgrading partition $CI_UBIPART (/dev/mtd$(find_mtd_index $CI_UBIPART))" ;; esac + + nand_do_upgrade $1 } diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index ae7a72c649..a65492a309 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -9,17 +9,6 @@ platform_check_image() { return 0 } -platform_nand_pre_upgrade() { - local board=$(board_name) - - case "$board" in - ubiquiti,edgerouterx|\ - ubiquiti,edgerouterx-sfp) - platform_upgrade_ubnt_erx "$1" - ;; - esac -} - platform_do_upgrade() { local board=$(board_name) @@ -35,8 +24,6 @@ platform_do_upgrade() { hiwifi,hc5962|\ netgear,r6220|\ netgear,r6350|\ - ubiquiti,edgerouterx|\ - ubiquiti,edgerouterx-sfp|\ xiaomi,mir3g|\ xiaomi,mir3p) nand_do_upgrade "$1" @@ -45,6 +32,10 @@ platform_do_upgrade() { MTD_ARGS="-t romfile" default_do_upgrade "$1" ;; + ubiquiti,edgerouterx|\ + ubiquiti,edgerouterx-sfp) + platform_upgrade_ubnt_erx "$1" + ;; *) default_do_upgrade "$1" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/ubnt.sh b/target/linux/ramips/base-files/lib/upgrade/ubnt.sh index 316a70444f..748ec8e628 100644 --- a/target/linux/ramips/base-files/lib/upgrade/ubnt.sh +++ b/target/linux/ramips/base-files/lib/upgrade/ubnt.sh @@ -73,4 +73,6 @@ platform_upgrade_ubnt_erx() { fi ubnt_update_target_kernel ${factory_mtd} ${kernel_part} || exit 1 + + nand_do_upgrade "$1" } diff --git a/target/linux/rb532/base-files/lib/upgrade/platform.sh b/target/linux/rb532/base-files/lib/upgrade/platform.sh index a6a6e9b8d3..334d6e2ff6 100644 --- a/target/linux/rb532/base-files/lib/upgrade/platform.sh +++ b/target/linux/rb532/base-files/lib/upgrade/platform.sh @@ -10,11 +10,8 @@ platform_check_image() { return 0; } -platform_nand_pre_upgrade() { +platform_do_upgrade() { mtd erase kernel tar xf "$1" "sysupgrade-$(board_name)/kernel" -O | nandwrite -o /dev/mtd0 - -} - -platform_do_upgrade() { nand_do_upgrade "$1" } |