[readonly/geninitrd/devel: 241/334] Support for /dev managing by udev.

draenog draenog at pld-linux.org
Sat Nov 2 19:31:48 CET 2013


commit 1606e3434e7902bc4331655648445de6f9e601ae
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Sep 25 13:19:43 2004 +0000

    Support for /dev managing by udev.
    
    svn-id: @4648

 geninitrd | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)
---
diff --git a/geninitrd b/geninitrd
index 1a94d22..947bc62 100755
--- a/geninitrd
+++ b/geninitrd
@@ -43,12 +43,18 @@ rootdev_nr=0
 # default bootsplash is off, if it have to be on, install bootsplash package
 BOOT_SPLASH=no
 
+if [ -f /etc/udev/udev.conf -a -x /sbin/udev.static ]; then
+	USE_UDEV="yes"
+	UDEV_TMPFS="yes"
+	. /etc/udev/udev.conf
+fi
+			    
 usage () {
 	echo "usage: `basename $0` [--version] [-v] [-f] [--ifneeded] [--preload <module>]" 
 	echo "       [--with=<module>] [--image-version] [--fstab=<fstab>] [--nocompress]" 
 	echo "       [--initrdfs=rom|ext2|cram] [--modules-conf=<modules.conf>]" 
 	echo "       [--with-raidstart] [--without-raidstart] [--with-insmod-static]" 
-	echo "       [--without-bootsplash] [--lvmtoolsversion=1|2]" 
+	echo "       [--without-bootsplash] [--lvmtoolsversion=1|2] [--without-udev]"
 	echo "       <initrd-image> <kernel-version>" 
 	echo "       (ex: `basename $0` /boot/initrd-2.2.5-15.img 2.2.5-15)" 
 	exit 1
@@ -740,6 +746,9 @@ while [ $# -gt 0 ]; do
 		LVMTOOLSVERSION="$2"
 		shift
 		;;
+	--without-udev)
+		USE_UDEV=
+		;;
 	--with=*)
 		BASICMODULES="$BASICMODULES `echo $1 | awk -F= '{print $2;}'`"
 		;;
@@ -827,6 +836,11 @@ if [ "x" = "x$INITRDFS" ] ; then
 	fi
 fi
 
+if [ "$pack_version" -lt "002006" ] ; then
+    	USE_UDEV=
+fi
+[ -z "$USE_UDEV" ] && UDEV_TMPFS=
+    
 if [ "$pack_version" -ge "002005" ] ; then
 	modext=".ko"
 	insmod="insmod"
@@ -1039,6 +1053,37 @@ umount /proc
 EOF
 }
 
+initrd_gen_udev() {
+    	[ -n "$verbose" ] && echo "Setting up udev..."
+	mkdir -p $MNTIMAGE/sbin
+	mkdir -p $MNTIMAGE/etc/udev
+	
+	inst /sbin/initrd-udev $MNTIMAGE/sbin/udev
+	ln -s udev $MNTIMAGE/sbin/udevstart
+	inst /etc/udev/udev.conf $MNTIMAGE/etc/udev/udev.conf
+
+	ln -s udev $MNTIMAGE/sbin/hotplug
+
+	if is_yes "$USE_UDEV"; then
+		if is_yes "$UDEV_TMPFS"; then
+		    cat >> "$s" << EOF
+echo Creating /dev
+mount -o mode=0755 -t tmpfs none /dev
+mknod /dev/console c 5 1
+mknod /dev/null c 1 3
+mknod /dev/zero c 1 5
+mkdir /dev/pts
+mkdir /dev/shm
+EOF
+		fi
+		cat >> "$s" << EOF
+echo Starting udev
+/sbin/udevstart
+echo -n "/sbin/hotplug" > /proc/sys/kernel/hotplug
+EOF
+	fi
+}
+
 initrd_gen_softraid() {
 	[ -n "$verbose" ] && echo "Setting up mdadm..."
 	
@@ -1206,6 +1251,11 @@ EOF
 }
 
 # main generation
+
+if is_yes "$USE_UDEV"; then
+	initrd_gen_udev
+fi
+
 if is_yes "$USESUSPEND"; then
 	initrd_gen_suspend
 fi
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/398807324938659207036e520c0950a61ef50c11



More information about the pld-cvs-commit mailing list