aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2023-06-15 10:46:10 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2023-06-15 11:48:45 +0200
commit25f6252620f2b00b4be922df011cec936aeeff42 (patch)
treea953d510e06425ce3e57534387a8152e537cf239
parent3506efe29c963cd6e021896fee09d060bb70b937 (diff)
downloadupstream-25f6252620f2b00b4be922df011cec936aeeff42.tar.gz
upstream-25f6252620f2b00b4be922df011cec936aeeff42.tar.bz2
upstream-25f6252620f2b00b4be922df011cec936aeeff42.zip
base-files: upgrade: nand: add JFFS2 cleanmarkers support
Some Broadcom MIPS devices require JFFS2 cleanmarkers to be present on the kernel partition or the bootloader will identify the partition as corrupt and won't boot the kernel. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> (cherry picked from commit 434df8df549a4d709be9eb19c0d2bd8abb4d4881)
-rw-r--r--package/base-files/files/lib/upgrade/nand.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index fa29d575a8..d910bf1791 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -301,6 +301,7 @@ nand_upgrade_fit() {
nand_upgrade_tar() {
local tar_file="$1"
local gz="$2"
+ local jffs2_markers="${CI_JFFS2_CLEAN_MARKERS:-0}"
# WARNING: This fails if tar contains more than one 'sysupgrade-*' directory.
local board_dir="$(tar t${gz}f "$tar_file" | grep -m 1 '^sysupgrade-.*/$')"
@@ -329,6 +330,7 @@ nand_upgrade_tar() {
ubi_kernel_length="$kernel_length"
fi
fi
+
local has_env=0
nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "$ubi_kernel_length" "$has_env" || return 1
@@ -340,8 +342,14 @@ nand_upgrade_tar() {
fi
if [ "$kernel_length" ]; then
if [ "$kernel_mtd" ]; then
- tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
- mtd write - "$CI_KERNPART"
+ if [ "$jffs2_markers" = 1 ]; then
+ flash_erase -j "/dev/mtd${kernel_mtd}" 0 0
+ tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
+ nandwrite "/dev/mtd${kernel_mtd}" -
+ else
+ tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
+ mtd write - "$CI_KERNPART"
+ fi
else
local ubidev="$( nand_find_ubi "${CI_KERN_UBIPART:-$CI_UBIPART}" )"
local kern_ubivol="$( nand_find_volume $ubidev "$CI_KERNPART" )"