A QEMU instance with the microvm machine type can be invoked this way:
- Normal mode:
qemu-system-x86_64 -M microvm -m 512m -smp 2 \
-kernel vmlinux -append "console=hvc0 root=/dev/vda" \
-nodefaults -no-user-config \
-chardev pty,id=virtiocon0,server \
-device virtio-serial-device \
-device virtconsole,chardev=virtiocon0 \
-drive id=test,file=test.img,format=raw,if=none \
-device virtio-blk-device,drive=test \
-netdev tap,id=tap0,script=no,downscript=no \
-device virtio-net-device,netdev=tap0
- Legacy mode:
qemu-system-x86_64 -M microvm,legacy -m 512m -smp 2 \
-kernel vmlinux -append "console=ttyS0 root=/dev/vda" \
-nodefaults -no-user-config \
-drive id=test,file=test.img,format=raw,if=none \
-device virtio-blk-device,drive=test \
-netdev tap,id=tap0,script=no,downscript=no \
-device virtio-net-device,netdev=tap0 \
-serial stdio