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>
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';