mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 00:24:51 +00:00
parent
d8c2a908b8
commit
961bd41b05
165
ports/run/virtualbox_auto.inc
Normal file
165
ports/run/virtualbox_auto.inc
Normal file
@ -0,0 +1,165 @@
|
||||
assert_spec nova
|
||||
|
||||
if {[is_qemu_available]} {
|
||||
puts "\nScript running on Qemu is not supported.\n"
|
||||
exit
|
||||
}
|
||||
|
||||
set build_components {
|
||||
core init virtualbox
|
||||
server/part_blk
|
||||
server/rump_fs
|
||||
drivers/ahci
|
||||
drivers/input
|
||||
drivers/framebuffer
|
||||
drivers/timer
|
||||
}
|
||||
|
||||
lappend_if [have_spec acpi] build_components drivers/acpi
|
||||
lappend_if [have_spec pci] build_components drivers/pci
|
||||
|
||||
build $build_components
|
||||
|
||||
create_boot_directory
|
||||
|
||||
set config {
|
||||
<config verbose="yes">
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="RAM"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="CAP"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
<service name="SIGNAL"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service><parent/><any-child/></any-service>
|
||||
</default-route>
|
||||
<start name="timer">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
<start name="ahci">
|
||||
<binary name="ahci" />
|
||||
<resource name="RAM" quantum="10M" />
|
||||
<provides><service name="Block" /></provides>
|
||||
<route>
|
||||
<service name="IRQ"><child name="acpi" /></service>
|
||||
<any-service> <parent /> <any-child /></any-service>
|
||||
</route>
|
||||
</start>
|
||||
<start name="part_blk">
|
||||
<resource name="RAM" quantum="10M" />
|
||||
<provides><service name="Block" /></provides>
|
||||
<route>
|
||||
<any-service><child name="ahci"/> <parent/><any-child/></any-service>
|
||||
</route>
|
||||
<config>
|
||||
<policy label="rump_fs" partition="4"/>
|
||||
</config>
|
||||
</start>
|
||||
<start name="rump_fs">
|
||||
<resource name="RAM" quantum="16M" />
|
||||
<provides><service name="File_system"/></provides>
|
||||
<config fs="ext2fs"><policy label="" root="/" writeable="yes"/></config>
|
||||
<route>
|
||||
<any-service><child name="part_blk"/> <parent/><any-child/></any-service>
|
||||
</route>
|
||||
</start>
|
||||
}
|
||||
|
||||
append_if [have_spec acpi] config {
|
||||
<start name="acpi">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<binary name="acpi_drv"/>
|
||||
<provides>
|
||||
<service name="PCI"/>
|
||||
<service name="IRQ" />
|
||||
</provides>
|
||||
<route>
|
||||
<service name="PCI"> <any-child /> </service>
|
||||
<any-service> <parent/> <any-child /> </any-service>
|
||||
</route>
|
||||
</start>}
|
||||
|
||||
append_if [expr ![have_spec acpi] && [have_spec pci]] config {
|
||||
<start name="pci_drv">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<provides> <service name="PCI"/> </provides>
|
||||
</start> }
|
||||
|
||||
append_if [have_spec ps2] config {
|
||||
<start name="ps2_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Input"/></provides>
|
||||
</start> }
|
||||
|
||||
append_if [have_spec framebuffer] config {
|
||||
<start name="fb_drv">
|
||||
<resource name="RAM" quantum="6M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
<config buffered="yes" width="1400" height="1050" depth="16" />
|
||||
</start>}
|
||||
|
||||
append config $config_of_app
|
||||
|
||||
append config {
|
||||
</config>
|
||||
}
|
||||
|
||||
install_config $config
|
||||
|
||||
set boot_modules {
|
||||
core init timer
|
||||
part_blk ahci
|
||||
ld.lib.so libc.lib.so libc_fs.lib.so
|
||||
rump.lib.so rump_fs.lib.so rump_fs
|
||||
virtualbox vbox-auto-test-helper
|
||||
}
|
||||
|
||||
#
|
||||
# Stuff to generate overlay.vdi if required
|
||||
#
|
||||
# generate overlay VDI
|
||||
#proc vdi { } {
|
||||
# global vdi_image
|
||||
# return "bin/$vdi_image"
|
||||
#}
|
||||
#proc overlay_vdi { } { return "bin/overlay.vdi" }
|
||||
#proc vdi_size {} {
|
||||
# catch {
|
||||
# set result [ exec vboxmanage showhdinfo [vdi] | \
|
||||
# grep "^Logical" | sed "s/\[^0-9\]\\+//;s/ .*//" ]
|
||||
# }
|
||||
# return $result
|
||||
#}
|
||||
#
|
||||
#file delete -force [overlay_vdi]
|
||||
#if {$use_vdi} {
|
||||
# if {![file exists [vdi]]} {
|
||||
# puts "VDI image [vdi] missing!"
|
||||
# exit -1
|
||||
# }
|
||||
# catch {
|
||||
# exec -ignorestderr vboxmanage createhd --filename [overlay_vdi] --size [vdi_size] --format vdi
|
||||
# exec chmod a+r [overlay_vdi]
|
||||
# append boot_modules "overlay.vdi"
|
||||
# }
|
||||
#}
|
||||
|
||||
# platform-specific modules
|
||||
lappend_if [have_spec ps2] boot_modules ps2_drv
|
||||
lappend_if [have_spec acpi] boot_modules acpi_drv
|
||||
lappend_if [have_spec pci] boot_modules pci_drv
|
||||
lappend_if [have_spec framebuffer] boot_modules fb_drv
|
||||
lappend_if [have_spec nova] boot_modules pci_device_pd
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
||||
append qemu_args " -m 1512 "
|
||||
append qemu_args " -cpu phenom "
|
54
ports/run/virtualbox_auto_disk.run
Normal file
54
ports/run/virtualbox_auto_disk.run
Normal file
@ -0,0 +1,54 @@
|
||||
set use_vdi 1
|
||||
set use_iso 0
|
||||
set vdi_image "win7.vdi"
|
||||
|
||||
set config_of_app {
|
||||
<start name="vbox-auto-test-helper">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<route>
|
||||
<service name="File_system"> <child name="rump_fs"/> </service>
|
||||
<any-service> <parent/> <any-child /> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
}
|
||||
|
||||
source ${genode_dir}/ports/run/virtualbox_auto.inc
|
||||
|
||||
run_genode_until "vbox_auto_test_helper is done." 20
|
||||
exec kill [exp_pid −i $spawn_id]
|
||||
|
||||
set config_of_app {
|
||||
<start name="vbox">
|
||||
<binary name="virtualbox" />
|
||||
<resource name="RAM" quantum="2G"/>
|
||||
<config>}
|
||||
|
||||
if {$use_iso} {
|
||||
append config_of_app "
|
||||
<image type=\"iso\" file=\"/$iso_image\"/>"
|
||||
}
|
||||
|
||||
if {$use_vdi} {
|
||||
append config_of_app "
|
||||
<image type=\"vdi\" file=\"/$vdi_image\" overlay=\"yes\"/>"
|
||||
}
|
||||
|
||||
append config_of_app {
|
||||
</config>
|
||||
<route>
|
||||
<service name="File_system"> <child name="rump_fs"/> </service>
|
||||
<any-service> <parent/> <any-child /> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
}
|
||||
|
||||
source ${genode_dir}/ports/run/virtualbox_auto.inc
|
||||
|
||||
|
||||
run_genode_until "ignore resize request to 720x400" 20
|
||||
run_genode_until "ignore resize request to 640x480" 15 $spawn_id
|
||||
run_genode_until "ignore resize request to 800x600" 25 $spawn_id
|
||||
run_genode_until "ignore resize request to 800x600" 60 $spawn_id
|
||||
run_genode_until "ignore resize request to 720x400" 10 $spawn_id
|
||||
|
||||
puts "\nTest succeeded"
|
34
ports/src/virtualbox/autotest/main.cc
Normal file
34
ports/src/virtualbox/autotest/main.cc
Normal file
@ -0,0 +1,34 @@
|
||||
#include <base/printf.h>
|
||||
#include <base/thread.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
static char buf[256];
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
using Genode::printf;
|
||||
|
||||
int res = unlink("/ram/overlay.vdi");
|
||||
printf("unlink result %d\n", res);
|
||||
|
||||
int fd_src = open("/ram/overlay-original.vdi", O_RDONLY);
|
||||
int fd_dst = creat("/ram/overlay.vdi", O_CREAT);
|
||||
size_t len, sum = 0;
|
||||
|
||||
printf("fd_src %d fd_dst %d\n", fd_src, fd_dst);
|
||||
if (fd_src < 0 || fd_dst < 0)
|
||||
return 1;
|
||||
|
||||
while ((len = read(fd_src, buf, sizeof(buf))) > 0) {
|
||||
write(fd_dst, buf, len);
|
||||
sum += len;
|
||||
}
|
||||
close(fd_src);
|
||||
close(fd_dst);
|
||||
|
||||
printf("wrote %zu bytes to overlay.vdi - res=%d\n", sum, len);
|
||||
printf("vbox_auto_test_helper is done.\n");
|
||||
return 0;
|
||||
}
|
3
ports/src/virtualbox/autotest/target.mk
Normal file
3
ports/src/virtualbox/autotest/target.mk
Normal file
@ -0,0 +1,3 @@
|
||||
TARGET = vbox-auto-test-helper
|
||||
SRC_CC = main.cc
|
||||
LIBS = libc libc_fs
|
Loading…
x
Reference in New Issue
Block a user