1
0
This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
svn-openwrt-archive/target/linux/mediatek/base-files/lib/upgrade/platform.sh
John Crispin a2ad91fc74 mediatek: sync and patches add support for several boards
Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 49263
2016-04-27 08:58:15 +00:00

42 lines
843 B
Bash
Executable File

#
# Copyright (C) 2016 OpenWrt.org
#
platform_do_upgrade() {
local tar_file="$1"
local board="$(cat /tmp/sysinfo/board_name)"
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"
local board=$(cat /tmp/sysinfo/board_name)
case "$board" in
NAND | \
eMMC)
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
}