2016-04-27 08:58:15 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) 2016 OpenWrt.org
|
|
|
|
#
|
|
|
|
|
|
|
|
platform_do_upgrade() {
|
|
|
|
local tar_file="$1"
|
2017-07-09 11:00:36 +00:00
|
|
|
local board="$(board_name)"
|
2016-04-27 08:58:15 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
platform_check_image() {
|
|
|
|
local tar_file="$1"
|
2017-07-09 11:00:36 +00:00
|
|
|
local board=$(board_name)
|
2016-04-27 08:58:15 +00:00
|
|
|
|
|
|
|
case "$board" in
|
2017-04-10 04:45:59 +00:00
|
|
|
mediatek,mt7623-rfb-nand-ephy |\
|
|
|
|
mediatek,mt7623-rfb-nand)
|
2016-06-17 01:46:25 +00:00
|
|
|
nand_do_platform_check $board $1
|
|
|
|
return $?
|
|
|
|
;;
|
2017-08-18 16:11:52 +00:00
|
|
|
bananapi,bpi-r2 |\
|
2017-04-10 04:45:59 +00:00
|
|
|
mediatek,mt7623-rfb-emmc)
|
2016-04-27 08:58:15 +00:00
|
|
|
local kernel_length=`(tar xf $tar_file sysupgrade-$board/kernel -O | wc -c) 2> /dev/null`
|
|
|
|
local rootfs_length=`(tar xf $tar_file sysupgrade-$board/root -O | wc -c) 2> /dev/null`
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "Sysupgrade is not supported on your board yet."
|
|
|
|
return 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
[ "$kernel_length" = 0 -o "$rootfs_length" = 0 ] && {
|
|
|
|
echo "The upgarde image is corrupt."
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
2016-06-17 01:46:25 +00:00
|
|
|
|
|
|
|
platform_pre_upgrade() {
|
2017-07-09 11:00:36 +00:00
|
|
|
case "$(board_name)" in
|
2017-04-10 04:45:59 +00:00
|
|
|
mediatek,mt7623-rfb-nand-ephy |\
|
|
|
|
mediatek,mt7623-rfb-nand)
|
2016-06-17 01:46:25 +00:00
|
|
|
nand_do_upgrade $1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|