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>
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;