From 878abc7edb0d916d528930d789e2e6aeecfd86f9 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Wed, 19 Oct 2016 14:52:59 +0200 Subject: [PATCH] run: support multiple VMs in vbox* run scripts Issue #2143 --- repos/ports/run/vbox_auto_win7.run | 3 + repos/ports/run/vbox_auto_win7_64.run | 3 + repos/ports/run/vbox_auto_win7_64_raw.run | 3 + repos/ports/run/vbox_auto_win7_share.run | 3 + repos/ports/run/vbox_auto_win7_vbox5.run | 3 + repos/ports/run/vbox_auto_win81_64.run | 3 + repos/ports/run/vbox_win.inc | 184 +++++++++++++++------- repos/ports/run/virtualbox_auto.inc | 81 +++++++--- 8 files changed, 203 insertions(+), 80 deletions(-) diff --git a/repos/ports/run/vbox_auto_win7.run b/repos/ports/run/vbox_auto_win7.run index 625fc85f7e..66856371ea 100644 --- a/repos/ports/run/vbox_auto_win7.run +++ b/repos/ports/run/vbox_auto_win7.run @@ -16,4 +16,7 @@ set use_overlay_from_disk 1 set use_usb 1 set use_ps2 [have_spec ps2] +set use_vms 1 +set use_cpu_load 0 + source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox_auto_win7_64.run b/repos/ports/run/vbox_auto_win7_64.run index 1fc2121893..d260eed119 100644 --- a/repos/ports/run/vbox_auto_win7_64.run +++ b/repos/ports/run/vbox_auto_win7_64.run @@ -18,4 +18,7 @@ set use_overlay_from_disk 1 set use_usb 1 set use_ps2 [have_spec ps2] +set use_vms 1 +set use_cpu_load 0 + source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox_auto_win7_64_raw.run b/repos/ports/run/vbox_auto_win7_64_raw.run index d725b7d57f..1a8e72f7db 100644 --- a/repos/ports/run/vbox_auto_win7_64_raw.run +++ b/repos/ports/run/vbox_auto_win7_64_raw.run @@ -17,4 +17,7 @@ set use_overlay_from_disk 0 set use_usb 1 set use_ps2 [have_spec ps2] +set use_vms 1 +set use_cpu_load 0 + source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox_auto_win7_share.run b/repos/ports/run/vbox_auto_win7_share.run index ae7b075c8f..cd1dff0e21 100644 --- a/repos/ports/run/vbox_auto_win7_share.run +++ b/repos/ports/run/vbox_auto_win7_share.run @@ -83,6 +83,9 @@ set use_rumpfs 1 set use_usb 0 set use_ps2 [have_spec ps2] +set use_vms 1 +set use_cpu_load 0 + # # Create .bat file to be executed by Win VM # diff --git a/repos/ports/run/vbox_auto_win7_vbox5.run b/repos/ports/run/vbox_auto_win7_vbox5.run index c8c026bae6..b979d7c085 100644 --- a/repos/ports/run/vbox_auto_win7_vbox5.run +++ b/repos/ports/run/vbox_auto_win7_vbox5.run @@ -19,4 +19,7 @@ set use_overlay_from_disk 1 set use_usb 1 set use_ps2 [have_spec ps2] +set use_vms 1 +set use_cpu_load 0 + source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox_auto_win81_64.run b/repos/ports/run/vbox_auto_win81_64.run index d73dc4caae..ba751a2712 100644 --- a/repos/ports/run/vbox_auto_win81_64.run +++ b/repos/ports/run/vbox_auto_win81_64.run @@ -18,4 +18,7 @@ set use_overlay_from_disk 1 set use_usb 1 set use_ps2 [have_spec ps2] +set use_vms 1 +set use_cpu_load 0 + source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox_win.inc b/repos/ports/run/vbox_win.inc index 29ccd9bc64..288b757acb 100644 --- a/repos/ports/run/vbox_win.inc +++ b/repos/ports/run/vbox_win.inc @@ -9,6 +9,11 @@ if {[have_include "power_on/qemu"]} { exit 0 } +if {[expr !$use_rumpfs && $use_vms > 1] } { + puts "\nConfiguration bug - have only one raw block partition.\n" + exit 1 +} + set vdi_image "${flavor}.vdi" set raw_image "${flavor}.vmdk" set vbox_file "vm_${flavor}.vbox" @@ -98,11 +103,21 @@ append config_of_app { - - + } + +for { set i 1} { $i <= $use_vms } { incr i} { +append config_of_app " + shape$i\" report=\"vbox$i -> shape\"/>" +} + +append config_of_app { - + } +append_if [expr $use_cpu_load] config_of_app { + } +append config_of_app { @@ -118,127 +133,170 @@ append config_of_app { - - - + + + - - + + - - + } + +for { set i 1} { $i <= $use_vms } { incr i} { +append config_of_app " + " +} + +append config_of_app { - + } - +for { set i 1} { $i <= $use_vms } { incr i} { + append config_of_app " + " + append config_of_app { + - - - - + } + + append config_of_app " + " + + append config_of_app { + } + + append config_of_app " + " + + append config_of_app { - + } +} +append config_of_app { - - - - - - } + } -append_if [expr !$use_rumpfs] config_of_app { +for { set i 1} { $i <= $use_vms } { incr i} { + append config_of_app " + " + + append config_of_app { + } + + if { $use_vms > 1 } { + append config_of_app " + " + } else { + append config_of_app { + } + } + + append config_of_app { + + } + + append_if [expr !$use_rumpfs] config_of_app { - } + } + + append config_of_app { + } +} append config_of_app { - - - - + + + - + } - } -append_if [expr $use_vbox4] config_of_app { +for { set i 1} { $i <= $use_vms } { incr i} { + append config_of_app " + " + append_if [expr $use_vbox4] config_of_app { } -append_if [expr $use_vbox5] config_of_app { + append_if [expr $use_vbox5] config_of_app { } -append config_of_app { + append config_of_app { } -append config_of_app " - " -append config_of_app { + if { $use_vms eq 1 } { + append config_of_app " + " + } else { + append config_of_app " + + " + } + append config_of_app { } -append_if [expr !$use_rumpfs] config_of_app { + append_if [expr !$use_rumpfs] config_of_app { } -append config_of_app { + append config_of_app { } -append_if [expr $use_ram_fs] config_of_app { + append_if [expr $use_ram_fs] config_of_app { } -append config_of_app " + append config_of_app " " -append_if [expr !$use_rumpfs] config_of_app " + append_if [expr !$use_rumpfs] config_of_app " " -append_if [expr $use_rumpfs || $use_ram_fs] config_of_app { + append_if [expr $use_rumpfs || $use_ram_fs] config_of_app { } -append config_of_app { + append config_of_app { } -append_if [expr $use_ram_fs] config_of_app { - - - - } + append_if [expr $use_ram_fs] config_of_app { + } -append_if [expr $use_rumpfs] config_of_app { - } -append_if [expr !$use_rumpfs] config_of_app { - } -append config_of_app { - - + append_if [expr $use_rumpfs] config_of_app { + } + append_if [expr !$use_rumpfs] config_of_app { + } + append config_of_app " + + " + append config_of_app { - + } } source ${genode_dir}/repos/ports/run/virtualbox_auto.inc @@ -255,11 +313,17 @@ append_if [expr !$use_rumpfs] boot_modules " ${raw_image} " build_boot_image $boot_modules -run_genode_until {\[init -\> vbox\].*Guest Additions capability report:.*seamless: no, hostWindowMapping: no, graphics: no} 70 +run_genode_until {\[init -\> vbox.*].*Guest Additions capability report:.*seamless: no, hostWindowMapping: no, graphics: no} 70 +# run_genode_until forever 0 [output_spawn_id] + if {$use_rumpfs} { - run_genode_until {\[init -\> vbox\].*Guest Additions capability report:.*seamless: yes, hostWindowMapping: no, graphics: yes} 170 [output_spawn_id] + set wait_timeout 170 + for { set i 1 } { $i <= $use_vms } { incr i } { + run_genode_until {\[init -\> vbox.*].*Guest Additions capability report:.*seamless: yes, hostWindowMapping: no, graphics: yes} $wait_timeout [output_spawn_id] + set wait_timeout 25 + } } else { - run_genode_until {\[init\] child "vbox" exited with exit value 0} 60 [output_spawn_id] + run_genode_until {\[init\] child "vbox1" exited with exit value 0} 60 [output_spawn_id] # give block driver bit time to write data to disk sleep 5 } diff --git a/repos/ports/run/virtualbox_auto.inc b/repos/ports/run/virtualbox_auto.inc index 5fa25d09e6..734002fc78 100644 --- a/repos/ports/run/virtualbox_auto.inc +++ b/repos/ports/run/virtualbox_auto.inc @@ -25,6 +25,8 @@ lappend_if [expr $use_usb] build_components drivers/usb lappend_if [expr $use_usb] build_components app/usb_report_filter lappend_if [have_spec x86] build_components drivers/rtc lappend_if [expr $use_ram_fs || $use_usb] build_components server/ram_fs +lappend_if [expr $use_cpu_load] build_components app/trace_subject_reporter +lappend_if [expr $use_cpu_load] build_components app/cpu_load_display source ${genode_dir}/repos/base/run/platform_drv.inc # override defaults of platform_drv.inc @@ -37,7 +39,14 @@ build $build_components create_boot_directory set config { - +} + +if {$use_vms > 1} { + append config " + " +} + +append config { @@ -52,6 +61,9 @@ set config { append_if [have_spec muen] config { } +append_if [expr $use_cpu_load] config { + } + append config { @@ -67,10 +79,6 @@ append config { - - - - @@ -82,7 +90,7 @@ append config { append_if [expr $use_rumpfs] config { } append_if [expr !$use_rumpfs] config { - } + } append config { } @@ -91,7 +99,8 @@ append_if [expr $use_rumpfs] config { - } + } + append_if [expr $use_rumpfs && $use_ram_fs && $use_overlay_from_disk] config { } append_if [expr $use_rumpfs] config { @@ -103,18 +112,27 @@ append_if [expr $use_rumpfs] config { } append_if [expr $use_ram_fs] config { - - + } +append_if [expr $use_ram_fs] config " + " +append_if [expr $use_ram_fs] config { - - } -append_if [expr $use_ram_fs] config "" + } +for { set i 1} { $i <= ${use_vms} } { incr i} { +append_if [expr $use_ram_fs] config " + + + " +} append_if [expr $use_ram_fs] config { - - - + } +for { set i 1} { $i <= ${use_vms} } { incr i} { +append_if [expr $use_ram_fs] config " + from_ram_fs\" root=\"/ram${i}\" writeable=\"yes\"/>" +} +append_if [expr $use_ram_fs] config { } append_if [expr $use_ram_fs && $use_overlay_from_disk] config "" @@ -128,7 +146,7 @@ append_if [expr $use_ram_fs] config { append_if [expr $use_ram_fs && $use_overlay_from_disk] config { - + } append_if [expr $use_rumpfs && $use_ram_fs && $use_overlay_from_disk] config { @@ -144,9 +162,31 @@ append_if [expr $use_ps2] config { + + } + +append_if [expr $use_cpu_load] config { + + + + + - - + + + + + + + + + + + + + + + } @@ -175,7 +215,7 @@ append_if [expr $use_usb] config { - + @@ -242,7 +282,6 @@ append_if [expr $use_usb] config { - @@ -289,6 +328,8 @@ lappend_if [expr $use_vbox4] boot_modules virtualbox lappend_if [expr $use_vbox5] boot_modules virtualbox5 lappend_if [expr $use_ram_fs || $use_usb] boot_modules ram_fs lappend_if [expr $use_ram_fs && !$use_overlay_from_disk] boot_modules ${overlay_image} +lappend_if [expr $use_cpu_load] boot_modules trace_subject_reporter +lappend_if [expr $use_cpu_load] boot_modules cpu_load_display # platform-specific modules lappend_if [expr $use_ps2] boot_modules ps2_drv