Message ID | 20240626114715.70823-2-clara.kowalsky@siemens.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [isar-cip-core,1/2] initramfs-overlay-hook: Add INITRAMFS_OVERLAY_MOUNT_OPTION | expand |
On 6/26/24 1:47 PM, Clara Kowalsky wrote: > In case of ext*, this detects and fixes file system errors in the > partition device before doing the partition mount. > > Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com> > --- > .../initramfs-overlay-hook/files/overlay.hook | 5 +++-- > .../initramfs-overlay-hook/files/overlay.script.tmpl | 8 +++++++- > 2 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/recipes-initramfs/initramfs-overlay-hook/files/overlay.hook b/recipes-initramfs/initramfs-overlay-hook/files/overlay.hook > index 8b00ecf..7a9f737 100644 > --- a/recipes-initramfs/initramfs-overlay-hook/files/overlay.hook > +++ b/recipes-initramfs/initramfs-overlay-hook/files/overlay.hook > @@ -23,5 +23,6 @@ esac > . /usr/share/initramfs-tools/hook-functions > > manual_add_modules overlay > -copy_exec /usr/bin/mountpoint > -copy_exec /usr/bin/awk > +copy_exec /usr/bin/mountpoint || hook_error "/usr/bin/mountpoint not found" Where is hook_error defined? This is a self defined function from the encrypt partition initramfs recipe. Quirin > +copy_exec /usr/bin/awk || hook_error "/usr/bin/awk not found" > +copy_exec /usr/sbin/e2fsck || hook_error "/usr/sbin/e2fsck not found" > diff --git a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl > index 42eb59c..6b404c6 100644 > --- a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl > +++ b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl > @@ -34,9 +34,15 @@ ovl_mount_option="${INITRAMFS_OVERLAY_MOUNT_OPTION}" > > root_mount_storage=${rootmnt}${ovl_storage_path} > storage_mount_point="$(echo "${ovl_storage_path}" | awk -F/ '{print FS$2}' )" > +partition_fstype=$(get_fstype "${ovl_partition_device}") > > if ! mountpoint -q "${rootmnt}${storage_mount_point}"; then > - if ! mount -t $(get_fstype ${ovl_partition_device}) \ > + if [ $partition_fstype = "ext*" ]; then > + if ! e2fsck -p -f "$partition_fstype"; then > + panic "E2fsck on ${ovl_partition_device} not successful!" > + fi > + fi > + if ! mount -t ${partition_fstype} \ > -o ${ovl_mount_option} \ > ${ovl_partition_device} \ > ${rootmnt}${storage_mount_point}; then
diff --git a/recipes-initramfs/initramfs-overlay-hook/files/overlay.hook b/recipes-initramfs/initramfs-overlay-hook/files/overlay.hook index 8b00ecf..7a9f737 100644 --- a/recipes-initramfs/initramfs-overlay-hook/files/overlay.hook +++ b/recipes-initramfs/initramfs-overlay-hook/files/overlay.hook @@ -23,5 +23,6 @@ esac . /usr/share/initramfs-tools/hook-functions manual_add_modules overlay -copy_exec /usr/bin/mountpoint -copy_exec /usr/bin/awk +copy_exec /usr/bin/mountpoint || hook_error "/usr/bin/mountpoint not found" +copy_exec /usr/bin/awk || hook_error "/usr/bin/awk not found" +copy_exec /usr/sbin/e2fsck || hook_error "/usr/sbin/e2fsck not found" diff --git a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl index 42eb59c..6b404c6 100644 --- a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl +++ b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl @@ -34,9 +34,15 @@ ovl_mount_option="${INITRAMFS_OVERLAY_MOUNT_OPTION}" root_mount_storage=${rootmnt}${ovl_storage_path} storage_mount_point="$(echo "${ovl_storage_path}" | awk -F/ '{print FS$2}' )" +partition_fstype=$(get_fstype "${ovl_partition_device}") if ! mountpoint -q "${rootmnt}${storage_mount_point}"; then - if ! mount -t $(get_fstype ${ovl_partition_device}) \ + if [ $partition_fstype = "ext*" ]; then + if ! e2fsck -p -f "$partition_fstype"; then + panic "E2fsck on ${ovl_partition_device} not successful!" + fi + fi + if ! mount -t ${partition_fstype} \ -o ${ovl_mount_option} \ ${ovl_partition_device} \ ${rootmnt}${storage_mount_point}; then
In case of ext*, this detects and fixes file system errors in the partition device before doing the partition mount. Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com> --- .../initramfs-overlay-hook/files/overlay.hook | 5 +++-- .../initramfs-overlay-hook/files/overlay.script.tmpl | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-)