07 qemuでserial接続

「-serial mon:stdio」を付けてやるだけ

起動例

qemu-system-x86_64 --enable-kvm \
-smp 2 \
-m 1G \
-nodefaults \
-no-user-config \
-vga cirrus \
-name VM1 \
-object memory-backend-file,id=mem0,size=1G,mem-path=/dev/hugepages,share=on \
-numa node,memdev=mem0 \
-boot strict=on \
-drive file=/var/lib/libvirt/images/TESTVM.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-vnc 0.0.0.0:10 \
-machine pc-i440fx-2.0,accel=kvm,usb=off \
-netdev bridge,br=br0,id=net0 \
-device e1000,netdev=net0,mac=52:54:00:12:10:11 \
-chardev socket,id=qmp,port=4444,host=192.168.122.1,server,nowait \
-mon chardev=qmp,mode=control,pretty=on \
-chardev socket,id=spdk_vhost_blk0,path=/var/tmp/vhost.0  \
-device vhost-user-blk-pci,id=blk0,chardev=spdk_vhost_blk0 \
-nographic -serial mon:stdio