[readonly/geninitrd/devel: 218/334] LVM2: wipe out mount && pivot_root and welcome /proc/sys/kernel/real-root-dev.

draenog draenog at pld-linux.org
Sat Nov 2 19:29:51 CET 2013


commit 91ed0242bcbfd65bb58e7226548f42a31ba12326
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Jun 24 20:01:24 2004 +0000

    LVM2: wipe out mount && pivot_root and welcome /proc/sys/kernel/real-root-dev.
    
    svn-id: @4242

 geninitrd | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index a6daaef..b16ec15 100755
--- a/geninitrd
+++ b/geninitrd
@@ -637,8 +637,6 @@ find_modules_for() {
 		fi
 		if [ "$LVMTOOLSVERSION" = "2" ]; then
     		    findmodule "-dm-mod"
-		    echo "Remember to use \`root=/dev/ram0 init=/linuxrc' when starting kernel" >&2
-		    echo "or you will have problems like init(xx) being child process of swapper(1)." >&2
 		elif [ "$LVMTOOLSVERSION" = "1" ]; then
     		    findmodule "-lvm"
     		    findmodule "-lvm-mod"
@@ -1112,14 +1110,23 @@ if is_yes "$uselvm" ; then
 		echo "}" >> "$MNTIMAGE/etc/lvm.conf"
 		echo "LVM_SYSTEM_DIR=/tmp lvm vgscan --ignorelockingfailure" >> "$s"
 		echo "LVM_SYSTEM_DIR=/tmp lvm vgchange --ignorelockingfailure -a y $VGVOLUME" >> "$s"
-		echo "mount -n -o ro $org_rootdev /newroot" >> "$s"
+		# Find out major/minor
+		echo "majmin=\"\`LVM_SYSTEM_DIR=/tmp lvm lvdisplay --ignorelockingfailure -c $org_rootdev\`\"" >> "$s"
+		echo "majmin=\"\${majmin#*/}\"" >> "$s"
+		echo "majmin=\"\${majmin#*:*:*:*:*:*:*:*:*:*:*:*}\"" >> "$s"
+		echo "major=\"\${majmin%:*}\"" >> "$s"
+		echo "minor=\"\${majmin#*:}\"" >> "$s"
+		# Pass it to kernel
+		echo "val=\$((256 * \$major + \$minor))" >> "$s"
+		echo "echo \$val > /proc/sys/kernel/real-root-dev" >> "$s"
 		echo "umount /tmp" >> "$s"
 		echo "umount /dev" >> "$s"
 		echo "umount /proc" >> "$s"
-	        echo "cd /newroot" >> "$s"
-	        echo "pivot_root . initrd" >> "$s"
-	        echo "[ -x /sbin/chroot ] && exec /sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1" >> "$s"
-		echo "exec /usr/sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1" >> "$s"
+#		echo "mount -n -o ro $org_rootdev /newroot" >> "$s"
+#	        echo "cd /newroot" >> "$s"
+#	        echo "pivot_root . initrd" >> "$s"
+#	        echo "[ -x /sbin/chroot ] && exec /sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1" >> "$s"
+#		echo "exec /usr/sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1" >> "$s"
 	fi
 fi
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/398807324938659207036e520c0950a61ef50c11



More information about the pld-cvs-commit mailing list