From 1cbe0d659c4438cc6348093385a24e969aeadac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 17 Jul 2019 11:32:54 +0200 Subject: treewide: sysupgrade: get rid of platform_nand_pre_upgrade() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../ar71xx/base-files/lib/upgrade/platform.sh | 73 +++++++++++----------- 1 file changed, 38 insertions(+), 35 deletions(-) (limited to 'target/linux/ar71xx') 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" -- cgit v1.2.3