geninitrd/trunk/geninitrd

glen cvs at pld-linux.org
Tue Jan 17 23:11:39 CET 2006


Author: glen
Date: Tue Jan 17 23:11:27 2006
New Revision: 6838

Modified:
   geninitrd/trunk/geninitrd
Log:
- 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

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Tue Jan 17 23:11:27 2006
@@ -48,6 +48,10 @@
 	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 @@
 	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 @@
 	--without-udev)
 		USE_UDEV=
 		;;
+	--without-dmraid)
+		USE_DMRAID=
+		;;
 	--with=*)
 		BASICMODULES="$BASICMODULES `echo $1 | awk -F= '{print $2;}'`"
 		;;
@@ -852,7 +859,8 @@
 fi
 
 if [ "$pack_version" -lt "002006" ] ; then
-    	USE_UDEV=
+	USE_UDEV=
+	USE_DMRAID=
 fi
 [ -z "$USE_UDEV" ] && UDEV_TMPFS=
     
@@ -1082,7 +1090,7 @@
 
 	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/shm
 EOF
 		fi
-		cat >> "$s" << EOF
+		cat >> "$s" <<-EOF
 mount -t proc none /proc
 echo Starting udev
 /sbin/udevstart
@@ -1102,6 +1110,31 @@
 	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 @@
 	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


More information about the pld-cvs-commit mailing list