-Not optimized yet, but should be pretty complete. Tested against qemu. -Add switches to qemu script to allow running with a tap interface. -Enable minip by default on vexpress-a9 platform
54 lines
1.2 KiB
Bash
Executable File
54 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
function HELP {
|
|
echo "help:"
|
|
echo "-b a virtio block device"
|
|
echo "-n a virtio network device"
|
|
echo "-t a virtio tap network device"
|
|
echo "-h for help"
|
|
echo "all arguments after -- are passed to qemu directly"
|
|
exit 1
|
|
}
|
|
|
|
DO_NET=0
|
|
DO_NET_TAP=0
|
|
DO_BLOCK=0
|
|
SUDO=""
|
|
|
|
while getopts bhnt FLAG; do
|
|
case $FLAG in
|
|
b) DO_BLOCK=1;;
|
|
n) DO_NET=1;;
|
|
t) DO_NET_TAP=1
|
|
SUDO="sudo ";;
|
|
h) HELP;;
|
|
\?)
|
|
echo unrecognized option
|
|
HELP
|
|
esac
|
|
done
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
ARGS=" -machine vexpress-a9 -m 512 -kernel build-vexpress-a9-test/lk.elf -nographic"
|
|
BLOCK_ARGS=" -drive if=none,file=blk.bin,id=blk,format=raw -device virtio-blk-device,drive=blk"
|
|
NET_ARGS=" -netdev user,id=vmnic,hostname=qemu -device virtio-net-device,netdev=vmnic"
|
|
NET_TAP_ARGS=" -netdev tap,id=vmnic -device virtio-net-device,netdev=vmnic"
|
|
|
|
echo DO_BLOCK = $DO_BLOCK
|
|
echo DO_NET = $DO_NET
|
|
|
|
if [ $DO_BLOCK == 1 ]; then
|
|
ARGS+=$BLOCK_ARGS
|
|
fi
|
|
if [ $DO_NET == 1 ]; then
|
|
ARGS+=$NET_ARGS
|
|
fi
|
|
if [ $DO_NET_TAP == 1 ]; then
|
|
ARGS+=$NET_TAP_ARGS
|
|
fi
|
|
|
|
make vexpress-a9-test -j4 &&
|
|
echo $SUDO qemu-system-arm $ARGS $@ &&
|
|
$SUDO qemu-system-arm $ARGS $@
|