tool/run: move nic model to qemu_args file

Always instantiating a network device with id `net0`, removes the need to call
append_qemu_nic_args in run scripts unless we want to add forwarding
rules.

genodelabs/genode#4311
This commit is contained in:
Johannes Schlatow 2021-11-03 15:27:35 +01:00 committed by Christian Helmuth
parent 522a1cdc5b
commit 2ecb09ba7e
7 changed files with 10 additions and 33 deletions

View File

@ -1 +1,2 @@
-m 768 -M realview-pbx-a9
-net nic,model=lan9118,netdev=net0 -netdev user,id=net0

View File

@ -1 +1,2 @@
-machine q35
-net nic,model=e1000,netdev=net0 -netdev user,id=net0

View File

@ -1,6 +1,8 @@
-m 2048
-global virtio-mmio.force-legacy=false
-device virtio-net-device,bus=virtio-mmio-bus.0,netdev=net0
-device virtio-mouse-device
-device virtio-keyboard-device
-netdev user,id=net0
arm_v8a: -M virt,virtualization=true,gic-version=3 -cpu cortex-a53 -smp 4
arm_v7a: -M virt,virtualization=true -cpu cortex-a15 -smp 2

View File

@ -155,14 +155,4 @@ append config {
append qemu_args " -nographic "
append_qemu_nic_args
# When using with a tap device manually replace append_qemu_nic_args with:
#proc qemu_nic_model {} {
# if [have_spec x86] { return e1000 }
# if [have_board pbxa9] { return lan9118 }
# if [have_board zynq_qemu] { return cadence_gem }
# return nic_model_missing
#}
#append qemu_args " -net nic,model=[qemu_nic_model] "
#append qemu_args " -net tap,ifname=tap0,downscript=no,script=no "
# vi: set ft=tcl :

View File

@ -114,13 +114,4 @@ append config {
append qemu_args " -nographic "
append_qemu_nic_args
#proc qemu_nic_model {} {
# if [have_spec x86] { return e1000 }
# if [have_board pbxa9] { return lan9118 }
# if [have_board zynq_qemu] { return cadence_gem }
# return nic_model_missing
#}
#append qemu_args " -net nic,model=[qemu_nic_model] "
#append qemu_args " -net tap,ifname=tap0,downscript=no,script=no "
# vi: set ft=tcl :

View File

@ -198,6 +198,12 @@ proc run_power_on { } {
if {[regexp -- {-m\s+} $board_qemu_args dummy]} {
regsub -all {\-m\s+\S+} $qemu_args "" qemu_args }
##
# let user override any netdev
#
if {[regexp -- {-netdev\s+user,id=(\w+)} $qemu_args dummy netdev]} {
regsub -all "\\-netdev\\s+user,id=$netdev\\S*" $board_qemu_args "" board_qemu_args }
# append custom board-specific qemu_args
append qemu_args " $board_qemu_args"

View File

@ -14,13 +14,6 @@ proc qemu_args { } {
return $qemu_args
}
proc qemu_nic_model {} {
if [have_board pbxa9] { return lan9118 }
if [have_board zynq_qemu] { return cadence_gem }
if [have_board pc] { return e1000 }
return nic_model_missing
}
proc append_qemu_nic_args { { extra_netdev_args "" } } {
global qemu_args
append qemu_args " -netdev user,id=net0"
@ -28,13 +21,6 @@ proc append_qemu_nic_args { { extra_netdev_args "" } } {
if { $extra_netdev_args ne "" } {
append qemu_args ",$extra_netdev_args"
}
if {[have_board virt_qemu]} {
append qemu_args " -global virtio-mmio.force-legacy=false "
append qemu_args " -device virtio-net-device,bus=virtio-mmio-bus.0,netdev=net0 "
} else {
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
}
}