run: add microcode chain bootloader to nova

Fixes #2762
This commit is contained in:
Alexander Boettcher 2018-08-06 21:43:54 +02:00 committed by Christian Helmuth
parent 237f6a6a62
commit a149131dc2
6 changed files with 47 additions and 8 deletions

View File

@ -1,5 +1,9 @@
assert_spec x86
set ::env(MAKEFLAGS) s
set path_microcode "[exec [genode_dir]/tool/ports/current microcode_intel]/src/app/intel/intel-ucode"
set microcode_files [glob -nocomplain -dir $path_microcode *-*-*]
if { [get_cmd_switch --autopilot] } {
if {[have_include "power_on/qemu"]} {
@ -9,8 +13,23 @@ if { [get_cmd_switch --autopilot] } {
# platform_info data about CPUs on other kernels missing
assert_spec nova
if { [have_spec x86_64] } {
file copy -force $path_microcode/06-3c-03 bin/micro.code
} else {
file copy -force $path_microcode/06-17-06 bin/micro.code
}
}
if {![file exists bin/micro.code]} {
puts "\nMissing bin/micro.code file for your target machine."
puts "Please select for your target CPU the microcode patch located in $path_microcode/xx-xx-xx."
puts "and copy it to bin/micro.code. xx-xx-xx stands for your target CPU, family-model-stepping\n"
exit 0
}
proc apply_microcode { } { return true }
build "core init test/microcode"
create_boot_directory
@ -33,10 +52,6 @@ install_config {
</config>
}
set ::env(MAKEFLAGS) s
set path_microcode [exec [genode_dir]/tool/ports/current microcode_intel]
set microcode_files [glob -dir $path_microcode/src/app/intel *-*-*]
file copy -force {*}$microcode_files bin/
@ -57,6 +72,7 @@ run_genode_until "microcode check done" 30
# cleanup
if { [get_cmd_switch --autopilot] } {
file delete -force bin/micro.code
foreach file $microcode_files {
file delete bin/$file
}

View File

@ -128,3 +128,4 @@ vmm
weak_ptr
xml_generator
xml_node
microcode

View File

@ -2,16 +2,19 @@ This directory contains boot-loader files needed to boot Genode and to create
boot images. The tools are available in binary form. Pointers to the source
code respectively the download source of binaries are described below.
:'bender'
:'bender', 'microcode'
The 'bender' tool is part of the 'morbo' toolchain available under GPL.
The tools are part of the 'morbo' toolchain available under GPL.
The toolchain was obtained from https://github.com/TUD-OS/morbo.
For Genode the bender was modified so that binaries are only relocated up
For Genode bender was modified so that binaries are only relocated up
to 2G physical. Additional, relocation can be limited to 256M for sel4.
The microcode tools expect to find a module named micro.code which contains
a valid Intel microcode file for the target CPU.
The changes are available from
https://github.com/alex-ab/morbo.git.
branch genode_bender, git commit e4744198ed481886c48e3dee12c1fbd47411770f
git commit 003016e096fa132e2086b4db52d1fd965dbd7363
:'pulsar':

Binary file not shown.

BIN
tool/boot/microcode Normal file

Binary file not shown.

View File

@ -9,6 +9,7 @@ proc run_boot_string { } {
return "\nHypervisor reports "
}
proc apply_microcode { } { return false }
proc core_link_address { } { return "0x100000" }
@ -66,6 +67,11 @@ proc run_boot_dir {binaries} {
set serial_bender_opt ""
if {[apply_microcode]} {
exec cp bin/micro.code [run_dir]/boot/
exec cp [genode_dir]/tool/boot/microcode [run_dir]/boot/
}
if {[have_include "image/disk"]} {
exec mkdir -p [run_dir]/boot/grub
exec cp [genode_dir]/tool/boot/bender [run_dir]/boot/bender
@ -126,6 +132,10 @@ proc run_boot_dir {binaries} {
puts $fh " insmod multiboot2"
puts $fh " insmod gzio"
puts $fh " multiboot2 /boot/bender $serial_bender_opt"
if {[apply_microcode]} {
puts $fh " module2 /boot/microcode serial"
puts $fh " module2 /boot/micro.code micro.code"
}
puts $fh " module2 /boot/hypervisor hypervisor iommu novpid [kernel_output]"
puts $fh " module2 /boot/image.elf.gz image.elf"
puts $fh "}"
@ -143,11 +153,20 @@ proc run_boot_dir {binaries} {
#
install_pxe_bootloader_to_run_dir
if {[apply_microcode]} {
exec cp [genode_dir]/tool/boot/microcode [run_dir]/boot/
exec cp bin/micro.code [run_dir]/boot/
}
#
# Generate pulsar config file
#
set fh [open "[run_dir]/config-52-54-00-12-34-56" "WRONLY CREAT TRUNC"]
puts $fh " exec /boot/bender"
if {[apply_microcode]} {
puts $fh " load /boot/microcode serial"
puts $fh " load /boot/micro.code micro.code"
}
puts $fh " load /boot/hypervisor iommu novpid [kernel_output]"
puts $fh " load /boot/image.elf"
close $fh