]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
- parse root=/dev/sys/rootfs from kernel commandline for lvm2
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 13 Nov 2007 16:22:41 +0000 (16:22 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Tue, 13 Nov 2007 16:22:41 +0000 (16:22 +0000)
svn-id: @9041

geninitrd

index 2f1d89feea3dcd7b11d327853a57b9607537c498..f467ab346570f0d30803d955205cb1c52438d855 100755 (executable)
--- a/geninitrd
+++ b/geninitrd
@@ -1314,10 +1314,23 @@ initrd_gen_lvm() {
                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 @@ initrd_gen_lvm() {
                        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 @@ initrd_gen_lvm() {
                                # 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
This page took 0.040512 seconds and 4 git commands to generate.