2016-12-09 22:09:17 +00:00
|
|
|
proc binary_name_ld_lib_so { } { return "ld-nova.lib.so" }
|
2017-04-05 08:18:35 +00:00
|
|
|
proc binary_name_core_o { } { return "core-nova.o" }
|
2016-12-10 22:22:13 +00:00
|
|
|
proc binary_name_timer { } { return "nova_timer_drv" }
|
2016-12-09 22:09:17 +00:00
|
|
|
|
2017-04-03 13:39:36 +00:00
|
|
|
proc kernel_files { } { return hypervisor }
|
2016-05-28 18:54:24 +00:00
|
|
|
proc kernel_output { } { return "novga serial" }
|
2015-01-08 21:08:48 +00:00
|
|
|
|
2015-02-06 17:02:55 +00:00
|
|
|
proc run_boot_string { } {
|
2016-05-28 18:54:24 +00:00
|
|
|
return "\nHypervisor reports "
|
2015-02-06 17:02:55 +00:00
|
|
|
}
|
|
|
|
|
2018-08-06 19:43:54 +00:00
|
|
|
proc apply_microcode { } { return false }
|
2015-02-06 17:02:55 +00:00
|
|
|
|
2016-09-15 14:08:33 +00:00
|
|
|
proc core_link_address { } { return "0x100000" }
|
|
|
|
|
2017-04-03 13:39:36 +00:00
|
|
|
|
2016-09-15 14:08:33 +00:00
|
|
|
proc core_ld_opts { } {
|
|
|
|
set ret { -Wl,-T }
|
|
|
|
lappend ret "-Wl,[genode_dir]/repos/base/src/ld/genode.ld"
|
|
|
|
lappend ret "-Wl,[genode_dir]/repos/base-nova/src/core/core-bss.ld"
|
|
|
|
return $ret
|
|
|
|
}
|
|
|
|
|
2015-01-08 21:08:48 +00:00
|
|
|
##
|
|
|
|
# Populate directory with binaries on NOVA
|
|
|
|
#
|
|
|
|
proc run_boot_dir {binaries} {
|
2015-05-12 14:54:06 +00:00
|
|
|
|
2017-04-03 13:39:36 +00:00
|
|
|
#
|
|
|
|
# Build kernel-specific targets if needed
|
|
|
|
#
|
|
|
|
# If the run scripts imports the base-nova binary archive, [run_dir] is
|
|
|
|
# already populated, so we can skip the build.
|
|
|
|
#
|
|
|
|
set kernel_arg ""
|
|
|
|
set core_arg ""
|
|
|
|
set ld_arg ""
|
|
|
|
if {![file exists [run_dir]/genode/hypervisor]} { set kernel_arg kernel }
|
|
|
|
if {![file exists [run_dir]/genode/core-nova.o]} { set core_arg core/nova }
|
|
|
|
if {![file exists [run_dir]/genode/ld.lib.so]} { set ld_arg lib/ld/nova }
|
|
|
|
|
|
|
|
set targets "$kernel_arg $core_arg $ld_arg"
|
|
|
|
if {[llength $targets]} { build $targets }
|
|
|
|
|
|
|
|
if {$kernel_arg != ""} { file copy -force bin/hypervisor [run_dir]/genode/hypervisor }
|
2017-06-16 20:27:40 +00:00
|
|
|
if {$core_arg != ""} { file copy -force bin/core-nova.o [run_dir]/genode/core-nova.o }
|
2017-04-03 13:39:36 +00:00
|
|
|
if {$ld_arg != ""} { file copy -force bin/ld-nova.lib.so [run_dir]/genode/ld.lib.so }
|
2016-12-09 22:09:17 +00:00
|
|
|
|
2015-01-08 21:08:48 +00:00
|
|
|
#
|
|
|
|
# Collect contents of the ISO image
|
|
|
|
#
|
2016-09-15 14:08:33 +00:00
|
|
|
build_core_image $binaries
|
2015-01-08 21:08:48 +00:00
|
|
|
|
2018-05-02 16:26:59 +00:00
|
|
|
exec mkdir -p [run_dir]/boot
|
|
|
|
exec [cross_dev_prefix]objcopy -O elf32-i386 [run_dir]/genode/hypervisor [run_dir]/boot/hypervisor
|
|
|
|
exec [cross_dev_prefix]strip [run_dir]/boot/hypervisor
|
2015-01-08 21:08:48 +00:00
|
|
|
|
2018-05-16 09:03:59 +00:00
|
|
|
remove_genode_dir
|
2017-04-03 13:39:36 +00:00
|
|
|
|
2018-05-02 16:26:59 +00:00
|
|
|
exec mv [run_dir]/image.elf [run_dir]/boot/image.elf
|
|
|
|
|
2017-06-12 20:12:11 +00:00
|
|
|
if {[have_include "image/iso"] || [have_include "image/disk"] || [have_include image/uefi]} {
|
2017-09-09 10:11:28 +00:00
|
|
|
#
|
|
|
|
# Compress Genode image, to be uncompressed by GRUB
|
|
|
|
#
|
2018-05-02 16:26:59 +00:00
|
|
|
exec gzip [run_dir]/boot/image.elf
|
2017-09-09 10:11:28 +00:00
|
|
|
|
2017-09-20 20:56:00 +00:00
|
|
|
set serial_bender_opt ""
|
2017-09-09 10:11:28 +00:00
|
|
|
|
2018-08-06 19:43:54 +00:00
|
|
|
if {[apply_microcode]} {
|
|
|
|
exec cp bin/micro.code [run_dir]/boot/
|
|
|
|
exec cp [genode_dir]/tool/boot/microcode [run_dir]/boot/
|
|
|
|
}
|
|
|
|
|
2017-09-20 20:56:00 +00:00
|
|
|
if {[have_include "image/disk"]} {
|
|
|
|
exec mkdir -p [run_dir]/boot/grub
|
|
|
|
exec cp [genode_dir]/tool/boot/bender [run_dir]/boot/bender
|
2018-05-22 22:43:43 +00:00
|
|
|
exec cp [genode_dir]/tool/boot/boot.png [run_dir]/boot/boot.png
|
|
|
|
if {[file exists /boot/grub/unicode.pf2]} {
|
|
|
|
# needed in graphical menu with non-scrampled characters
|
|
|
|
# exec cp /boot/grub/unicode.pf2 [run_dir]/boot/grub/unicode.pf2
|
|
|
|
}
|
2017-09-20 20:56:00 +00:00
|
|
|
}
|
2017-06-12 20:12:11 +00:00
|
|
|
|
2017-09-20 20:56:00 +00:00
|
|
|
if {[have_include "image/iso"]} {
|
|
|
|
install_iso_bootloader_to_run_dir
|
2017-06-12 20:12:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if {[have_include image/uefi]} {
|
2017-09-20 20:56:00 +00:00
|
|
|
set grub2_path [get_grub2_dir]
|
|
|
|
|
2017-06-12 20:12:11 +00:00
|
|
|
exec mkdir -p [run_dir]/efi/boot
|
2017-09-20 20:56:00 +00:00
|
|
|
exec cp $grub2_path/boot/grub2/grub2_32.efi [run_dir]/efi/boot/bootia32.efi
|
|
|
|
exec cp $grub2_path/boot/grub2/grub2_64.efi [run_dir]/efi/boot/bootx64.efi
|
2017-06-12 20:12:11 +00:00
|
|
|
exec mkdir -p [run_dir]/boot/grub
|
|
|
|
exec cp [genode_dir]/tool/boot/bender [run_dir]/boot/bender
|
2017-09-20 20:56:00 +00:00
|
|
|
|
2018-05-22 22:43:43 +00:00
|
|
|
exec cp [genode_dir]/tool/boot/boot.png [run_dir]/boot/boot.png
|
|
|
|
if {[file exists /boot/grub/unicode.pf2]} {
|
|
|
|
# needed in graphical menu with non-scrampled characters
|
|
|
|
# exec cp /boot/grub/unicode.pf2 [run_dir]/boot/grub/unicode.pf2
|
|
|
|
}
|
|
|
|
|
2017-09-20 20:56:00 +00:00
|
|
|
set serial_bender_opt "serial_fallback"
|
2017-06-12 20:12:11 +00:00
|
|
|
}
|
2015-01-08 21:08:48 +00:00
|
|
|
|
|
|
|
#
|
2017-06-12 20:12:11 +00:00
|
|
|
# Generate GRUB2 config file
|
2015-01-08 21:08:48 +00:00
|
|
|
#
|
2017-06-12 20:12:11 +00:00
|
|
|
set fh [open "[run_dir]/boot/grub/grub.cfg" "WRONLY CREAT TRUNC"]
|
2018-05-22 22:43:43 +00:00
|
|
|
|
|
|
|
# If timeout != 0 is used and gfxterm, enable and add unicode.pf2 (see above)
|
|
|
|
# puts $fh "loadfont /boot/grub/unicode.pf2"
|
2017-06-12 20:12:11 +00:00
|
|
|
puts $fh "set timeout=0"
|
2018-05-22 22:43:43 +00:00
|
|
|
|
2018-06-06 11:01:54 +00:00
|
|
|
# choose best graphic mode
|
|
|
|
puts $fh "set gfxpayload=auto"
|
2018-05-22 22:43:43 +00:00
|
|
|
|
|
|
|
if {[have_include image/uefi]} {
|
|
|
|
puts $fh "insmod gfxterm"
|
|
|
|
puts $fh "terminal_output gfxterm"
|
|
|
|
puts $fh "insmod gfxterm_background"
|
|
|
|
puts $fh "insmod png"
|
|
|
|
puts $fh "background_image -m center /boot/boot.png"
|
|
|
|
}
|
|
|
|
|
|
|
|
# set this to get text console instead of graphical console
|
|
|
|
# puts $fh "terminal_input console"
|
|
|
|
# puts $fh "terminal_output console"
|
|
|
|
|
2017-06-12 20:12:11 +00:00
|
|
|
puts $fh "menuentry 'Genode on NOVA' {"
|
2017-09-20 20:56:00 +00:00
|
|
|
puts $fh " insmod multiboot2"
|
|
|
|
puts $fh " insmod gzio"
|
|
|
|
puts $fh " multiboot2 /boot/bender $serial_bender_opt"
|
2018-08-06 19:43:54 +00:00
|
|
|
if {[apply_microcode]} {
|
|
|
|
puts $fh " module2 /boot/microcode serial"
|
|
|
|
puts $fh " module2 /boot/micro.code micro.code"
|
|
|
|
}
|
2016-05-28 18:54:24 +00:00
|
|
|
puts $fh " module2 /boot/hypervisor hypervisor iommu novpid [kernel_output]"
|
2018-05-02 16:26:59 +00:00
|
|
|
puts $fh " module2 /boot/image.elf.gz image.elf"
|
2017-06-12 20:12:11 +00:00
|
|
|
puts $fh "}"
|
2015-01-08 21:08:48 +00:00
|
|
|
close $fh
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build image
|
|
|
|
#
|
|
|
|
run_image
|
|
|
|
|
|
|
|
if {[have_include "load/tftp"]} {
|
|
|
|
#
|
|
|
|
# Install PXE bootloader pulsar
|
|
|
|
#
|
|
|
|
install_pxe_bootloader_to_run_dir
|
|
|
|
|
2018-08-06 19:43:54 +00:00
|
|
|
if {[apply_microcode]} {
|
|
|
|
exec cp [genode_dir]/tool/boot/microcode [run_dir]/boot/
|
|
|
|
exec cp bin/micro.code [run_dir]/boot/
|
|
|
|
}
|
|
|
|
|
2015-01-08 21:08:48 +00:00
|
|
|
#
|
|
|
|
# Generate pulsar config file
|
|
|
|
#
|
|
|
|
set fh [open "[run_dir]/config-52-54-00-12-34-56" "WRONLY CREAT TRUNC"]
|
|
|
|
puts $fh " exec /boot/bender"
|
2018-08-06 19:43:54 +00:00
|
|
|
if {[apply_microcode]} {
|
|
|
|
puts $fh " load /boot/microcode serial"
|
|
|
|
puts $fh " load /boot/micro.code micro.code"
|
|
|
|
}
|
2016-05-28 18:54:24 +00:00
|
|
|
puts $fh " load /boot/hypervisor iommu novpid [kernel_output]"
|
2018-05-02 16:26:59 +00:00
|
|
|
puts $fh " load /boot/image.elf"
|
2015-01-08 21:08:48 +00:00
|
|
|
close $fh
|
|
|
|
|
|
|
|
generate_tftp_config
|
|
|
|
}
|
2015-08-27 17:03:57 +00:00
|
|
|
|
|
|
|
if {[have_include "load/ipxe"]} {
|
|
|
|
create_ipxe_iso_config
|
|
|
|
update_ipxe_boot_dir
|
|
|
|
create_symlink_for_iso
|
|
|
|
}
|
2015-01-08 21:08:48 +00:00
|
|
|
}
|
2017-03-29 14:04:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
# Base source archive within depot
|
|
|
|
#
|
2018-04-16 11:33:20 +00:00
|
|
|
proc base_src { } {
|
2017-03-29 14:04:07 +00:00
|
|
|
|
2018-04-16 11:33:20 +00:00
|
|
|
if {[have_spec x86]} { return base-nova }
|
|
|
|
|
|
|
|
global specs
|
|
|
|
|
|
|
|
puts stderr "Test requires base-nova kernel archive, which is missing for this build configuration"
|
|
|
|
puts stderr " SPECS=\"$specs\""
|
|
|
|
exit 0
|
|
|
|
}
|