diff --git a/repos/base/run/log.run b/repos/base/run/log.run index e246a8a5f..68e5623f8 100644 --- a/repos/base/run/log.run +++ b/repos/base/run/log.run @@ -23,6 +23,7 @@ install_config { build_boot_image "core ld.lib.so init test-log" append qemu_args "-nographic " +append xen_args { sdl="0" } run_genode_until "Test done.*\n" 20 diff --git a/repos/dde_linux/run/usb_hid.run b/repos/dde_linux/run/usb_hid.run index 70f5c3a86..a3b9870db 100644 --- a/repos/dde_linux/run/usb_hid.run +++ b/repos/dde_linux/run/usb_hid.run @@ -143,6 +143,7 @@ build_boot_image $boot_modules append qemu_args " -usb -usbdevice mouse -usbdevice keyboard" append qemu_args " -device usb-ehci,id=ehci" +append xen_args { usbdevice=\["mouse","keyboard"\] } if { [have_include "power_on/qemu"] || ![get_cmd_switch --autopilot] } { run_genode_until forever } diff --git a/repos/ports/run/lighttpd.run b/repos/ports/run/lighttpd.run index e11c1645b..ed1d719c4 100644 --- a/repos/ports/run/lighttpd.run +++ b/repos/ports/run/lighttpd.run @@ -47,7 +47,7 @@ append config { - + @@ -123,5 +123,6 @@ append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 " append qemu_args " -net user -redir tcp:5555::80 " append qemu_args " -nographic -serial mon:stdio " +append xen_args { sdl=0\; vif=\["model=e1000,mac=02:00:00:00:01:01,bridge=xenbr0"\] } run_genode_until forever diff --git a/tool/run/log/xen b/tool/run/log/xen new file mode 100644 index 000000000..cd926bbbb --- /dev/null +++ b/tool/run/log/xen @@ -0,0 +1,38 @@ +## +# Capture the output of a scenario executed via Xen +# + +source [genode_dir]/tool/run/log.inc +source [genode_dir]/tool/run/xen.inc + + +proc run_log { wait_for_re timeout_value } { + global xen_spawn_id + global output_spawn_id + + set output_spawn_id $xen_spawn_id + + set kernel_msg [run_boot_string] + + if {$wait_for_re == "forever"} { + set timeout -1 + } else { + set timeout $timeout_value + } + + expect { + -i $output_spawn_id $kernel_msg { } + eof { + puts stderr "Aborting, received EOF" + return false + } + timeout { + puts stderr "Boot process timed out" + close + return false + } + } + + wait_for_output $wait_for_re $timeout_value $xen_spawn_id + return true +} diff --git a/tool/run/power_off/xen b/tool/run/power_off/xen new file mode 100644 index 000000000..24e5dba83 --- /dev/null +++ b/tool/run/power_off/xen @@ -0,0 +1,3 @@ +proc run_power_off { } { + catch { exec sudo xl destroy "genode-hvm" } +} diff --git a/tool/run/power_on/xen b/tool/run/power_on/xen new file mode 100644 index 000000000..5a9d0c7b4 --- /dev/null +++ b/tool/run/power_on/xen @@ -0,0 +1,36 @@ +## +# Reset the target machine or rather run the scenario as Xen DomU +# + +source [genode_dir]/tool/run/xen.inc + + +## +# Execute scenario using xl +# +proc run_power_on { } { + global xen_args + global xen_spawn_id + + # + # Back out on platforms w/o Xen support + # + if {![is_xen_available]} { return 0 } + + set xen_base_args { \ + builder="hvm"\; \ + name="genode-hvm"\; \ + cpus="1"\; \ + memory="512"\; \ + serial="pty"\; \ + sdl="1"\; \ + vnc="0"\; \ + disk=\["file:[run_dir].iso,hdc:cdrom,r"\]\; \ + boot="d"\; \ + } + + eval spawn sudo xl create -c /dev/null $xen_base_args $xen_args + set xen_spawn_id $spawn_id + + return true +} diff --git a/tool/run/xen.inc b/tool/run/xen.inc new file mode 100644 index 000000000..f2f8b0a43 --- /dev/null +++ b/tool/run/xen.inc @@ -0,0 +1,31 @@ +set xen_spawn_id "" +set xen_args [get_cmd_arg --xen-args ""] + + +# +# Enable run scripts to extend 'xen_arg' via 'append' without bothering +# about the required whitespace in front of the custom arguments. +# +append xen_args " " + + +proc xen_args { } { + global xen_args + return $xen_args +} + + +## +# Check whether Xen support is available +# +# XXX should by removed in favor of [have_include "exec/xen"] +# +proc is_xen_available { } { + if {[have_spec linux]} { return false } + + if {![have_spec x86]} { + puts stderr "skipping execution because platform is not supported by Xen" + return false + } + return true +}