[oe-commits] Patrick Ohly : initramfs-framework: support rootflags and rootfstype boot parameter

git at git.openembedded.org git at git.openembedded.org
Sat Sep 12 21:51:41 UTC 2015


Module: openembedded-core.git
Branch: master
Commit: b8ea1c61b4b8071edf70f5d42119c54ea84de330
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=b8ea1c61b4b8071edf70f5d42119c54ea84de330

Author: Patrick Ohly <patrick.ohly at intel.com>
Date:   Mon Sep  7 13:05:42 2015 +0200

initramfs-framework: support rootflags and rootfstype boot parameter

These two parameters are supported by the kernel
(https://www.kernel.org/doc/Documentation/kernel-parameters.txt). When
an initramfs is used, the kernel does not mount the rootfs and the
initramfs needs to react to them.

The boot parameters can be set both by the image creator and
by users.

Supporting these two parameters is useful:
- rootflags is needed to ensure that the rootfs is already mounted as
  intended in the time between starting init and init remounting
  it (as systemd does); this is critical for IMA where iversion must be
  active already when system starts writing files.
- setting it correctly up-front avoids messages from the kernel ("cannot
  mount ... as ext2 because ...") when trying to guess the desired type.

For example, assuming that only one of ext4/ext3/ext2 is set,
rootfstype could be set in an image recipe with:
APPEND_append = "${@''.join([' rootfstype=' + i for i in ['ext4', 'ext3', 'ext2'] if i in d.getVar('IMAGE_FSTYPES', True).split()])}"

Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>

---

 meta/recipes-core/initrdscripts/initramfs-framework/finish | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/finish b/meta/recipes-core/initrdscripts/initramfs-framework/finish
index 325f47b..006aef2 100755
--- a/meta/recipes-core/initrdscripts/initramfs-framework/finish
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish
@@ -22,7 +22,14 @@ finish_run() {
 			fi
 
 			if [ -e "$bootparam_root" ]; then
-				mount $bootparam_root $ROOTFS_DIR
+				flags=""
+				if [ -n "$bootparam_rootflags" ]; then
+					flags="$flags -o$bootparam_rootflags"
+				fi
+				if [ -n "$bootparam_rootfstype" ]; then
+					flags="$flags -t$bootparam_rootfstype"
+				fi
+				mount $flags $bootparam_root $ROOTFS_DIR
 			else
 				debug "root '$bootparam_root' doesn't exist."
 			fi



More information about the Openembedded-commits mailing list