mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-22 23:12:24 +00:00
427f3bb634
Patch by Roman Iten and Pirmin Duss.
80 lines
1.8 KiB
Plaintext
80 lines
1.8 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 ""] }
|
|
|
|
|
|
proc image_extension { } {
|
|
if {[have_include "image/iso"]} {
|
|
return "iso"
|
|
} elseif {[have_include "image/uefi"]} {
|
|
return "img"
|
|
} else {
|
|
puts "Warning, iPXE requires ISO or UEFI image."
|
|
exit -1
|
|
}
|
|
}
|
|
|
|
|
|
##
|
|
# 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].[image_extension] [pwd]/[run_dir]/[run_name].[image_extension]
|
|
}
|
|
|
|
##
|
|
# 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 image file.
|
|
#
|
|
# Note, the sanboot URI works relative to the script path and honors the former
|
|
# protocol too (which must be http:// not tftp://)
|
|
#
|
|
proc create_ipxe_config { } {
|
|
set fh [open "[run_dir]/boot.cfg" "WRONLY CREAT TRUNC"]
|
|
puts $fh "#!ipxe"
|
|
puts $fh "sanboot [run_name].[image_extension] || goto failed"
|
|
puts $fh ""
|
|
puts $fh ":failed"
|
|
puts $fh "echo Booting failed, dropping to shell"
|
|
puts $fh "shell"
|
|
puts $fh "boot"
|
|
close $fh
|
|
}
|