SVN: geninitrd/trunk: geninitrd mod-udev.sh

arekm arekm at pld-linux.org
Mon Mar 18 12:05:10 CET 2013


Author: arekm
Date: Mon Mar 18 12:05:09 2013
New Revision: 12635

Modified:
   geninitrd/trunk/geninitrd
   geninitrd/trunk/mod-udev.sh
Log:
Make sure initial permissions for /dev/ nodes are correct since recent udev versions leave inherited permissions (thus invalid sometimes eg busybox mdev set /dev/null mode to 660).

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Mon Mar 18 12:05:09 2013
@@ -171,14 +171,14 @@
 		: 'Creating /dev'
 		if ! mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev > /dev/null 2>&1; then
 			mount -o mode=0755,nosuid -t tmpfs tmpfs /dev
-			mknod /dev/console c 5 1
-			mknod /dev/null c 1 3
-			mknod /dev/zero c 1 5
-			mknod /dev/random c 1 8
-			mknod /dev/snapshot c 10 231
-			mknod /dev/urandom c 1 9
-			mknod /dev/ptmx c 5 2
-			mknod /dev/kmsg c 1 11
+			mknod -m 600 /dev/console c 5 1
+			mknod -m 666 /dev/null c 1 3
+			mknod -m 666 /dev/zero c 1 5
+			mknod -m 666 /dev/random c 1 8
+			mknod -m 600 /dev/snapshot c 10 231
+			mknod -m 666 /dev/urandom c 1 9
+			mknod -m 666 /dev/ptmx c 5 2
+			mknod -m 644 /dev/kmsg c 1 11
 		fi
 		mkdir /dev/pts
 		mkdir /dev/shm

Modified: geninitrd/trunk/mod-udev.sh
==============================================================================
--- geninitrd/trunk/mod-udev.sh	(original)
+++ geninitrd/trunk/mod-udev.sh	Mon Mar 18 12:05:09 2013
@@ -110,6 +110,35 @@
 	busybox_applet mdev
 	ln -s busybox $DESTDIR/bin/mdev
 
+	cat > $DESTDIR/etc/mdev.conf	<<-'EOF'
+# Provide user, group, and mode information for devices.  If a regex matches
+# the device name provided by sysfs, use the appropriate user:group and mode
+# instead of the default 0:0 660.
+#
+# Syntax:
+# %s %d:%d %s
+# devicename_regex user:group mode
+
+null		0:0 666
+zero		0:0 666
+urandom		0:0 444
+
+kmem		0:9 000
+mem		0:9 640
+port		0:9 640
+
+console		0:5 600
+ptmx		0:5 660
+tty[0-9]*	0:5 660
+
+ttyS[0-9]*	0:20 640
+
+fd[0-9]*	0:11 660
+
+sd[a-z]*	0:6 660
+hd[a-z]*	0:6 660
+	EOF
+
 	mount_dev
 	mount_sys
 	mount_run


More information about the pld-cvs-commit mailing list