From 6f21ef5c9f1f993d1a003cfa2bd904750e17b0b8 Mon Sep 17 00:00:00 2001 From: Cody Wong Date: Tue, 26 Dec 2023 16:09:45 +0800 Subject: [PATCH] [arm][v9p] Add v9p host dir sharing support for arm platform - Add the v9p support for arm platform. - Add an option `-f` to set the shared directory on the host machine to `do-qemuarm`. - For example, to use the v9p dir sharing, run the script as: ``` # under `lk/` run the follow command will share the current # directory `lk/` within LK vm as VirtIO 9p device scripts/do-qemuarm -f . ``` Signed-off-by: Cody Wong --- platform/qemu-virt-arm/rules.mk | 1 + scripts/do-qemuarm | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/platform/qemu-virt-arm/rules.mk b/platform/qemu-virt-arm/rules.mk index 79721db2c..eb00bda1d 100644 --- a/platform/qemu-virt-arm/rules.mk +++ b/platform/qemu-virt-arm/rules.mk @@ -33,6 +33,7 @@ MODULE_DEPS += \ dev/virtio/block \ dev/virtio/gpu \ dev/virtio/net \ + dev/virtio/9p \ lib/cbuf \ lib/fdtwalk \ diff --git a/scripts/do-qemuarm b/scripts/do-qemuarm index d5ea9a1db..70b753435 100755 --- a/scripts/do-qemuarm +++ b/scripts/do-qemuarm @@ -17,6 +17,7 @@ function HELP { echo "-n : a virtio network device" echo "-t : a virtio tap network device" echo "-g : a virtio display" + echo "-f : a virtio 9p device with a host shared directory" echo echo "-h for help" echo "all arguments after -- are passed to qemu directly" @@ -33,16 +34,19 @@ DO_CORTEX_M3=0 DO_DISPLAY=0 DO_CMPCTMALLOC=0 DO_MINIHEAP=0 +DO_V9P=0 +DO_V9P_DIR="" SMP=1 MEMSIZE=512 SUDO="" PROJECT="" -while getopts cd:ghm:Mnt36vp:s: FLAG; do +while getopts cd:ghm:Mnt36vp:s:f: FLAG; do case $FLAG in c) DO_CMPCTMALLOC=1;; d) DO_DISK=1; DISK_IMAGE=$OPTARG;; g) DO_DISPLAY=1;; + f) DO_V9P=1; DO_V9P_DIR=$OPTARG;; M) DO_MINIHEAP=1;; n) DO_NET=1;; t) DO_NET_TAP=1;; @@ -121,6 +125,11 @@ else ARGS+=" -nographic" fi +if (( $DO_V9P )); then + ARGS+=" -fsdev local,path=$DO_V9P_DIR,security_model=mapped,id=v9p0" + ARGS+=" -device virtio-9p-device,fsdev=v9p0,mount_tag=V9P0" +fi + MAKE_VARS="" if (( $DO_CMPCTMALLOC )); then