使用qemu的9pfs,可以将一个host中的目录共享给qemu guest。
底层设备是:virtio-9p
传输协议是:9P network protocol。
开启的内核选项:
CONFIG_NET_9P
CONFIG_NET_9P_VIRTIO
CONFIG_9P_FS
启动qemu,添加:
-virtfs local,path=.,mount_tag=host0,security_model=none
在guest里面,安装模块,挂载9p文件系统:
modprobe 9p
modprobe 9pnet_virtio
mount -t 9p -o trans=virtio host0 /mnt/host0
可以看到host里面的文件内容了:
# ls /mnt/host0/
Image initramfs.cpio mtd
disk0 initramfs.cpio.xz run_qemu.sh
参考:
https://wiki.qemu.org/Documentation/9psetup