From 8eec0928518366f9a2422daecfc572225381e5ea Mon Sep 17 00:00:00 2001 From: Adrian-Ken Rueegsegger Date: Thu, 27 Aug 2015 19:03:57 +0200 Subject: [PATCH] Add support for ipxe load (nova, foc, fiasco) This makes use of the iPXE sanboot command [1] which downloads and boots an ISO image directly via HTTP. Therefore, your RUN_OPT needs both --include image/iso and --include load/ipxe NOTE: The webserver serving the ISO image must support ranged requests, see [2]. [1] - http://ipxe.org/cmd/sanboot [2] - http://forum.ipxe.org/showthread.php?tid=7295&pid=10482#pid10482 --- tool/run/boot_dir/fiasco | 6 ++++++ tool/run/boot_dir/foc | 6 ++++++ tool/run/boot_dir/nova | 6 ++++++ tool/run/load/ipxe | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+) diff --git a/tool/run/boot_dir/fiasco b/tool/run/boot_dir/fiasco index 52ed15d15..87bd541ca 100644 --- a/tool/run/boot_dir/fiasco +++ b/tool/run/boot_dir/fiasco @@ -144,4 +144,10 @@ proc run_boot_dir {binaries} { generate_tftp_config } + + if {[have_include "load/ipxe"]} { + create_ipxe_iso_config + update_ipxe_boot_dir + create_symlink_for_iso + } } diff --git a/tool/run/boot_dir/foc b/tool/run/boot_dir/foc index bc3a70ec1..14d009e75 100644 --- a/tool/run/boot_dir/foc +++ b/tool/run/boot_dir/foc @@ -183,6 +183,12 @@ proc run_boot_dir_x86 {binaries} { generate_tftp_config } + + if {[have_include "load/ipxe"]} { + create_ipxe_iso_config + update_ipxe_boot_dir + create_symlink_for_iso + } } diff --git a/tool/run/boot_dir/nova b/tool/run/boot_dir/nova index 5fd3871ee..60d852945 100644 --- a/tool/run/boot_dir/nova +++ b/tool/run/boot_dir/nova @@ -93,4 +93,10 @@ proc run_boot_dir {binaries} { generate_tftp_config } + + if {[have_include "load/ipxe"]} { + create_ipxe_iso_config + update_ipxe_boot_dir + create_symlink_for_iso + } } diff --git a/tool/run/load/ipxe b/tool/run/load/ipxe index 40c0e6fb4..d673ac70f 100644 --- a/tool/run/load/ipxe +++ b/tool/run/load/ipxe @@ -46,3 +46,23 @@ proc create_symlink_for_iso { } { 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 + } +}