From 090b134786a009427442aee7e2ea48e47be5e60f Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 27 Apr 2016 08:58:15 +0000 Subject: mediatek: sync and patches add support for several boards Signed-off-by: John Crispin SVN-Revision: 49263 --- target/linux/mediatek/base-files/lib/mediatek.sh | 7 ++-- .../mediatek/base-files/lib/upgrade/platform.sh | 41 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100755 target/linux/mediatek/base-files/lib/upgrade/platform.sh (limited to 'target/linux/mediatek/base-files') diff --git a/target/linux/mediatek/base-files/lib/mediatek.sh b/target/linux/mediatek/base-files/lib/mediatek.sh index 09540326ae..d352ebbcc5 100644 --- a/target/linux/mediatek/base-files/lib/mediatek.sh +++ b/target/linux/mediatek/base-files/lib/mediatek.sh @@ -10,8 +10,11 @@ mediatek_board_detect() { machine=$(cat /proc/device-tree/model) case "$machine" in - "MediaTek MT7623 evaluation board") - name="mt7623_evb" + "MediaTek MT7623 eMMC evaluation board") + name="eMMC" + ;; + "MediaTek MT7623 NAND evaluation board") + name="NAND" ;; esac 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 +} -- cgit v1.2.3