genode/tool/run/boot_dir/linux
2021-05-05 11:32:09 +02:00

70 lines
2.0 KiB
Plaintext

proc binary_name_ld_lib_so { } { return "ld-linux.lib.so" }
proc binary_name_core { } { return "core-linux" }
proc binary_name_timer { } { return "linux_timer_drv" }
##
# Populate boot directory with binaries on Linux
#
proc run_boot_dir {binaries} {
if {![file exists [run_dir]/genode/ld.lib.so]} { build { lib/ld/linux } }
set missing_boot_modules { }
foreach binary $binaries {
set src_binary_path "[pwd]/bin/[kernel_specific_binary $binary]"
if {[file exists $src_binary_path]} {
exec ln -sf $src_binary_path [run_dir]/genode/$binary
} else {
lappend missing_boot_modules $binary
}
}
if {[llength $missing_boot_modules]} {
puts stderr "Missing boot modules: $missing_boot_modules"
exit -1
}
# check syntax of all boot modules named *.config
foreach file [glob -nocomplain [run_dir]/genode/*.config] {
check_xml_syntax $file }
# Save config part of the image.elf for easy inspection
exec cp -f [run_dir]/genode/config [run_dir].config
if {[have_board pc]} {
build_initrd $binaries
copy_file [genode_dir]/tool/boot/vmlinuz [run_dir]/vmlinuz
if {[have_include "image/iso"]} {
install_iso_bootloader_to_run_dir
}
if {[have_include "image/uefi"]} {
exec mkdir -p [run_dir]/efi/boot
exec cp [get_grub2_dir]/boot/grub2/grub2_32.efi [run_dir]/efi/boot/bootia32.efi
exec cp [get_grub2_dir]/boot/grub2/grub2_64.efi [run_dir]/efi/boot/bootx64.efi
exec mkdir -p [run_dir]/boot/grub
}
set fh [open "[run_dir]/boot/grub/grub.cfg" "WRONLY CREAT TRUNC"]
puts $fh "set timeout=0"
puts $fh "menuentry 'Genode on Linux' {"
puts $fh " insmod linux"
puts $fh " linux /vmlinuz console=ttyS0,115200 amd_iommu=off intel_iommu=off"
puts $fh " initrd /initrd"
puts $fh "}"
close $fh
run_image
}
}
##
# Base source archive within depot
#
proc base_src { } { return base-linux }