run: support loading images via iPXE/HTTP

iPXE is an open source network boot firmware which supports booting from
a web server via HTTP [1].

The following two parameters can be used to specify the iPXE/HTTP setup:

--load-ipxe-base-dir
  This parameter specifies the base directory of the HTTP server from
  which the target machine downloads the files.

--load-ipxe-boot-dir
  The directory relative to iPXE base dir which contains the iPXE
  chainload configuration and all necessary files.

The target machine is expected to request the following iPXE
configuration via HTTP:

http://${HOST_URL}/${ipxe-boot-dir}/boot.cfg

This can be achieved by building iPXE with the following embedded
script:

  #!ipxe
  dhcp
  chain http://${HOST_URL}/${ipxe-boot-dir}/boot.cfg

See also [2] for additional information.

[1] - http://ipxe.org/
[2] - http://ipxe.org/howto/chainloading#breaking_the_loop_with_an_embedded_script

Fixes #1708
This commit is contained in:
Adrian-Ken Rueegsegger 2015-08-27 18:23:05 +02:00 committed by Christian Helmuth
parent ccb968ff7d
commit 94afc1a340
1 changed files with 48 additions and 0 deletions

48
tool/run/load/ipxe Normal file
View File

@ -0,0 +1,48 @@
##
# 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]
}