genode/tool/run/load/ipxe
Christian Helmuth ada334705c run/ipxe: cleanup creation of config file
This removes strange log messages like "file8".
2016-08-30 17:17:20 +02:00

69 lines
1.5 KiB
Plaintext

##
# Load files needed by the scenario via iPXE/HTTP
#
# \param --load-ipxe-base-dir base directory of iPXE/HTTP server
# \param --load-ipxe-boot-dir boot directory relative to HTTP base
#
source [genode_dir]/tool/run/load.inc
##
# The files are loaded implicitly via iPXE/HTTP to the target machine
#
proc run_load { } {
global load_spawn_id
set load_spawn_id -1
return true
}
proc load_ipxe_base_dir { } { return [get_cmd_arg --load-ipxe-base-dir ""] }
proc load_ipxe_boot_dir { } { return [get_cmd_arg --load-ipxe-boot-dir ""] }
##
# Install files needed to boot via iPXE
#
proc install_bender_to_run_dir { } {
exec mkdir -p [run_dir]/boot
exec cp [genode_dir]/tool/boot/bender [run_dir]/boot/bender
}
##
# Create symlink for ISO image in current run directory.
#
proc create_symlink_for_iso { } {
exec ln -sfn [pwd]/[run_dir].iso [pwd]/[run_dir]/[run_name].iso
}
##
# Update iPXE boot directory to point to current run directory.
#
proc update_ipxe_boot_dir { } {
exec ln -sfn [pwd]/[run_dir] [load_ipxe_base_dir]/[load_ipxe_boot_dir]
}
##
# Create iPXE config file which directly boots an ISO file.
#
proc create_ipxe_iso_config { } {
if {[have_include "image/iso"]} {
set fh [open "[run_dir]/boot.cfg" "WRONLY CREAT TRUNC"]
puts $fh "#!ipxe"
puts $fh "sanboot [run_name].iso || goto failed"
puts $fh ""
puts $fh ":failed"
puts $fh "echo Booting failed, dropping to shell"
puts $fh "shell"
puts $fh "boot"
close $fh
} else {
puts "Warning, iPXE requires ISO image."
exit -1
}
}