run: support RUN_OPT for all platforms

Use RUN_OPT="--target ..." to select the backend test method.

Supported values so far:

qemu     - qemu + grub bootloader (default)
qemu+pxe - qemu + pulsar bootloader (PXE)
amt      - Intel AMT (reset+serial output) + pulsar bootloader

Related to issue #598
This commit is contained in:
Alexander Boettcher 2013-04-12 10:10:45 +02:00 committed by Norman Feske
parent 5c6f13b0d3
commit df985bda84
2 changed files with 22 additions and 23 deletions

View File

@ -18,12 +18,6 @@ proc clean_boot_modules { } {
exec rm -rf boot_modules.s var/libcache/boot_modules/boot_modules.o }
#
# Get target argument
#
proc target { } { return [get_cmd_arg --target "qemu"] }
##########################
## 'tool/run' interface ##
##########################
@ -59,6 +53,7 @@ proc create_boot_directory { } {
proc build_boot_image {binaries} {
global run_target
# strip binaries
copy_and_strip_genode_binaries_to_run_dir $binaries
@ -178,7 +173,7 @@ proc build_boot_image {binaries} {
exec [cross_dev_prefix]strip $elf_img
# target specific ops
if {[target] == "uboot"} {
if {[regexp "uboot" $run_target]} {
# parse ELF entrypoint and load address
set entrypoint [exec [cross_dev_prefix]readelf -h $elf_img | \
@ -205,6 +200,8 @@ proc build_boot_image {binaries} {
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
global run_target
#
# If a running_spawn_id is specified, wait for the expected output
#
@ -216,20 +213,12 @@ proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id
#
# Try to use one of the supported backends for running the scripts
#
# if {[is_amt_available]} {
# spawn_amt $wait_for_re $timeout_value
# return
# }
# if {[is_qemu_available]} {
# spawn_qemu $wait_for_re $timeout_value
# return
# }
if {[target] == "qemu"} { spawn_qemu $wait_for_re $timeout_value
} else {
puts stderr "Error: Can't execute automatically on target '[target]'"
puts stderr " Target might be: 'qemu'"
exit -1
if {[is_qemu_available]} {
spawn_qemu $wait_for_re $timeout_value
return
}
puts stderr "Error: Can't execute automatically on target '$run_target'"
exit -1
}

View File

@ -265,6 +265,9 @@ set cross_dev_prefix [get_cmd_arg --cross-dev-prefix ""]
set specs [get_cmd_arg --specs ""]
set repositories [get_cmd_arg --repositories ""]
set qemu_args [get_cmd_arg --qemu-args ""]
set run_target [get_cmd_arg --target "qemu"]
#
# Enable run scripts to extend 'qemu_arg' via 'append' without bothering
@ -434,6 +437,7 @@ proc spawn_qemu { wait_for_re timeout_value } {
global qemu_args
global qemu
global spawn_id
global run_target
#
# Back out on platforms w/o Qemu support
@ -467,7 +471,7 @@ proc spawn_qemu { wait_for_re timeout_value } {
# on x86, we support booting via pxe or iso image [default]
if {[have_spec x86]} {
if {[have_spec boot_pxe]} {
if {[regexp "qemu" $run_target] && [regexp "pxe" $run_target]} {
append qemu_args " -boot n -tftp [run_dir] -bootp boot/pulsar -no-reboot -no-shutdown "
} else {
append qemu_args " -cdrom [run_dir].iso "
@ -486,6 +490,10 @@ proc spawn_qemu { wait_for_re timeout_value } {
# Check whether Qemu support is available
#
proc is_qemu_available { } {
global run_target
if {![regexp "qemu" $run_target]} { return false }
if {[have_spec platform_panda] || [have_spec platform_arndale]} {
puts stderr "skipping execution because platform is not supported by qemu"
return false
@ -497,7 +505,9 @@ proc is_qemu_available { } {
# Check whether AMT support is available
#
proc is_amt_available { } {
if {![have_spec x86]} { return false }
global run_target
if {![have_spec x86] || ![regexp "amt" $run_target]} { return false }
if {[info exists ::env(AMT_TEST_MACHINE_IP)] &&
[info exists ::env(AMT_TEST_MACHINE_PWD)] &&