]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
Support for /dev managing by udev.
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Sat, 25 Sep 2004 13:19:43 +0000 (13:19 +0000)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Sat, 25 Sep 2004 13:19:43 +0000 (13:19 +0000)
svn-id: @4648

geninitrd

index 1a94d22f3c593ce0ad7deeb46864cddbf2bd55cf..947bc62fb1f650835e16e9f0bc271c0324e508fa 100755 (executable)
--- 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
This page took 0.049727 seconds and 4 git commands to generate.