SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Tue Nov 13 17:22:42 CET 2007


Author: glen
Date: Tue Nov 13 17:22:41 2007
New Revision: 9041

Modified:
   geninitrd/trunk/geninitrd
Log:
- parse root=/dev/sys/rootfs from kernel commandline for lvm2

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Tue Nov 13 17:22:41 2007
@@ -1314,10 +1314,23 @@
 		initrd_gen_devices
 
 		add_linuxrc <<-EOF
-			export LVM_ROOTDEV=$rootdev
-			export LVM_VGVOLUME=$VGVOLUME
+			export ROOTDEV=$rootdev
+			export VGVOLUME=$VGVOLUME
 		EOF
 		add_linuxrc <<-'EOF'
+			# parse rootdev from kernel commandline
+			for arg in $CMDLINE; do
+				if [ "${arg##root=}" != "${arg}" ]; then
+					ROOTDEV=${arg##root=}
+					echo "Using $ROOTDEV from kernel commandline"
+					local tmp=${ROOTDEV#/dev/}
+					if [ "$tmp" != "$ROOTDEV" ]; then
+						VGVOLUME=${tmp%/*}
+						echo "Using $VGVOLUME LVM Volume Group from kernel commandline"
+					fi
+				fi
+			done
+
 			# disable noise from LVM accessing devices that aren't ready.
 			read printk < /proc/sys/kernel/printk
 			echo 0 > /proc/sys/kernel/printk
@@ -1327,14 +1340,14 @@
 			lvm.static vgscan --mknodes --ignorelockingfailure 2>/dev/null
 
 			: 'Activating Volume Groups'
-			lvm.static vgchange --ignorelockingfailure -a y $LVM_VGVOLUME 2>/dev/null
+			lvm.static vgchange --ignorelockingfailure -a y $VGVOLUME 2>/dev/null
 
 			echo "$printk" > /proc/sys/kernel/printk
 
 			# Find out major/minor
-			attrs="$(lvm.static lvdisplay --ignorelockingfailure -c $LVM_ROOTDEV 2>/dev/null)"
+			attrs="$(lvm.static lvdisplay --ignorelockingfailure -c $ROOTDEV 2>/dev/null)"
 			if [ "$attrs" ]; then
-				majmin="${attrs#*$LVM_ROOTDEV*:*:*:*:*:*:*:*:*:*:*:*}"
+				majmin="${attrs#*$ROOTDEV*:*:*:*:*:*:*:*:*:*:*:*}"
 				if [ "$majmin" != "$attrs" ]; then
 					major="${majmin%:*}"
 					minor="${majmin#*:}"
@@ -1345,7 +1358,7 @@
 				# Pass it to kernel
 				echo $((256 * $major + $minor)) > /proc/sys/kernel/real-root-dev
 			else
-				echo 2>&1 "Error figuring out real root device for $LVM_ROOTDEV!"
+				echo 2>&1 "Error figuring out real root device for $ROOTDEV!"
 				echo 2>&1 "System will not most likely boot up! So dropping you to a shell!"
 				echo 2>&1 ""
 				sh


More information about the pld-cvs-commit mailing list