]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: do not append root=/dev/vda if passed via command line
authorDavid Ahern <dsahern@gmail.com>
Tue, 5 Apr 2011 16:04:13 +0000 (10:04 -0600)
committerPekka Enberg <penberg@kernel.org>
Tue, 5 Apr 2011 16:44:40 +0000 (19:44 +0300)
Hardcoding the root= option prevents an existing qemu-kvm based disk
image using LVM from booting. It fails to find the root filesystem.
By making the root parameter optional if given on the command line, the
image boots correctly. For example,

  ./kvm --kernel=/tmp/vmlinuz-2.6.38 \
        --initrd=/tmp/initramfs-2.6.38.img \
        --image=/home/dsa/vm/images/f14/nkvm-f14.img \
        --mem=1024
        --params="ro root=/dev/mapper/vg_f14vm-lv_root"

works now.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/main.c

index d70b4466bb6f1180d57e7ea6f223c31d0665624a..3165bc7489fd56ab689501c9123cdf35cbf1aa3f 100644 (file)
@@ -148,7 +148,10 @@ int main(int argc, char *argv[])
 
        kvm__setup_cpuid(kvm);
 
-       strcpy(real_cmdline, "notsc nolapic nosmp noacpi pci=conf1 console=ttyS0 root=/dev/vda rw ");
+       strcpy(real_cmdline, "notsc nolapic nosmp noacpi pci=conf1 console=ttyS0 ");
+       if (!kernel_cmdline || (strstr(kernel_cmdline, "root=") == NULL))
+               strlcat(real_cmdline, "root=/dev/vda rw ", sizeof(real_cmdline));
+
        if (kernel_cmdline) {
                strlcat(real_cmdline, kernel_cmdline, sizeof(real_cmdline));
                real_cmdline[sizeof(real_cmdline)-1] = '\0';