diff options
author | John Crispin <blogic@openwrt.org> | 2016-04-27 08:58:15 +0000 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2016-04-27 08:58:15 +0000 |
commit | 1e22c9b9eb691878156dfe32fb1e117737f1d248 (patch) | |
tree | 991c1cb524c938fc25c474321d1b726017c04ca6 /target/linux/mediatek/base-files/lib/upgrade/platform.sh | |
parent | cafe040bdd2e8d3b91d1aa1d45718b325453c84f (diff) | |
download | master-187ad058-1e22c9b9eb691878156dfe32fb1e117737f1d248.tar.gz master-187ad058-1e22c9b9eb691878156dfe32fb1e117737f1d248.tar.bz2 master-187ad058-1e22c9b9eb691878156dfe32fb1e117737f1d248.zip |
mediatek: sync and patches add support for several boards
Signed-off-by: John Crispin <blogic@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@49263 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/mediatek/base-files/lib/upgrade/platform.sh')
-rwxr-xr-x | target/linux/mediatek/base-files/lib/upgrade/platform.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/target/linux/mediatek/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/base-files/lib/upgrade/platform.sh new file mode 100755 index 0000000000..be72114adb --- /dev/null +++ b/target/linux/mediatek/base-files/lib/upgrade/platform.sh @@ -0,0 +1,41 @@ +# +# 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 +} |