From 882472aeed84c5f779a7ab70d46b11e29ae8bab8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 17 Jan 2006 22:11:27 +0000 Subject: [PATCH] - add dmraid support, needs udev as it creates nodes on /dev - 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 | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/geninitrd b/geninitrd index 8b26cca..d1e603a 100755 --- 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 ]" @@ -55,7 +59,7 @@ usage () { echo " [--initrdfs=rom|ext2|cram] [--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 " " 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 -- 2.44.0