seoul: add script turning Genode scenario into VM

Related to issue #1261
This commit is contained in:
Alexander Boettcher 2014-09-21 10:20:20 +02:00 committed by Christian Helmuth
parent 9f8c87f2ed
commit d006185d90
9 changed files with 144 additions and 23 deletions

View File

@ -10,6 +10,7 @@
assert_spec nova
set use_multiboot 1
set use_genode_iso 0
set use_block_ide 0
set use_block_sata 0

View File

@ -8,9 +8,10 @@
#
set use_multiboot 0
set use_genode_iso 0
set use_block_ide 1
set use_block_sata 0
set use_block_ide 0
set use_block_sata 1
set use_nic_session 0
set use_nic_bridge 0
@ -20,7 +21,7 @@ set use_usb 0
set use_framebuffer 1
set use_fancy_stuff 0
set memory_vmm_vm "128M"
set memory_vmm_vm "512M"
set vcpus_to_be_used 1
@ -33,9 +34,10 @@ if {[is_qemu_available]} {
exit 1
}
append qemu_args " -m 128 "
append qemu_args " -m 1024 "
append qemu_args " -cpu phenom"
append qemu_args " -boot d -hda bin/seoul-disc.raw "
append_if $use_block_ide qemu_args " -boot d -hda bin/seoul-disc.raw "
append_if $use_block_sata qemu_args " -drive id=disk,file=bin/seoul-disc.raw,if=none -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 -boot d"
}
run_genode_until forever

View File

@ -11,6 +11,7 @@
#
set use_multiboot 1
set use_genode_iso 0
set use_block_ide 0
set use_block_sata 0

View File

@ -0,0 +1,75 @@
#
# \brief Turn a Genode setup(run script) into a VM to be bootable in Seoul
# \author Alexander Boettcher
# \date 2014-09-21
#
# This run script starts the Seoul VMM booting from a multiboot Genode setup
# created by another Genode run script. The referenced run script can be
# adapted by tuning the variables run_script and build_dir below accordingly.
#
set use_multiboot 1
set use_genode_iso 1
set use_block_ide 0
set use_block_sata 0
set use_nic_session 1
set use_nic_bridge 0
set use_usb 0
set use_framebuffer 1
set use_fancy_stuff 0
set memory_vmm_vm "128M"
set vcpus_to_be_used 1
# Put the multiboot data structure out of the way of Nova's bss.
set use_multiboot_modaddr 0x2800000
# Use a Genode run script and turn it into a bootable setup for Seoul
set run_script "printf"
set build_dir "."
set run_script_path "$build_dir/var/run/$run_script"
set genode_iso "$build_dir/var/run/$run_script.iso"
if {[catch {exec cp $genode_iso bin/genode.iso}]} {
puts "Run scenario '$run_script' is not present. Please run it before\
invoking this run script."
exit 1
}
set files_vm [exec cat $run_script_path/boot/grub/menu.lst]
set vm [split $files_vm "\n"]
set guest_os_binaries {}
foreach line $vm {
if {[regexp "module\.*" $line] || [regexp "kernel\.*" $line]} {
set label_file [lindex $line 1]
set binary_cmdline [lrange $line 2 end]
regsub -all "/fiasco/" $label_file "" binary_file
regsub -all "/boot/" $binary_file "" binary_file
regsub -all "/genode/" $binary_file "" binary_file
# skip bender to speed up booting
if {$binary_file == "bender"} {
continue
}
if {$binary_cmdline eq ""} {
append multiboot_files "<rom name=\"$binary_file\" label=\"$label_file\"/>\n"
} else {
append multiboot_files "<rom name=\"$binary_file\" label=\"$label_file\" cmdline=\"$binary_cmdline\"/>\n"
}
}
}
# Seoul VM setup done
source ${genode_dir}/repos/ports/run/seoul.inc
append qemu_args " -m 1024 "
append qemu_args " -cpu phenom "
run_genode_until forever

View File

@ -15,6 +15,7 @@ if {[is_qemu_available]} {
}
set use_multiboot 1
set use_genode_iso 0
set use_block_ide 0
set use_block_sata 0

View File

@ -8,6 +8,7 @@
#
set use_multiboot 1
set use_genode_iso 0
set use_block_ide 0
set use_block_sata 0

View File

@ -37,11 +37,13 @@ lappend_if $use_fancy_stuff build_components server/nitpicker
lappend_if $use_fancy_stuff build_components server/liquid_framebuffer
lappend_if $use_fancy_stuff build_components app/launchpad
lappend_if $use_fancy_stuff build_components server/nitlog
lappend_if $use_genode_iso build_components server/iso9660
lappend_if $use_genode_iso build_components server/rom_blk
build $build_components
# write Seoul config file
set vm_cfg_fd [open "bin/vm_linux.cfg" w]
set vm_cfg_fd [open "bin/vm_seoul.cfg" w]
puts $vm_cfg_fd {<config colocate="1" >
<machine>
<mem start="0x0" end="0x9a000"/>
@ -73,8 +75,10 @@ if {!$use_multiboot} {
<vbios_reset/>}
if {$use_multiboot} {
puts $vm_cfg_fd {
<vbios_multiboot/>
if {[info exists use_multiboot_modaddr]} {
puts $vm_cfg_fd " <vbios_multiboot modaddr=\"$use_multiboot_modaddr\"/>"
} else {
puts $vm_cfg_fd { <vbios_multiboot/>}
}
}
@ -171,6 +175,22 @@ append_if $use_block_ide config {
<config ata="yes" />
</start>}
append_if $use_genode_iso config {
<start name="rom_blk" priority="-1">
<resource name="RAM" quantum="16M" />
<provides><service name="Block"/></provides>
<config file="genode.iso" block_size="2048"/>
</start>
<start name="iso9660" priority="-1">
<resource name="RAM" quantum="16M"/>
<provides><service name="ROM"/></provides>
<route>
<service name="Block"><child name="rom_blk"/></service>
<any-service><parent/></any-service>
</route>
</start>}
append_if [have_spec acpi] config {
<start name="acpi" priority="-1">
<resource name="RAM" quantum="8M"/>
@ -239,11 +259,21 @@ append_if [expr $use_nic_session && !$use_nic_bridge] config {
<service name="Nic"> <child name="nic_drv"/> </service>}
append_if $use_framebuffer config {
<service name="Framebuffer"><child name="fb_drv"/></service>}
append_if $use_genode_iso config {
<service name="ROM">
<if-arg key="filename" value="vm_seoul.cfg"/>
<parent/>
</service>
<service name="ROM">
<if-arg key="filename" value="hypervisor_info_page"/>
<parent/>
</service>
<service name="ROM"><child name="iso9660"/></service>}
append config {
<service name="Rtc"><child name="rtc_drv"/></service>
<any-service><parent/><any-child/></any-service>
</route>
<configfile name="vm_linux.cfg"/>
<configfile name="vm_seoul.cfg"/>
</start> }
}
@ -331,7 +361,7 @@ if {$use_fancy_stuff} {
<service name="Framebuffer"><child name="fb.seoul"/></service>
<any-service><parent/></any-service>
</route>
<configfile name="vm_linux.cfg"/>
<configfile name="vm_seoul.cfg"/>
</start>
</config>
</launcher>}
@ -352,7 +382,7 @@ set boot_modules {
timer
rtc_drv
seoul
vm_linux.cfg
vm_seoul.cfg
}
lappend_if [have_spec acpi] boot_modules acpi_drv
@ -369,7 +399,9 @@ lappend_if $use_fancy_stuff boot_modules liquid_fb
lappend_if $use_fancy_stuff boot_modules launchpad
lappend_if $use_fancy_stuff boot_modules nitlog
lappend_if $use_fancy_stuff boot_modules launchpad-config
lappend_if $use_genode_iso boot_modules rom_blk
lappend_if $use_genode_iso boot_modules iso9660
lappend_if $use_genode_iso boot_modules genode.iso
#
# Add OS binaries of guest
@ -384,12 +416,14 @@ if {$use_multiboot} {
set guest_os_binary_missing 1
}
set sha1 [exec sha1sum bin/$binary]
set sha1 [regexp -inline {[0-9a-h]+} $sha1]
if {[string compare $sha1 [lindex $sha1_os_binaries $binary_counter]]} {
puts "SHA1 sum of binary does not match with expected one - abort"
puts "$binary $sha1 != [lindex $sha1_os_binaries $binary_counter]"
set guest_os_binary_missing 1
if {[info exists sha1_os_binaries]} {
set sha1 [exec sha1sum bin/$binary]
set sha1 [regexp -inline {[0-9a-h]+} $sha1]
if {[string compare $sha1 [lindex $sha1_os_binaries $binary_counter]]} {
puts "SHA1 sum of binary does not match with expected one - abort"
puts "$binary $sha1 != [lindex $sha1_os_binaries $binary_counter]"
set guest_os_binary_missing 1
}
}
incr binary_counter 1
}
@ -406,4 +440,4 @@ if {$use_usb} {
build_boot_image $boot_modules
# A copy of the config is placed in the run folder.
exec rm -f bin/vm_linux.cfg
exec rm -f bin/vm_seoul.cfg

View File

@ -80,11 +80,16 @@ class Boot_module_provider
if (mod_node.has_type("rom")) {
/*
* Determine ROM file name, which is specified as 'name'
* attribute of the 'rom' node.
* Determine ROM file name, which is specified as 'label'
* attribute of the 'rom' node. If no 'label' argument is
* provided, use the 'name' attribute as file name.
*/
char name[MODULE_NAME_MAX_LEN];
mod_node.attribute("name").value(name, sizeof(name));
try {
mod_node.attribute("label").value(name, sizeof(name));
} catch (Xml_node::Nonexistent_attribute) {
mod_node.attribute("name").value(name, sizeof(name));
}
/*
* Open ROM session

View File

@ -85,12 +85,13 @@ MODEL_INFO(intel82576vf, "promisc", "mem_mmio", "mem_msix", "txpoll_us", "rx_map
MODEL_INFO(ahci, "mem", "irq", "bdf")
MODEL_INFO(drive, "sigma0drive", "controller", "port")
MODEL_INFO(vbios_multiboot, "modaddr", "lowmem")
MODEL_INFO_NO_ARG(vbios_disk)
MODEL_INFO_NO_ARG(vbios_keyboard)
MODEL_INFO_NO_ARG(vbios_mem)
MODEL_INFO_NO_ARG(vbios_time)
MODEL_INFO_NO_ARG(vbios_reset)
MODEL_INFO_NO_ARG(vbios_multiboot)
MODEL_INFO_NO_ARG(msi)
MODEL_INFO_NO_ARG(ioapic)
MODEL_INFO_NO_ARG(vcpu)