genode/tool/run/load/ipxe
Adrian-Ken Rueegsegger 9cb71d0260 run: Move shared procedure to load/pxe.inc
The install_pxe_bootloader_to_run_dir procedure is required by the tftp
as well as the ipxe load script. Move it to a separate file which is
include by both.
2018-03-08 12:05:04 +01:00

70 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
source [genode_dir]/tool/run/load/pxe.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
}
}