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>]"
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
--without-udev)
USE_UDEV=
;;
+ --without-dmraid)
+ USE_DMRAID=
+ ;;
--with=*)
BASICMODULES="$BASICMODULES `echo $1 | awk -F= '{print $2;}'`"
;;
fi
if [ "$pack_version" -lt "002006" ] ; then
- USE_UDEV=
+ USE_UDEV=
+ USE_DMRAID=
fi
[ -z "$USE_UDEV" ] && UDEV_TMPFS=
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
mkdir /dev/shm
EOF
fi
- cat >> "$s" << EOF
+ cat >> "$s" <<-EOF
mount -t proc none /proc
echo Starting udev
/sbin/udevstart
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..."
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