mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 14:37:57 +00:00
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>
This commit is contained in:
parent
3b30ff2975
commit
1cbe0d659c
@ -746,19 +746,18 @@ platform_check_image() {
|
||||
return 1
|
||||
}
|
||||
|
||||
platform_nand_pre_upgrade() {
|
||||
local board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
rb*)
|
||||
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" -
|
||||
;;
|
||||
wi2a-ac200i)
|
||||
|
||||
nand_do_upgrade "$1"
|
||||
}
|
||||
|
||||
platform_do_upgrade_nokia() {
|
||||
case "$(fw_printenv -n dualPartition)" in
|
||||
imgA)
|
||||
fw_setenv dualPartition imgB
|
||||
@ -774,8 +773,8 @@ platform_nand_pre_upgrade() {
|
||||
ubidetach -d 0 2>/dev/null >/dev/null
|
||||
CI_UBIPART=ubi_alt
|
||||
CI_KERNPART=kernel_alt
|
||||
;;
|
||||
esac
|
||||
|
||||
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"
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -118,5 +118,7 @@ zyxel_do_upgrade() {
|
||||
|
||||
zyxel_do_flash $tar_file $kernel $rootfs $dualflagmtd
|
||||
|
||||
nand_do_upgrade "$1"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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"
|
||||
;;
|
||||
|
@ -73,4 +73,6 @@ platform_upgrade_ubnt_erx() {
|
||||
fi
|
||||
|
||||
ubnt_update_target_kernel ${factory_mtd} ${kernel_part} || exit 1
|
||||
|
||||
nand_do_upgrade "$1"
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user