2022-09-05 11:34:36 +00:00
|
|
|
#
|
|
|
|
# Return Bender option that configures Bender's Intel HWP plugin
|
|
|
|
#
|
|
|
|
# \param --bender-intel-hwp-mode Run the Intel HWP plugin of Bender in the
|
|
|
|
# given mode. Valid argument values are
|
|
|
|
# "off",
|
|
|
|
# "performance",
|
|
|
|
# "balanced", and
|
|
|
|
# "power_saving"
|
|
|
|
# The argument value defaults to
|
|
|
|
# "performance".
|
|
|
|
#
|
|
|
|
proc bender_intel_hwp_mode_option { } {
|
|
|
|
|
|
|
|
set opt [get_cmd_arg_first --bender-intel-hwp-mode "performance"]
|
|
|
|
if {$opt == "off"} {
|
|
|
|
return "intel_hwp_off"
|
|
|
|
} elseif {$opt == "performance"} {
|
|
|
|
return "intel_hwp_performance"
|
|
|
|
} elseif {$opt == "balanced"} {
|
|
|
|
return "intel_hwp_balanced"
|
|
|
|
} elseif {$opt == "power_saving"} {
|
|
|
|
return "intel_hwp_power_saving"
|
|
|
|
} else {
|
|
|
|
return "intel_hwp_performance"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-09 22:09:17 +00:00
|
|
|
proc binary_name_ld_lib_so { } { return "ld-nova.lib.so" }
|
2021-02-19 14:23:49 +00:00
|
|
|
proc binary_name_core_a { } { return "core-nova.a" }
|
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 { } {
|
2020-03-26 11:13:47 +00:00
|
|
|
return "\nHypervisor NOVA "
|
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 }
|
2021-02-19 14:23:49 +00:00
|
|
|
if {![file exists [run_dir]/genode/core-nova.a]} { set core_arg core/nova }
|
2022-09-01 11:12:13 +00:00
|
|
|
if {![file exists [run_dir]/genode/ld.lib.so]} { set ld_arg lib/ld-nova }
|
2017-04-03 13:39:36 +00:00
|
|
|
|
|
|
|
set targets "$kernel_arg $core_arg $ld_arg"
|
|
|
|
if {[llength $targets]} { build $targets }
|
|
|
|
|
2021-04-14 08:10:25 +00:00
|
|
|
if {$kernel_arg != ""} { copy_file bin/hypervisor [run_dir]/genode/hypervisor }
|
|
|
|
if {$core_arg != ""} { copy_file bin/core-nova.a [run_dir]/genode/core-nova.a }
|
|
|
|
if {$ld_arg != ""} { copy_file 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
|
|
|
#
|
2022-07-08 07:16:06 +00:00
|
|
|
# Collect contents of the boot image
|
2015-01-08 21:08:48 +00:00
|
|
|
#
|
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
|
|
|
|
|
2020-10-28 13:55:10 +00:00
|
|
|
#
|
|
|
|
# Setup bender and plugins
|
|
|
|
#
|
|
|
|
set options_bender ""
|
|
|
|
|
2021-03-05 16:19:17 +00:00
|
|
|
#
|
2022-09-05 11:34:36 +00:00
|
|
|
# Apply Intel HWP mode
|
2021-03-05 16:19:17 +00:00
|
|
|
#
|
2022-09-05 11:34:36 +00:00
|
|
|
append options_bender " [bender_intel_hwp_mode_option]"
|
2021-03-05 16:19:17 +00:00
|
|
|
|
2020-10-28 13:55:10 +00:00
|
|
|
if {[apply_microcode]} {
|
|
|
|
exec cp bin/micro.code [run_dir]/boot/
|
|
|
|
append options_bender " microcode"
|
|
|
|
}
|
|
|
|
|
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
|
|
|
if {[have_include "image/disk"]} {
|
2023-01-27 07:05:29 +00:00
|
|
|
install_disk_bootloader_to_run_dir
|
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]} {
|
2023-01-27 06:57:52 +00:00
|
|
|
install_uefi_bootloader_to_run_dir
|
2020-10-28 13:55:10 +00:00
|
|
|
append options_bender " 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
|
|
|
|
2023-01-25 13:02:16 +00:00
|
|
|
# If timeout != 0 is used a font is required in graphic mode
|
|
|
|
puts $fh "loadfont /boot/font.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
|
2020-09-19 18:52:22 +00:00
|
|
|
# uncomment line to get vga console working in hypervisor
|
2018-06-06 11:01:54 +00:00
|
|
|
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"
|
2020-10-28 13:55:10 +00:00
|
|
|
puts $fh " multiboot2 /boot/bender $options_bender"
|
2018-08-06 19:43:54 +00:00
|
|
|
if {[apply_microcode]} {
|
|
|
|
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
|
|
|
|
|
|
|
|
#
|
|
|
|
# Generate pulsar config file
|
|
|
|
#
|
|
|
|
set fh [open "[run_dir]/config-52-54-00-12-34-56" "WRONLY CREAT TRUNC"]
|
2020-10-28 13:55:10 +00:00
|
|
|
puts $fh " exec /boot/bender $options_bender"
|
2018-08-06 19:43:54 +00:00
|
|
|
if {[apply_microcode]} {
|
|
|
|
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"]} {
|
2022-07-08 07:16:06 +00:00
|
|
|
create_ipxe_config
|
2015-08-27 17:03:57 +00:00
|
|
|
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
|
|
|
|
}
|