From: Arkadiusz Miƛkiewicz Date: Sat, 25 Sep 2004 13:19:43 +0000 (+0000) Subject: Support for /dev managing by udev. X-Git-Tag: 6838~21 X-Git-Url: https://git.pld-linux.org/?a=commitdiff_plain;h=1606e3434e7902bc4331655648445de6f9e601ae;p=projects%2Fgeninitrd.git Support for /dev managing by udev. svn-id: @4648 --- 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 ]" echo " [--with=] [--image-version] [--fstab=] [--nocompress]" echo " [--initrdfs=rom|ext2|cram] [--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 " " 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