[OE-core] [PATCH 05/10] initramfs-framework: support mounting rootfs in modules
Patrick Ohly
patrick.ohly at intel.com
Wed Sep 2 15:48:41 UTC 2015
The "finish" script always expected to mount the rootfs itself if the
"root" parameter was set. Now it checks first whether the rootfs
directory is still empty (using /dev as indicator, because that was
already expected to be present in a supported rootfs) and skips that
step if non-empty.
This allows modules to implement their own rootfs handling.
Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
---
.../initrdscripts/initramfs-framework/finish | 33 +++++++++++++---------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/finish b/meta/recipes-core/initrdscripts/initramfs-framework/finish
index 325f47b..fa566b1 100755
--- a/meta/recipes-core/initrdscripts/initramfs-framework/finish
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish
@@ -8,23 +8,28 @@ finish_enabled() {
finish_run() {
if [ -n "$ROOTFS_DIR" ]; then
- if [ -n "$bootparam_rootdelay" ]; then
- debug "Sleeping for $rootdelay second(s) to wait root to settle..."
- sleep $bootparam_rootdelay
- fi
+ # If $ROOTFS_DIR is non-empty, then some other module has already found
+ # the rootfs. We check for /dev because that was already expected to be
+ # in the rootfs.
+ if [ ! -d $ROOTFS_DIR/dev ]; then
+ if [ -n "$bootparam_rootdelay" ]; then
+ debug "Sleeping for $rootdelay second(s) to wait root to settle..."
+ sleep $bootparam_rootdelay
+ fi
- if [ -n "$bootparam_root" ]; then
- debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..."
+ if [ -n "$bootparam_root" ]; then
+ debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..."
- if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then
- root_uuid=`echo $bootparam_root | cut -c6-`
- bootparam_root="/dev/disk/by-uuid/$root_uuid"
- fi
+ if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then
+ root_uuid=`echo $bootparam_root | cut -c6-`
+ bootparam_root="/dev/disk/by-uuid/$root_uuid"
+ fi
- if [ -e "$bootparam_root" ]; then
- mount $bootparam_root $ROOTFS_DIR
- else
- debug "root '$bootparam_root' doesn't exist."
+ if [ -e "$bootparam_root" ]; then
+ mount $bootparam_root $ROOTFS_DIR
+ else
+ debug "root '$bootparam_root' doesn't exist."
+ fi
fi
fi
--
2.1.4
More information about the Openembedded-core
mailing list