run: introduce have_board helper function

The new helper function returns a boolean value analoque to 'have_spec' if the
BOARD variable corresponds to the given value. It shall replace [have_spec <board>]
declarations in run-scripts.

Ref #3971
This commit is contained in:
Stefan Kalkowski 2021-01-07 19:15:55 +01:00 committed by Norman Feske
parent 6cfaac182a
commit 5a123e37c9
5 changed files with 17 additions and 15 deletions

View File

@ -42,17 +42,17 @@ append qemu_args " -nographic "
# regressions in the platform initialization code
#
proc bogomips_max_time { } {
if {[board] == "rpi"} { return 14300 }
if {[board] == "imx53_qsb"} { return 7520 }
if {[board] == "imx53_qsb_tz"} { return 7520 }
if {[board] == "imx6q_sabrelite"} { return 6320 }
if {[board] == "imx7d_sabre"} { return 9470 }
if {[board] == "imx8q_evk"} { return 7510 }
if {[board] == "pc"} {
if {[have_spec x86_64]} { return 600 }
if {[have_spec x86_32]} { return 3150 }
if {[have_board rpi]} { return 14300 }
if {[have_board imx53_qsb]} { return 7520 }
if {[have_board imx53_qsb_tz]} { return 7520 }
if {[have_board imx6q_sabrelite]} { return 6320 }
if {[have_board imx7d_sabre]} { return 9470 }
if {[have_board imx8q_evk]} { return 7510 }
if {[have_board pc]} {
if {[have_spec x86_64]} { return 600 }
if {[have_spec x86_32]} { return 3150 }
}
if {[board] == "muen"} { return 600 }
if {[have_board muen]} { return 600 }
return 0
}

View File

@ -1,6 +1,6 @@
assert_spec x86_64
if { "[board]" ne "pc" || [expr ![have_spec nova] && ![have_spec hw]] } {
if {![have_board pc] || [expr ![have_spec nova] && ![have_spec hw]] } {
puts "Run script is only supported on hw/pc and nova/pc"
exit 0
}

View File

@ -31,7 +31,7 @@ proc run_boot_dir {binaries} {
# Save config part of the image.elf for easy inspection
exec cp -f [run_dir]/genode/config [run_dir].config
if {[board] == "pc"} {
if {[have_board pc]} {
build_initrd $binaries

View File

@ -44,9 +44,7 @@ proc append_qemu_nic_args { { extra_netdev_args "" } } {
# XXX should by removed in favor of [have_include "exec/qemu"]
#
proc is_qemu_available { } {
if {[expr [have_spec linux] && {"[board]"} == {"linux"}]} { return false }
if {[have_spec rpi]} {
if {[have_board rpi] || [have_board linux]} {
puts stderr "skipping execution because platform is not supported by qemu"
return false
}

View File

@ -835,6 +835,10 @@ proc board { } {
return $board_var
}
##
# Return whether the board equals to the given string
#
proc have_board {board} { global board_var; return [expr {$board_var} eq {$board}] }
##
# Determine GDB executable installed at the host