tool: Consolidate qemu nic setup.

Right now the same code dealing with nic setup on qemu is duplicated
in many different run scripts. It makes it unnecesarily complex to
change the existing config or add support for new nic types. Lets move
all this common code to qemu.inc.

Ref #3825
This commit is contained in:
Piotr Tworek
2020-04-02 21:20:50 +02:00
committed by Christian Helmuth
parent aa2511e209
commit fe0ad0addb
26 changed files with 65 additions and 168 deletions

View File

@@ -3,7 +3,6 @@
#
source [genode_dir]/tool/run/log.inc
source [genode_dir]/tool/run/qemu.inc
proc run_log { wait_for_re timeout_value } {

View File

@@ -4,8 +4,6 @@
# Reset the target machine or rather run the scenario with Qemu
#
source [genode_dir]/tool/run/qemu.inc
proc check_version {qemu_version qemu_min qemu_max} {
set version_min_list [split $qemu_min ".-"]
set version_min_list_len [llength $version_min_list]

View File

@@ -14,6 +14,24 @@ proc qemu_args { } {
return $qemu_args
}
proc qemu_nic_model {} {
if [have_spec lan9118] { return lan9118 }
if [have_spec zynq] { return cadence_gem }
if [have_spec x86] { return e1000 }
return nic_model_missing
}
proc append_qemu_nic_args { { extra_netdev_args "" } } {
global qemu_args
append qemu_args " -netdev user,id=net0"
if { $extra_netdev_args ne "" } {
append qemu_args ",$extra_netdev_args"
}
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
}
##
# Check whether Qemu support is available

View File

@@ -1026,6 +1026,7 @@ proc build_initrd { modules } {
}
source [genode_dir]/tool/run/depot.inc
source [genode_dir]/tool/run/qemu.inc
##