summaryrefslogtreecommitdiff
path: root/recipes-core/initrdscripts
diff options
context:
space:
mode:
authorMykyta Dorokhin <mykyta.dorokhin@globallogic.com>2020-11-24 07:31:40 +0200
committerJohn Klug <john.klug@multitech.com>2020-11-24 11:58:46 -0600
commit47b085f1dc14f2fc151a9ef2417feb6023719bcc (patch)
treec83eec57f7b51db52c6351f8232dc30cfe497b96 /recipes-core/initrdscripts
parent5a1112de7f6b4e7588aac834f2f9bac361008afa (diff)
downloadmeta-mlinux-47b085f1dc14f2fc151a9ef2417feb6023719bcc.tar.gz
meta-mlinux-47b085f1dc14f2fc151a9ef2417feb6023719bcc.tar.bz2
meta-mlinux-47b085f1dc14f2fc151a9ef2417feb6023719bcc.zip
mtk: erase user_data partition on mount error.
Diffstat (limited to 'recipes-core/initrdscripts')
-rwxr-xr-xrecipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh
index 9402286..a1c7244 100755
--- a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh
+++ b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh
@@ -272,7 +272,18 @@ mount_and_boot() {
log "user_data: $MOUNT $ROOT_RWMOUNTPARAMS $ROOT_RWMOUNT"
# Mount read-write file system into initram root file system
if ! $MOUNT $ROOT_RWMOUNTPARAMS $ROOT_RWMOUNT ; then
- fatal "Could not mount read-write rootfs"
+ if [ -n "${ROOT_RWDEVICE}" ]; then
+ # fsck didn't help. Reformat the partition
+ log "Could not mount read-write rootfs. Erasing ${ROOT_RWDEVICE} partition."
+ mkfs.ext4 -L user_data -O 64bit ${ROOT_RWDEVICE}
+ log "mounting user_data: $MOUNT $ROOT_RWMOUNTPARAMS $ROOT_RWMOUNT"
+ if ! $MOUNT $ROOT_RWMOUNTPARAMS $ROOT_RWMOUNT ; then
+ fatal "Could not mount read-write rootfs."
+ fi
+ log "${ROOT_RWDEVICE} partition has been erased and mounted successfully."
+ else
+ fatal "Could not mount read-write rootfs."
+ fi
fi
# Reset read-write file system if specified