Qemu: Difference between revisions

From vegard.wiki
Jump to navigation Jump to search
Content added Content deleted
(kvm/9p)
 
Line 19: Line 19:
* <tt>CONFIG_NET_9P_VIRTIO=y</tt>
* <tt>CONFIG_NET_9P_VIRTIO=y</tt>
* <tt>CONFIG_9P_FS=y</tt>
* <tt>CONFIG_9P_FS=y</tt>

Sometimes it will be useful to use <tt>security_model=none</tt> rather than <tt>passthrough</tt>. From the man page:
<q>In "passthrough" security model, files are stored using the same credentials as they are created on the guest. This requires QEMU to run as root. [...] "none" security model is same as passthrough except the sever won't report failures if it fails to set file attributes like ownership.</q>


[[Category:Linux kernel]]
[[Category:Linux kernel]]

Revision as of 06:32, 15 December 2019

Boot using host filesystem over 9p

kvm \
  -cpu host \
  -m 1G \
  -kernel arch/x86/boot/bzImage \
  -append "rootfstype=9p root=/dev/root rootflags=trans=virtio,version=9p2000.L rw console=ttyS0 init=/bin/bash" \
  -serial stdio \
  -fsdev local,id=fsdev0,path=/,security_model=passthrough \
  -device virtio-9p-pci,fsdev=fsdev0,mount_tag=/dev/root \
  -no-reboot \
  -display none

Remember to set the following variables in your kernel config (in order):

  • CONFIG_VIRTIO_PCI=y
  • CONFIG_NET_9P=y
  • CONFIG_NET_9P_VIRTIO=y
  • CONFIG_9P_FS=y

Sometimes it will be useful to use security_model=none rather than passthrough. From the man page: In "passthrough" security model, files are stored using the same credentials as they are created on the guest. This requires QEMU to run as root. [...] "none" security model is same as passthrough except the sever won't report failures if it fails to set file attributes like ownership.