[dev][virtio][net] add working implementation of a virtio network interface
-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
This commit is contained in:
@@ -4,18 +4,23 @@ 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 bhn FLAG; do
|
||||
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
|
||||
@@ -28,6 +33,7 @@ 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
|
||||
@@ -38,7 +44,10 @@ 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 qemu-system-arm $ARGS $@ &&
|
||||
qemu-system-arm $ARGS $@
|
||||
echo $SUDO qemu-system-arm $ARGS $@ &&
|
||||
$SUDO qemu-system-arm $ARGS $@
|
||||
|
||||
Reference in New Issue
Block a user