Hi Sergio,
On 8/29/2019 11:46 PM, Sergio Lopez wrote:
Jing Liu <jing2....@linux.intel.com> writes:
Hi Sergio,
The idea is interesting and I tried to launch a guest by your
guide but seems failed to me. I tried both legacy and normal modes,
but the vncviewer connected and told me that:
The vm has no graphic display device.
All the screen in vnc is just black.
The microvm machine type doesn't support any graphics device, so you
need to rely on the serial console.
Got it.
kernel config:
CONFIG_KVM_MMIO=y
CONFIG_VIRTIO_MMIO=y
I don't know if any specified kernel version/patch/config
is needed or anything I missed.
Could you kindly give some tips?
I'm testing it with upstream vanilla Linux. In addition to MMIO, you
need to add support for PVH (the next version of this patchset, v4, will
support booting from FW, so it'll be possible to use non-PVH ELF kernels
and bzImages too).
I've just uploaded a working kernel config here:
https://gist.github.com/slp/1060ba3aaf708584572ad4109f28c8f9
Thanks very much and this config is helpful to me.
As for the QEMU command line, something like this should do the trick:
./x86_64-softmmu/qemu-system-x86_64 -smp 1 -m 1g -enable-kvm -M microvm,legacy -kernel
vmlinux -append "earlyprintk=ttyS0 console=ttyS0 reboot=k panic=1" -nodefaults
-no-user-config -nographic -serial stdio
If this works, you can move to non-legacy mode with a virtio-console:
./x86_64-softmmu/qemu-system-x86_64 -smp 1 -m 1g -enable-kvm -M microvm -kernel vmlinux
-append "console=hvc0 reboot=k panic=1" -nodefaults -no-user-config -nographic
-serial pty -chardev stdio,id=virtiocon0,server -device virtio-serial-device -device
virtconsole,chardev=virtiocon0
I tried the above two ways and it works now. Thanks!
If is still working, you can try adding some devices too:
./x86_64-softmmu/qemu-system-x86_64 -smp 1 -m 1g -enable-kvm -M microvm -kernel vmlinux
-append "console=hvc0 reboot=k panic=1 root=/dev/vda" -nodefaults
-no-user-config -nographic -serial pty -chardev stdio,id=virtiocon0,server -device
virtio-serial-device -device virtconsole,chardev=virtiocon0 -netdev user,id=testnet
-device virtio-net-device,netdev=testnet -drive
id=test,file=alpine-rootfs-x86_64.raw,format=raw,if=none -device
virtio-blk-device,drive=test
But I'm wondering why the image I used can not be found.
root=/dev/vda3 and the same image worked well on normal qemu/guest-
config bootup, but didn't work here. The details are,
-append "console=hvc0 reboot=k panic=1 root=/dev/vda3 rw rootfstype=ext4" \
[ 0.022784] Key type encrypted registered
[ 0.022988] VFS: Cannot open root device "vda3" or
unknown-block(254,3): error -6
[ 0.023041] Please append a correct "root=" boot option; here are
the available partitions:
[ 0.023089] fe00 8946688 vda
[ 0.023090] driver: virtio_blk
[ 0.023143] Kernel panic - not syncing: VFS: Unable to mount root
fs on unknown-block(254,3)
[ 0.023201] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.3.0-rc3 #23
BTW, root=/dev/vda is also tried and didn't work. The dmesg is a
little different:
[ 0.028050] Key type encrypted registered
[ 0.028484] List of all partitions:
[ 0.028529] fe00 8946688 vda
[ 0.028529] driver: virtio_blk
[ 0.028615] No filesystem could mount root, tried:
[ 0.028616] ext4
[ 0.028670]
[ 0.028712] Kernel panic - not syncing: VFS: Unable to mount root
fs on unknown-block(254,0)
I tried another ext4 img but still doesn't work.
Is there any limitation of blk image? Could I copy your image for simple
test?