Skip to content

Commit c651eb2

Browse files
committed
qemu/9pfs : Add 9pfs support for elfloader-basic
Signed-off-by: Neagu Dragos-Ionut <dragosneagu28@gmail.com>
1 parent 42d988e commit c651eb2

File tree

5 files changed

+77
-0
lines changed

5 files changed

+77
-0
lines changed

elfloader-basic/scripts/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,15 @@ CC=/usr/bin/clang ./scripts/build/fc.x86_64
3434
./scripts/run/qemu.x86_64
3535
./scripts/run/fc.x86_64
3636
```
37+
38+
## Build and Run for <plat> / <arch> using a different file system
39+
40+
```console
41+
./scripts/run/<plat>.<arch>.<file_system>
42+
```
43+
44+
e.g.
45+
46+
```console
47+
./scripts/run/qemu.x86_64.9pfs
48+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
make distclean
4+
UK_DEFCONFIG=$(pwd)/scripts/defconfig/qemu.x86_64.9pfs make defconfig
5+
touch Makefile.uk
6+
make prepare
7+
if test -z "$CC"; then
8+
make -j $(nproc)
9+
else
10+
make CC="$CC" -j $(nproc)
11+
fi
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
CONFIG_PLAT_KVM=y
2+
CONFIG_KVM_VMM_QEMU=y
3+
CONFIG_ARCH_X86_64=y
4+
CONFIG_APPELFLOADER_DEPENDENCIES=y
5+
CONFIG_APPELFLOADER_ARCH_PRCTL=y
6+
CONFIG_APPELFLOADER_BRK=y
7+
CONFIG_APPELFLOADER_MULTIPROCESS=y
8+
CONFIG_APPELFLOADER_CUSTOMAPPNAME=y
9+
CONFIG_APPELFLOADER_STACK_NBPAGES=128
10+
CONFIG_APPELFLOADER_VFSEXEC_EXECBIT=n
11+
CONFIG_APPELFLOADER_VFSEXEC=y
12+
CONFIG_APPELFLOADER_HFS=y
13+
CONFIG_APPELFLOADER_HFS_ETCRESOLVCONF=y
14+
CONFIG_APPELFLOADER_HFS_ETCHOSTS=y
15+
CONFIG_APPELFLOADER_HFS_ETCHOSTNAME=y
16+
CONFIG_APPELFLOADER_HFS_REPLACEEXIST=y
17+
CONFIG_LIBPOSIX_PROCESS_MULTIPROCESS=y
18+
CONFIG_LIBVFSCORE=y
19+
CONFIG_LIBVFSCORE_AUTOMOUNT_UP=y
20+
CONFIG_LIBUK9P=y
21+
CONFIG_LIB9PFS=y
22+
CONFIG_LIBDEVFS=y
23+
CONFIG_LIBDEVFS_AUTOMOUNT=y
24+
# Uncomment for debugging.
25+
#CONFIG_LIBUKDEBUG_PRINTD=y
26+
#CONFIG_LIBUKDEBUG_PRINTK_INFO=y
27+
#CONFIG_LIBSYSCALL_SHIM_STRACE=y
28+
#CONFIG_LIBSYSCALL_SHIM_DEBUG=y
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
3+
if test ! -f "workdir/build/elfloader_qemu-x86_64"; then
4+
echo "No kernel file workdir/build/elfloader_qemu-x86_64." 1>&2
5+
echo "Did you run ./build.qemu.x86_64 ?" 1>&2
6+
exit 1
7+
fi
8+
9+
# Build ELFs.
10+
make -C rootfs/
11+
12+
# Pack filesystem as 9pfs
13+
14+
rm -fr 9pfs-rootfscd
15+
cp -r rootfs 9pfs-rootfs
16+
17+
sudo qemu-system-x86_64 \
18+
-nographic \
19+
-m 512 \
20+
-cpu max \
21+
-append "elfloader_qemu-x86_64 vfs.fstab=[ \"fs0:/:9pfs:::\" ] -- /hello-c" \
22+
-kernel workdir/build/elfloader_qemu-x86_64 \
23+
-fsdev local,id=myid,path=$(pwd)/9pfs-rootfs/,security_model=none \
24+
-device virtio-9p-pci,fsdev=myid,mount_tag=fs0
25+
.

elfloader-basic/scripts/test/all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ test_build_run()
2929
test -d ./scripts/test/log || mkdir ./scripts/test/log
3030
test_build_run qemu.x86_64
3131
test_build_run fc.x86_64
32+
test_build_run qemu.x86_64.9pfs

0 commit comments

Comments
 (0)