From: Stefan Agner <[email protected]>

Instead of checking for existence of /dev in the mounted file system use
mountpoint to check if a root file system has been mounted. This allows
to use the rootfs module for OSTree based rootfs as well, where the file
system rootfs does not have any of the regular directories (at least
when using the modern layout).

Signed-off-by: Stefan Agner <[email protected]>
---
Note that the finish module is checking for existence of /dev again, but
we are not using this module for the OSTree case.

Another alternative to this patch would be to check for lost+found, which
I found a bit ad-hoc as well.

We could also check the exit code of the mount command, but I am not sure
if that is a reliable way. mount(8) documents two exit code which sound
like mount has succeeded (0 and 64, "some mount succeeded"). Also, if we
want to retain the option that a module before the rootfs module mounts
$ROOTFS_DIR, we would still have to use a mountpoint check.

 meta/recipes-core/initrdscripts/initramfs-framework/rootfs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/rootfs 
b/meta/recipes-core/initrdscripts/initramfs-framework/rootfs
index 748c9391c0..ee24e82af3 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework/rootfs
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/rootfs
@@ -13,7 +13,7 @@ rootfs_run() {
        C=0
        delay=${bootparam_rootdelay:-1}
        timeout=${bootparam_roottimeout:-5}
-       while [ ! -d $ROOTFS_DIR/dev ]; do
+       while ! mountpoint -q $ROOTFS_DIR; do
                if [ $(( $C * $delay )) -gt $timeout ]; then
                        fatal "root '$bootparam_root' doesn't exist or does not 
contain a /dev."
                fi
@@ -61,7 +61,7 @@ rootfs_run() {
                                        flags="$flags -t$bootparam_rootfstype"
                                fi
                                mount $flags $bootparam_root $ROOTFS_DIR
-                               if [ -d $ROOTFS_DIR/dev ]; then
+                               if mountpoint -q $ROOTFS_DIR; then
                                        break
                                else
                                        # It is unlikely to change, but keep 
trying anyway.
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#139188): 
https://lists.openembedded.org/g/openembedded-core/message/139188
Mute This Topic: https://lists.openembedded.org/mt/74657708/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to