[OE-core] [PATCH 3/3] initscripts: Handle mounting /dev in mountall.sh

Nathan Rossi nathan.rossi at xilinx.com
Tue Dec 9 05:50:07 UTC 2014


Setup mountall.sh to mount only /dev first. This is done first so that
the /dev/pts and /dev/shm directories can be created and subsequently be
mounted by the primary mount -a call.

This moves the common mounting proceedures contained in udev/mdev init
scripts into mountall.sh, allowing for a common definition of the /dev,
/dev/pts and /dev/shm mounts via /etc/fstab. This makes it easier for
machines/bsps to define custom mounts for /dev* via the fstab file.

Due to mountall.sh handling the mounting of /dev/pts the devpts.sh init
script is no longer needed. (note: /dev/ptmx is handled by devtmpfs) In
addition the /dev/pts interface is setup earlier than the devpts script
would previously setup, allowing for other rc scripts to use it earlier,
this is particularly important for bootlogd which was dependent on the
legacy pty setup which required a kernel to be built with
CONFIG_LEGACY_PTYS.

This change also allows for systems to run entirely on devtmpfs and have
no dependence on a dev manager. This is useful for very tightly
constrained setups.

Signed-off-by: Nathan Rossi <nathan.rossi at xilinx.com>
---
 meta/recipes-core/busybox/files/mdev               | 13 ----------
 .../initscripts/initscripts-1.0/devpts.sh          | 28 ----------------------
 .../initscripts/initscripts-1.0/mountall.sh        | 14 +++++++++++
 meta/recipes-core/initscripts/initscripts_1.0.bb   |  6 -----
 meta/recipes-core/udev/udev/init                   | 14 -----------
 5 files changed, 14 insertions(+), 61 deletions(-)
 delete mode 100755 meta/recipes-core/initscripts/initscripts-1.0/devpts.sh

diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
index 9625247..7d2c4d8 100755
--- a/meta/recipes-core/busybox/files/mdev
+++ b/meta/recipes-core/busybox/files/mdev
@@ -1,19 +1,6 @@
 #!/bin/sh
 
-mount -t tmpfs tmpfs /dev  -o size=64k,mode=0755
-mkdir /dev/pts /dev/shm
-chmod 777 /dev/shm
-mount -t devpts devpts /dev/pts
 touch /dev/mdev.seq
 echo "/sbin/mdev" > /proc/sys/kernel/hotplug
 mdev -s
 
-#
-# We might have mounted something over /dev, see if /dev/initctl is there.
-#
-if test ! -p /dev/initctl
-then
-        rm -f /dev/initctl
-        mknod -m 600 /dev/initctl p
-fi
-
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh b/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh
deleted file mode 100755
index c6043fb..0000000
--- a/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-### BEGIN INIT INFO
-# Provides:          devpts
-# Required-Start: udev
-# Required-Stop:
-# Default-Start:     S
-# Default-Stop:
-# Short-Description: Mount /dev/pts file systems.
-### END INIT INFO
-
-. /etc/default/devpts
-
-if grep -q devpts /proc/filesystems
-then
-	#
-	#	Create multiplexor device.
-	#
-	test -c /dev/ptmx || mknod -m 666 /dev/ptmx c 5 2
-
-	#
-	#	Mount /dev/pts if needed.
-	#
-	if ! grep -q devpts /proc/mounts
-	then
-		mkdir -p /dev/pts
-		mount -t devpts devpts /dev/pts -ogid=${TTYGRP},mode=${TTYMODE}
-	fi
-fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
index 94bae42..000102f 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
@@ -12,6 +12,20 @@
 . /etc/default/rcS
 
 #
+# Mount /dev/ filesystems in /etc/fstab. This needs to be done in order
+# to allow creation of directories which then have filesystems mounted
+# under /dev/.
+#
+test "$VERBOSE" != no && echo "Mounting /dev/ filesystem..."
+mount -a /dev 2>/dev/null
+
+#
+# Create the /dev/pts and /dev/shm directories for mounting.
+#
+[ -e /dev/pts ] || mkdir -m 0755 /dev/pts
+[ -e /dev/shm ] || mkdir -m 1777 /dev/shm
+
+#
 # Mount local filesystems in /etc/fstab. For some reason, people
 # might want to mount "proc" several times, and mount -v complains
 # about this. So we mount "proc" filesystems without -v.
diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
index afdc538..dccc406 100644
--- a/meta/recipes-core/initscripts/initscripts_1.0.bb
+++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
@@ -10,8 +10,6 @@ INHIBIT_DEFAULT_DEPS = "1"
 SRC_URI = "file://functions \
            file://halt \
            file://umountfs \
-           file://devpts.sh \
-           file://devpts \
            file://hostname.sh \
            file://mountall.sh \
            file://banner.sh \
@@ -89,8 +87,6 @@ do_install () {
 	install -m 0755    ${WORKDIR}/single		${D}${sysconfdir}/init.d
 	install -m 0755    ${WORKDIR}/umountnfs.sh	${D}${sysconfdir}/init.d
 	install -m 0755    ${WORKDIR}/urandom		${D}${sysconfdir}/init.d
-	install -m 0755    ${WORKDIR}/devpts.sh	${D}${sysconfdir}/init.d
-	install -m 0755    ${WORKDIR}/devpts		${D}${sysconfdir}/default
 	install -m 0755    ${WORKDIR}/sysfs.sh		${D}${sysconfdir}/init.d
 	install -m 0755    ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d
 	install -m 0755    ${WORKDIR}/read-only-rootfs-hook.sh ${D}${sysconfdir}/init.d
@@ -127,7 +123,6 @@ do_install () {
 	update-rc.d -r ${D} sysfs.sh start 02 S .
 	update-rc.d -r ${D} populate-volatile.sh start 37 S .
 	update-rc.d -r ${D} read-only-rootfs-hook.sh start 29 S .
-	update-rc.d -r ${D} devpts.sh start 38 S .
 	if [ "${TARGET_ARCH}" = "arm" ]; then
 	        update-rc.d -r ${D} alignment.sh start 06 S .
 	fi
@@ -141,7 +136,6 @@ MASKED_SCRIPTS = " \
   bootmisc \
   checkfs \
   checkroot \
-  devpts \
   dmesg \
   hostname \
   mountall \
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index d26cbfc..152d08f 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -42,20 +42,6 @@ case "$1" in
     # propagate /dev from /sys
     echo "Starting udev"
 
-    # Check for requireed devtmpfs before trying to start udev and
-    # mount a no-existant fs.
-    if ! grep -q devtmpfs /proc/filesystems
-    then
-        echo "Missing devtmpfs, which is required for udev to run";
-        echo "Halting..."
-        halt
-    fi
-    # mount the devtmpfs on /dev, if not already done
-    LANG=C awk '$2 == "/dev" && ($3 == "devtmpfs") { exit 1 }' /proc/mounts && {
-            mount -n -o mode=0755 -t devtmpfs none "/dev"
-    }
-    [ -e /dev/pts ] || mkdir -m 0755 /dev/pts
-    [ -e /dev/shm ] || mkdir -m 1777 /dev/shm
     # the automount rule for udev needs /tmp directory available, as /tmp is a symlink
     # to /var/tmp which in turn is a symlink to /var/volatile/tmp, we need to make sure
     # /var/volatile/tmp directory to be available.
-- 
2.1.1




More information about the Openembedded-core mailing list