]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
- add dmraid support, needs udev as it creates nodes on /dev 6838
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 17 Jan 2006 22:11:27 +0000 (22:11 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Tue, 17 Jan 2006 22:11:27 +0000 (22:11 +0000)
- probably udev support should be improved to copy config to initrd so the nodes correspond to ones configured in host
  currently customised udev in host has no effect on initrd

svn-id: @6838

geninitrd

index 8b26cca496d19a11ffa5ebaf0b47d1cf5a546dc7..d1e603ad588e7c95979175c27d9ede84d64cdc59 100755 (executable)
--- a/geninitrd
+++ b/geninitrd
@@ -48,6 +48,10 @@ if [ -f /etc/udev/udev.conf -a -x /sbin/initrd-udev ]; then
        UDEV_TMPFS="yes"
        . /etc/udev/udev.conf
 fi
+
+if [ -x /sbin/dmraid-initrd ]; then
+       USE_DMRAID="yes"
+fi
                            
 usage () {
        echo "usage: `basename $0` [--version] [-v] [-f] [--ifneeded] [--preload <module>]" 
@@ -55,7 +59,7 @@ usage () {
        echo "       [--initrdfs=rom|ext2|cram] [--modules-conf=<modules.conf>]" 
        echo "       [--with-raidstart] [--without-raidstart] [--with-insmod-static]" 
        echo "       [--without-bootsplash] [--lvmtoolsversion=1|2] [--without-udev]"
-       echo "       [--without-suspend]"
+       echo "       [--without-suspend] [--without-dmraid]"
        echo "       <initrd-image> <kernel-version>" 
        echo "       (ex: `basename $0` /boot/initrd-2.2.5-15.img 2.2.5-15)" 
        exit 1
@@ -764,6 +768,9 @@ while [ $# -gt 0 ]; do
        --without-udev)
                USE_UDEV=
                ;;
+       --without-dmraid)
+               USE_DMRAID=
+               ;;
        --with=*)
                BASICMODULES="$BASICMODULES `echo $1 | awk -F= '{print $2;}'`"
                ;;
@@ -852,7 +859,8 @@ if [ "x" = "x$INITRDFS" ] ; then
 fi
 
 if [ "$pack_version" -lt "002006" ] ; then
-       USE_UDEV=
+       USE_UDEV=
+       USE_DMRAID=
 fi
 [ -z "$USE_UDEV" ] && UDEV_TMPFS=
     
@@ -1082,7 +1090,7 @@ initrd_gen_udev() {
 
        if is_yes "$USE_UDEV"; then
                if is_yes "$UDEV_TMPFS"; then
-                   cat >> "$s" << EOF
+                   cat >> "$s" <<-EOF
 echo Creating /dev
 mount -o mode=0755 -t tmpfs none /dev
 mknod /dev/console c 5 1
@@ -1092,7 +1100,7 @@ mkdir /dev/pts
 mkdir /dev/shm
 EOF
                fi
-               cat >> "$s" << EOF
+               cat >> "$s" <<-EOF
 mount -t proc none /proc
 echo Starting udev
 /sbin/udevstart
@@ -1102,6 +1110,31 @@ EOF
        fi
 }
 
+initrd_gen_dmraid() {
+   if [ ! -x /sbin/dmraid-initrd ] ; then
+       echo "/sbin/dmraid-initrd is missing missing !"
+       exit 1
+   fi
+
+   if [ ! -x $MNTIMAGE/sbin/udev ]; then
+       echo "udev is needed on target initrd for dmraid to work!"
+       exit 1
+   fi
+
+   mkdir -p "$MNTIMAGE/sbin"
+   inst /sbin/dmraid-initrd $MNTIMAGE/sbin/dmraid
+cat <<-EOF >> "$s"
+       mount -t proc none /proc
+       mount -t sysfs none /sys
+       # 2 secs was enough for my system to initialize. but really this is udev issue?
+       usleep 2000000
+       /sbin/dmraid -ay -i
+       umount /sys
+       umount /proc
+EOF
+}
+
+
 initrd_gen_softraid() {
        [ -n "$verbose" ] && echo "Setting up mdadm..."
        
@@ -1279,6 +1312,10 @@ if is_yes "$USESUSPEND"; then
        initrd_gen_suspend
 fi
 
+if is_yes "$USE_DMRAID"; then
+       initrd_gen_dmraid
+fi
+
 if is_yes "$usenfs" ; then
        initrd_gen_nfs
 elif is_yes "$USERAIDSTART" && is_yes "$raidfound" ; then
This page took 0.050138 seconds and 4 git commands to generate.