Skip to content

Commit

Permalink
[arm][v9p] Add v9p host dir sharing support for arm platform
Browse files Browse the repository at this point in the history
 - 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>
  • Loading branch information
mob5566 committed Dec 26, 2023
1 parent 2983f16 commit d2445a6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions platform/qemu-virt-arm/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ MODULE_DEPS += \
dev/virtio/block \
dev/virtio/gpu \
dev/virtio/net \
dev/virtio/9p \
lib/cbuf \
lib/fdtwalk \

Expand Down
11 changes: 10 additions & 1 deletion scripts/do-qemuarm
Original file line number Diff line number Diff line change
Expand Up @@ -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 <shared dir> : a virtio 9p device with a host shared directory"
echo
echo "-h for help"
echo "all arguments after -- are passed to qemu directly"
Expand All @@ -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;;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d2445a6

Please sign in to comment.