轉自:https://blog.csdn.net/ayu_ag/article/details/52956351
版權聲明:本文為博主原創文章,未經博主允許不得轉載。 https://blog.csdn.net/ayu_ag/article/details/52956351
9p是啥,網絡文件系統,用於共享目錄。當然,qemu中使用9p是用於host和guest中共享目錄,也不需要網絡的支持,而是需要virtio的支持。
qemu啟動參數需要添加:
-fsdev local,security_model=passthrough,id=fsdev0,path=/tmp/share -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare
然后提示:
'virtio-9p-pci' is not a valid device model name
需要重新編譯qemu,編譯時添加額外的configure參數:
--enable-virtfs
編譯安裝qemu后,再運行,可以了。
在guest中掛載host共享的目錄:
mkdir /tmp/host_files
mount -t 9p -o trans=virtio,version=9p2000.L hostshare /tmp/host_files
提示:
mount: unknown filesystem type '9p'
需要在kernel中添加9p的支持:
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_NET_9P_DEBUG=y (Optional)
CONFIG_9P_FS=y
CONFIG_9P_FS_POSIX_ACL=y
然后就可以使用了,如果再加上virtio console的支持,那么既有shell,又可以傳輸文件,基本可以代替adb的常用功能了。
參考:
qemu啟動命令:http://www.linux-kvm.org/page/9p_virtio
kernel配置:http://wiki.qemu.org/Documentation/9psetup
qemu添加configure選項:https://groups.google.com/forum/#!topic/coreos-dev/MjhL3tOOAVM
---------------------
作者:ayu_ag
來源:CSDN
原文:https://blog.csdn.net/ayu_ag/article/details/52956351
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!