Files
genode/tool/run/qemu.inc
Johannes Schlatow 522a1cdc5b tool/run: read board-specific qemu args from file
Allow specifying additional qemu arguments for externally supported boards
(e.g. zynq_qemu) by adding a `qemu_args` file in the board-property directory.

The syntax of the qemu_args file is as follows:
- Arguments can appear in a single line or in multiple lines as the
  lines will be appended (separated by a whitespace) to the global
  qemu_args variable.
- If the line is prepended with a `foobar:` expression. The arguments
  are only added if the foobar spec is present.

Note, that a `-m` argument specified in the qemu_args file will
override the arguments provided by the run scripts.

genodelabs/genode#4311
2021-11-29 15:10:52 +01:00

55 lines
1.2 KiB
PHP

set qemu_spawn_id ""
set qemu_args [get_cmd_arg --qemu-args ""]
#
# Enable run scripts to extend 'qemu_arg' via 'append' without bothering
# about the required whitespace in front of the custom arguments.
#
append qemu_args " "
proc qemu_args { } {
global 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"
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 "
}
}
##
# Check whether Qemu support is available
#
proc is_qemu_available { } {
set qemu_args_file [file join "board" [board] "qemu_args"]
set repo [repository_contains $qemu_args_file]
if {$repo == ""} {
puts stderr "skipping execution because platform is not supported by qemu"
return false
}
return true
}