Message ID | 20240626114715.70823-1-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: > This allows to override the mount options from fstab. We don't read the fstab. This allows to set options during the mount of the overlay storage device(/var as default). Quirin > > Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com> > --- > .../initramfs-overlay-hook/files/overlay.script.tmpl | 2 ++ > .../initramfs-overlay-hook/initramfs-overlay-hook_0.1.bb | 4 +++- > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl > index 2563dfd..42eb59c 100644 > --- a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl > +++ b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl > @@ -30,12 +30,14 @@ esac > ovl_partition_device="${INITRAMFS_OVERLAY_STORAGE_DEVICE}" > ovl_storage_path="${INITRAMFS_OVERLAY_STORAGE_PATH}" > ovl_lower_dirs="${INITRAMFS_OVERLAY_PATHS}" > +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}' )" > > if ! mountpoint -q "${rootmnt}${storage_mount_point}"; then > if ! mount -t $(get_fstype ${ovl_partition_device}) \ > + -o ${ovl_mount_option} \ > ${ovl_partition_device} \ > ${rootmnt}${storage_mount_point}; then > panic "Can't mount ${storage_mount_point} partition - overlay will not work!" > diff --git a/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.1.bb b/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.1.bb > index 2694766..955748f 100644 > --- a/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.1.bb > +++ b/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.1.bb > @@ -29,11 +29,13 @@ INITRAMFS_OVERLAY_STORAGE_PATH ??= "/var/local" > > # override this to switch to UUID or PARTUUID based mounts > INITRAMFS_OVERLAY_STORAGE_DEVICE ??= "/dev/disk/by-label/var" > +INITRAMFS_OVERLAY_MOUNT_OPTION ??= "defaults,nodev,nosuid,noexec" > > TEMPLATE_FILES = "overlay.script.tmpl" > TEMPLATE_VARS += " INITRAMFS_OVERLAY_STORAGE_PATH \ > INITRAMFS_OVERLAY_PATHS \ > - INITRAMFS_OVERLAY_STORAGE_DEVICE" > + INITRAMFS_OVERLAY_STORAGE_DEVICE \ > + INITRAMFS_OVERLAY_MOUNT_OPTION" > > DEBIAN_DEPENDS = "initramfs-tools, awk, coreutils, util-linux" >
> -----Original Message----- > From: Gylstorff, Quirin (T CED OES-DE) <quirin.gylstorff@siemens.com> > Sent: Mittwoch, 26. Juni 2024 15:20 > To: Kowalsky, Clara (T CED OES-DE) <clara.kowalsky@siemens.com>; Kiszka, > Jan (T CED) <jan.kiszka@siemens.com>; cip-dev@lists.cip-project.org > Subject: Re: [cip-dev][isar-cip-core][PATCH 1/2] initramfs-overlay-hook: Add > INITRAMFS_OVERLAY_MOUNT_OPTION > > > > On 6/26/24 1:47 PM, Clara Kowalsky wrote: > > This allows to override the mount options from fstab. > We don't read the fstab. This allows to set options during the mount of the > overlay storage device(/var as default). > > Quirin Alright, thank you. I sent v2. Clara > > > > Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com> > > --- > > .../initramfs-overlay-hook/files/overlay.script.tmpl | 2 ++ > > .../initramfs-overlay-hook/initramfs-overlay-hook_0.1.bb | 4 +++- > > 2 files changed, 5 insertions(+), 1 deletion(-) > > > > diff --git > > a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl > > b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl > > index 2563dfd..42eb59c 100644 > > --- > > a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl > > +++ b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tm > > +++ pl > > @@ -30,12 +30,14 @@ esac > > ovl_partition_device="${INITRAMFS_OVERLAY_STORAGE_DEVICE}" > > ovl_storage_path="${INITRAMFS_OVERLAY_STORAGE_PATH}" > > ovl_lower_dirs="${INITRAMFS_OVERLAY_PATHS}" > > +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}' )" > > > > if ! mountpoint -q "${rootmnt}${storage_mount_point}"; then > > if ! mount -t $(get_fstype ${ovl_partition_device}) \ > > + -o ${ovl_mount_option} \ > > ${ovl_partition_device} \ > > ${rootmnt}${storage_mount_point}; then > > panic "Can't mount ${storage_mount_point} partition - > overlay will not work!" > > diff --git > > a/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.1. > > bb > > b/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.1. > > bb > > index 2694766..955748f 100644 > > --- > > a/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.1. > > bb > > +++ b/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_ > > +++ 0.1.bb > > @@ -29,11 +29,13 @@ INITRAMFS_OVERLAY_STORAGE_PATH ??= > "/var/local" > > > > # override this to switch to UUID or PARTUUID based mounts > > INITRAMFS_OVERLAY_STORAGE_DEVICE ??= "/dev/disk/by-label/var" > > +INITRAMFS_OVERLAY_MOUNT_OPTION ??= > "defaults,nodev,nosuid,noexec" > > > > TEMPLATE_FILES = "overlay.script.tmpl" > > TEMPLATE_VARS += " INITRAMFS_OVERLAY_STORAGE_PATH \ > > INITRAMFS_OVERLAY_PATHS \ > > - INITRAMFS_OVERLAY_STORAGE_DEVICE" > > + INITRAMFS_OVERLAY_STORAGE_DEVICE \ > > + INITRAMFS_OVERLAY_MOUNT_OPTION" > > > > DEBIAN_DEPENDS = "initramfs-tools, awk, coreutils, util-linux" > >
diff --git a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl index 2563dfd..42eb59c 100644 --- a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl +++ b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl @@ -30,12 +30,14 @@ esac ovl_partition_device="${INITRAMFS_OVERLAY_STORAGE_DEVICE}" ovl_storage_path="${INITRAMFS_OVERLAY_STORAGE_PATH}" ovl_lower_dirs="${INITRAMFS_OVERLAY_PATHS}" +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}' )" if ! mountpoint -q "${rootmnt}${storage_mount_point}"; then if ! mount -t $(get_fstype ${ovl_partition_device}) \ + -o ${ovl_mount_option} \ ${ovl_partition_device} \ ${rootmnt}${storage_mount_point}; then panic "Can't mount ${storage_mount_point} partition - overlay will not work!" diff --git a/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.1.bb b/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.1.bb index 2694766..955748f 100644 --- a/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.1.bb +++ b/recipes-initramfs/initramfs-overlay-hook/initramfs-overlay-hook_0.1.bb @@ -29,11 +29,13 @@ INITRAMFS_OVERLAY_STORAGE_PATH ??= "/var/local" # override this to switch to UUID or PARTUUID based mounts INITRAMFS_OVERLAY_STORAGE_DEVICE ??= "/dev/disk/by-label/var" +INITRAMFS_OVERLAY_MOUNT_OPTION ??= "defaults,nodev,nosuid,noexec" TEMPLATE_FILES = "overlay.script.tmpl" TEMPLATE_VARS += " INITRAMFS_OVERLAY_STORAGE_PATH \ INITRAMFS_OVERLAY_PATHS \ - INITRAMFS_OVERLAY_STORAGE_DEVICE" + INITRAMFS_OVERLAY_STORAGE_DEVICE \ + INITRAMFS_OVERLAY_MOUNT_OPTION" DEBIAN_DEPENDS = "initramfs-tools, awk, coreutils, util-linux"
This allows to override the mount options from fstab. Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com> --- .../initramfs-overlay-hook/files/overlay.script.tmpl | 2 ++ .../initramfs-overlay-hook/initramfs-overlay-hook_0.1.bb | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-)