summaryrefslogtreecommitdiff
path: root/package/base-files/files/lib
diff options
context:
space:
mode:
authorMathias Kresin <dev@kresin.me>2017-04-07 08:39:59 +0200
committerMathias Kresin <dev@kresin.me>2017-12-08 20:57:12 +0100
commitc90a8cb7552cc7e843c328283268d67709d26a8c (patch)
tree9ebe83b434bb5a0933e23f4ddbdf152185c2b353 /package/base-files/files/lib
parent668eb70157be59b17bb6da4a6de5d5e71a7c832b (diff)
downloadmtk-20170518-c90a8cb7552cc7e843c328283268d67709d26a8c.zip
mtk-20170518-c90a8cb7552cc7e843c328283268d67709d26a8c.tar.gz
mtk-20170518-c90a8cb7552cc7e843c328283268d67709d26a8c.tar.bz2
procd: nand: dont rely on boardname in nand_upgrade_tar
Kernel and rootfs in a subdirectory matching the userspace boardname, was intended to use a single sysupgrade-tar archive for multiple boards with different kernel/rootfs images. This feature was never used. Use the first found directory in the tar archive instead of relying on a directory named according to the userspace boardname. It allows to change the boardname without adding another compatibility layer - using the nand_board_name() function - for (sub)targets using the metadata based image validation in favour to nand_do_platform_check(). Signed-off-by: Mathias Kresin <dev@kresin.me>
Diffstat (limited to 'package/base-files/files/lib')
-rw-r--r--package/base-files/files/lib/upgrade/nand.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index 563db4c..1c6b86b 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -250,19 +250,21 @@ nand_board_name() {
nand_upgrade_tar() {
local tar_file="$1"
- local board_name="$(nand_board_name)"
local kernel_mtd="$(find_mtd_index $CI_KERNPART)"
- local kernel_length=`(tar xf $tar_file sysupgrade-$board_name/kernel -O | wc -c) 2> /dev/null`
- local rootfs_length=`(tar xf $tar_file sysupgrade-$board_name/root -O | wc -c) 2> /dev/null`
+ local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
+ board_dir=${board_dir%/}
- local rootfs_type="$(identify_tar "$tar_file" sysupgrade-$board_name/root)"
+ local kernel_length=`(tar xf $tar_file ${board_dir}/kernel -O | wc -c) 2> /dev/null`
+ local rootfs_length=`(tar xf $tar_file ${board_dir}/root -O | wc -c) 2> /dev/null`
+
+ local rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)"
local has_kernel=1
local has_env=0
[ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && {
- tar xf $tar_file sysupgrade-$board_name/kernel -O | mtd write - $CI_KERNPART
+ tar xf $tar_file ${board_dir}/kernel -O | mtd write - $CI_KERNPART
}
[ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=0
@@ -271,12 +273,12 @@ nand_upgrade_tar() {
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
[ "$has_kernel" = "1" ] && {
local kern_ubivol="$(nand_find_volume $ubidev $CI_KERNPART)"
- tar xf $tar_file sysupgrade-$board_name/kernel -O | \
+ tar xf $tar_file ${board_dir}/kernel -O | \
ubiupdatevol /dev/$kern_ubivol -s $kernel_length -
}
local root_ubivol="$(nand_find_volume $ubidev rootfs)"
- tar xf $tar_file sysupgrade-$board_name/root -O | \
+ tar xf $tar_file ${board_dir}/root -O | \
ubiupdatevol /dev/$root_ubivol -s $rootfs_length -
nand_do_upgrade_success