#
# \brief Using Seoul on Genode
# \author Norman Feske
# \author Markus Partheymueller
# \author Alexander Boettcher
# \date 2011-11-21
set use_fs_rump $use_block_vdi
set use_drv_ahci [expr $use_block_vdi || $use_block_sata]
set use_vfs_block [expr $use_block_ram || $use_genode_iso]
create_boot_directory
import_from_depot [depot_user]/src/[base_src] \
[depot_user]/src/init \
[depot_user]/src/nitpicker
if {$use_fs_rump} {
import_from_depot [depot_user]/src/vfs \
[depot_user]/src/rump
}
if {$use_part_block} {
import_from_depot [depot_user]/src/part_block
}
#
# Build
#
assert_spec x86
set map_small "no"
set vmm_vcpu_same_cpu "no"
if {[have_spec sel4]} {
set map_small "yes"
set vmm_vcpu_same_cpu "yes"
# seL4 has no AMD SVM support
if {[have_include "power_on/qemu"]} {
puts "\n Run script is not supported on this platform. \n";
exit 0
}
}
if {[have_spec foc]} {
# The performance is considerable bad when
# vmm and vcpu is not on same physical CPU
set vmm_vcpu_same_cpu "yes"
# Qemu SVM has no EPT support
if {[have_include "power_on/qemu"]} {
puts "\n Run script is not supported on this platform. \n";
exit 0
}
}
source ${genode_dir}/repos/base/run/platform_drv.inc
# override defaults of platform_drv.inc
proc platform_drv_priority {} { return { priority="-1"} }
set build_components {
drivers/rtc
drivers/input
app/seoul
}
if {$use_fancy_stuff} { set use_framebuffer 1 }
lappend_if $use_block_vdi build_components server/vdi_block
lappend_if $use_usb build_components drivers/usb
lappend_if $use_vfs_block build_components server/vfs_block
lappend_if $use_drv_ahci build_components drivers/ahci
lappend_if $use_nic_session build_components drivers/nic
lappend_if $use_nic_bridge build_components server/nic_bridge
lappend_if $use_framebuffer build_components drivers/framebuffer
lappend_if $use_fancy_stuff build_components app/status_bar
lappend_if $use_fancy_stuff build_components app/launchpad
lappend_if $use_fancy_stuff build_components server/report_rom
lappend_if $use_genode_iso build_components server/iso9660
lappend_if $use_top build_components app/top
append_platform_drv_build_components
build $build_components
# write Seoul config file
set vm_cfg_fd [open "bin/vm_seoul.cfg" w]
puts $vm_cfg_fd ""
puts $vm_cfg_fd {
}
if {!$use_multiboot} {
puts $vm_cfg_fd {
}
}
puts $vm_cfg_fd {
}
if {$use_multiboot} {
if {[info exists use_multiboot_modaddr]} {
puts $vm_cfg_fd " "
} else {
puts $vm_cfg_fd { }
}
}
puts $vm_cfg_fd {
}
for {set i 0} {$i < $vcpus_to_be_used} {incr i 1} {
puts $vm_cfg_fd {
}
}
if {!$use_multiboot} {
if {$use_model_ahci} {
puts $vm_cfg_fd {
}
}
if {$use_model_ide} {
puts $vm_cfg_fd {
}
}
}
if {$use_nic_session} {
puts $vm_cfg_fd {
}
}
puts $vm_cfg_fd {
}
if {$use_multiboot} {
puts $vm_cfg_fd $multiboot_files
}
puts $vm_cfg_fd {
}
close $vm_cfg_fd
#
# Generate Genode config
#
set config {
}
append_if $use_top config {
}
append config {
}
append_if [expr !$use_usb] config {
}
append_if $use_drv_ahci config {
}
append_if [expr $use_block_sata && !$use_part_block] config {
}
append_if [expr $use_block_vdi && !$use_part_block] config {
}
append_if [expr $use_block_vdi && $use_part_block] config {
}
append_if [expr $use_block_sata && $use_part_block] config {
}
append_if $use_drv_ahci config {
}
append_if $use_part_block config {
}
append_if $use_block_ram config {
}
append_if $use_fs_rump config {
}
append_if [expr $use_fs_rump && $use_part_block] config {
}
append_if [expr $use_fs_rump && !$use_part_block] config {
}
append_if $use_fs_rump config {
}
append_if $use_block_vdi config {
}
append_if $use_genode_iso config {
}
append_platform_drv_config
append_if $use_nic_session config {
}
append_if [expr $use_nic_session && $use_nic_bridge] config {
}
append_if $use_framebuffer config {
}
append_if [expr $use_framebuffer && [have_include "power_on/qemu"]] config {
}
append_if [expr $use_framebuffer && ![have_include "power_on/qemu"]] config {
}
append_if $use_framebuffer config {
}
if {!$use_fancy_stuff} {
append config {
}
append config "
"
append config {
}
append_if [expr $use_nic_session && $use_nic_bridge] config {
}
append_if [expr $use_nic_session && !$use_nic_bridge] config {
}
append_if $use_genode_iso config {
}
append_if $use_block_vdi config {
}
append_if [expr $use_block_sata && $use_part_block] config {
}
append config {
}
}
append_if $use_usb config {
}
append config {
}
append_if $use_top config {
}
append_if $use_fancy_stuff config {
}
append config {
}
#
# Generate Launchpad config file
#
if {$use_fancy_stuff} {
set launchpad_cfg_fd [open "bin/launchpad-config" w]
puts $launchpad_cfg_fd "
"
puts $launchpad_cfg_fd {
}
puts $launchpad_cfg_fd {}
close $launchpad_cfg_fd
}
install_config $config
#
# Boot modules
#
# generic modules
set boot_modules {
rtc_drv
seoul
vm_seoul.cfg
}
lappend_if $use_block_vdi boot_modules vdi_block
lappend_if [expr !$use_usb] boot_modules ps2_drv
lappend_if $use_usb boot_modules usb_drv
lappend_if $use_vfs_block boot_modules vfs_block
lappend_if $use_vfs_block boot_modules vfs.lib.so
lappend_if $use_drv_ahci boot_modules ahci_drv
lappend_if $use_nic_session boot_modules ipxe_nic_drv
lappend_if $use_nic_bridge boot_modules nic_bridge
lappend_if $use_framebuffer boot_modules vesa_fb_drv
lappend_if $use_fancy_stuff boot_modules status_bar
lappend_if $use_fancy_stuff boot_modules launchpad
lappend_if $use_fancy_stuff boot_modules launchpad-config
lappend_if $use_fancy_stuff boot_modules report_rom
lappend_if $use_genode_iso boot_modules iso9660
lappend_if $use_genode_iso boot_modules genode.iso
lappend_if $use_block_ram boot_modules seoul-disc.raw
lappend_if $use_top boot_modules top
#
# Add OS binaries of guest
#
if {$use_multiboot} {
set guest_os_binary_missing 0
set binary_counter 0
foreach binary $guest_os_binaries {
if {![file exists bin/$binary]} {
puts stderr "Error: guest OS binary \"bin/$binary\" does not exist"
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
}
if {$guest_os_binary_missing} { exit 1 }
append boot_modules $guest_os_binaries
}
if {$use_usb} {
append qemu_args " -usb -usbdevice mouse -usbdevice keyboard "
}
append_platform_drv_boot_modules
build_boot_image $boot_modules
# A copy of the config is placed in the run folder.
exec rm -f bin/vm_seoul.cfg