aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files
diff options
context:
space:
mode:
authorRodrigo Balerdi <lanchon@gmail.com>2022-04-15 03:24:58 -0300
committerDaniel Golle <daniel@makrotopia.org>2022-04-19 16:28:25 +0100
commitecbcc0b595516d059092b89efbef69b93cf97f6a (patch)
tree1ced1d69075975ab8bcf70d22f8575de7d603ea2 /package/base-files/files
parent073dc450b5ca91cfffd9097f0e3900dd390be399 (diff)
downloadupstream-ecbcc0b595516d059092b89efbef69b93cf97f6a.tar.gz
upstream-ecbcc0b595516d059092b89efbef69b93cf97f6a.tar.bz2
upstream-ecbcc0b595516d059092b89efbef69b93cf97f6a.zip
base-files: safer sysupgrade.tar for kernel-out-of-UBI
Ensure that the kernel CRC is invalidated while rootfs is being updated. This allows the bootloader to detect an interrupted sysupgrade and fall back to an alternate booting method, such as TFTP, instead of just going ahead with normal boot and effectively bricking the device. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
Diffstat (limited to 'package/base-files/files')
-rw-r--r--package/base-files/files/lib/upgrade/nand.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index f927c066da..a93c9acccd 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -303,7 +303,7 @@ nand_upgrade_tar() {
local has_env=0
[ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && {
- tar xf "$tar_file" ${board_dir}/kernel -O | mtd write - $CI_KERNPART
+ mtd erase $CI_KERNPART
}
[ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=
[ "$CI_KERNPART" = "none" ] && has_kernel=
@@ -317,6 +317,10 @@ nand_upgrade_tar() {
ubiupdatevol /dev/$root_ubivol -s $rootfs_length -
}
+ [ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && {
+ tar xf "$tar_file" ${board_dir}/kernel -O | \
+ mtd -n write - $CI_KERNPART
+ }
[ "$has_kernel" = "1" ] && {
local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )"
tar xf "$tar_file" ${board_dir}/kernel -O | \