summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Golle2024-01-15 17:47:46 +0000
committerDaniel Golle2024-01-15 20:53:46 +0000
commit2171f62615569bace6e53617480d8f233f8f3b94 (patch)
tree72da27b6e90a7cdb5c619eedee47154254a8f5fd
parent325d63d67006c5526ab9b0fbc62329da48aa93af (diff)
libfstools: force mkfs when formatting overlay
As the rootfs_overlay volume is dynamically allocated on platforms which allow for that, the start of the volume can end up being at the location of previously stored data. This can happen when writing an SD card image to an SD card previously used for something else. sysupgrade should always wipe preexisting data, but I haven't checked if all platform implementations actually always do so). As mkfs is cautious not to accidentally overwrite existing data, this can result in the system to hang on boot, waiting for confirmation on the serial console: mount_root: overlay filesystem in /dev/fitrw has not been formatted yet /dev/fitrw contains `ISO-8859 text, with very long lines (65536), with no line terminators' data Proceed anyway? (y,N) Use the FORCE option (-F for mkfs.ext4, -f for mkfs.f2fs) to make sure the volume is always formatted irrespective of its previous content. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--libfstools/common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libfstools/common.c b/libfstools/common.c
index e5b7bc3..6c513f0 100644
--- a/libfstools/common.c
+++ b/libfstools/common.c
@@ -164,9 +164,9 @@ int block_volume_format(struct volume *v, uint64_t offset, const char *bdev)
do_format:
ULOG_INFO("overlay filesystem in %s has not been formatted yet\n", v->blk);
if (use_f2fs(v, offset, bdev))
- snprintf(str, sizeof(str), "mkfs.f2fs -q -l rootfs_data %s", v->blk);
+ snprintf(str, sizeof(str), "mkfs.f2fs -q -f -l rootfs_data %s", v->blk);
else
- snprintf(str, sizeof(str), "mkfs.ext4 -q -L rootfs_data %s", v->blk);
+ snprintf(str, sizeof(str), "mkfs.ext4 -q -F -L rootfs_data %s", v->blk);
ret = system(str);
break;