[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 <codycswong@google.com>
This commit is contained in:
Cody Wong
2023-12-26 16:09:45 +08:00
committed by Travis Geiselbrecht
parent db81f606da
commit 64b462cb37
2 changed files with 11 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ MODULE_DEPS += \
dev/virtio/block \ dev/virtio/block \
dev/virtio/gpu \ dev/virtio/gpu \
dev/virtio/net \ dev/virtio/net \
dev/virtio/9p \
lib/cbuf \ lib/cbuf \
lib/fdtwalk \ lib/fdtwalk \

View File

@@ -17,6 +17,7 @@ function HELP {
echo "-n : a virtio network device" echo "-n : a virtio network device"
echo "-t : a virtio tap network device" echo "-t : a virtio tap network device"
echo "-g : a virtio display" echo "-g : a virtio display"
echo "-f <shared dir> : a virtio 9p device with a host shared directory"
echo echo
echo "-h for help" echo "-h for help"
echo "all arguments after -- are passed to qemu directly" echo "all arguments after -- are passed to qemu directly"
@@ -33,16 +34,19 @@ DO_CORTEX_M3=0
DO_DISPLAY=0 DO_DISPLAY=0
DO_CMPCTMALLOC=0 DO_CMPCTMALLOC=0
DO_MINIHEAP=0 DO_MINIHEAP=0
DO_V9P=0
DO_V9P_DIR=""
SMP=1 SMP=1
MEMSIZE=512 MEMSIZE=512
SUDO="" SUDO=""
PROJECT="" PROJECT=""
while getopts cd:ghm:Mnt36vp:s: FLAG; do while getopts cd:ghm:Mnt36vp:s:f: FLAG; do
case $FLAG in case $FLAG in
c) DO_CMPCTMALLOC=1;; c) DO_CMPCTMALLOC=1;;
d) DO_DISK=1; DISK_IMAGE=$OPTARG;; d) DO_DISK=1; DISK_IMAGE=$OPTARG;;
g) DO_DISPLAY=1;; g) DO_DISPLAY=1;;
f) DO_V9P=1; DO_V9P_DIR=$OPTARG;;
M) DO_MINIHEAP=1;; M) DO_MINIHEAP=1;;
n) DO_NET=1;; n) DO_NET=1;;
t) DO_NET_TAP=1;; t) DO_NET_TAP=1;;
@@ -121,6 +125,11 @@ else
ARGS+=" -nographic" ARGS+=" -nographic"
fi 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="" MAKE_VARS=""
if (( $DO_CMPCTMALLOC )); then if (( $DO_CMPCTMALLOC )); then