[OE-core] [PATCH] udev: Don't remount root filesystem under /media

Andy Ross andy.ross at windriver.com
Fri Aug 10 19:00:55 UTC 2012


The existing logic to avoid mounting already-mounted filesystems
breaks for a kernel-mounted root, which appears as /dev/root in
/proc/mounts.  The effect is that an image booted with
e.g. "root=/dev/mmcblk0p1" will find its root filesystem remount rw
under /media/mmcblk0p1 at boot.

Signed-off-by: Andy Ross <andy.ross at windriver.com>
---
 meta/recipes-core/udev/udev/mount.sh | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-core/udev/udev/mount.sh b/meta/recipes-core/udev/udev/mount.sh
index c13b8bb..61d14a3 100644
--- a/meta/recipes-core/udev/udev/mount.sh
+++ b/meta/recipes-core/udev/udev/mount.sh
@@ -49,9 +49,15 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ]; then
 	elif [ -x $MOUNT ]; then
     		$MOUNT $DEVNAME 2> /dev/null
 	fi
-	
-	# If the device isn't mounted at this point, it isn't configured in fstab
-	grep -q "^$DEVNAME " /proc/mounts || automount
+
+	# If the device isn't mounted at this point, it isn't
+	# configured in fstab (note the root filesystem shows up as
+	# /dev/root in /proc/mounts, so parse the command line for
+	# that case)
+	root=`sed 's/\(^\|.* \)root=\([^ ]*\).*/\2/' /proc/cmdline`
+	if [ "$root" != "$DEVNAME" ]; then
+		grep -q "^$DEVNAME " /proc/mounts || automount
+	fi
 fi
 
 
-- 
1.7.11.2





More information about the Openembedded-core mailing list