allow overriding the kernel partition's name
authorImre Kaloz <kaloz@openwrt.org>
Mon, 14 Jul 2014 14:53:15 +0000 (14:53 +0000)
committerImre Kaloz <kaloz@openwrt.org>
Mon, 14 Jul 2014 14:53:15 +0000 (14:53 +0000)
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
SVN-Revision: 41646

package/system/procd/files/nand.sh

index 5f307d09b0bc422a5d15f601c0629185e46de514..4aa56e37ae5fd7979d8ed3d1d38e6b97a6a852e8 100644 (file)
@@ -4,6 +4,9 @@
 
 . /lib/functions.sh
 
+# 'kernel' partition on NAND contains the kernel
+CI_KERNPART="kernel"
+
 # 'ubi' partition on NAND contains UBI
 CI_UBIPART="ubi"
 
@@ -221,7 +224,7 @@ nand_upgrade_ubifs() {
 nand_upgrade_tar() {
        local tar_file="$1"
        local board_name="$(cat /tmp/sysinfo/board_name)"
-       local kernel_mtd="$(find_mtd_index kernel)"
+       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`
@@ -232,7 +235,7 @@ nand_upgrade_tar() {
        local has_env=0
 
        [ "kernel_length" = 0 -o -z "$kernel_mtd" ] || {
-               tar xf $tar_file sysupgrade-$board_name/kernel -O | mtd write - kernel
+               tar xf $tar_file sysupgrade-$board_name/kernel -O | mtd write - $CI_KERNPART
        }
        [ "kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=0