diff --git a/tool/run/boot_dir/fiasco b/tool/run/boot_dir/fiasco index 6696655bab..8fddda0e61 100644 --- a/tool/run/boot_dir/fiasco +++ b/tool/run/boot_dir/fiasco @@ -99,7 +99,7 @@ proc run_boot_dir {binaries} { } if {[have_include "load/ipxe"]} { - create_ipxe_iso_config + create_ipxe_config update_ipxe_boot_dir create_symlink_for_iso } diff --git a/tool/run/boot_dir/foc b/tool/run/boot_dir/foc index 196a8f385d..e529c4aad6 100644 --- a/tool/run/boot_dir/foc +++ b/tool/run/boot_dir/foc @@ -146,7 +146,7 @@ proc run_boot_dir_x86 {binaries} { } if {[have_include "load/ipxe"]} { - create_ipxe_iso_config + create_ipxe_config update_ipxe_boot_dir create_symlink_for_iso } diff --git a/tool/run/boot_dir/nova b/tool/run/boot_dir/nova index 8ca43dba19..06d05ce1be 100644 --- a/tool/run/boot_dir/nova +++ b/tool/run/boot_dir/nova @@ -47,7 +47,7 @@ proc run_boot_dir {binaries} { if {$ld_arg != ""} { copy_file bin/ld-nova.lib.so [run_dir]/genode/ld.lib.so } # - # Collect contents of the ISO image + # Collect contents of the boot image # build_core_image $binaries @@ -177,7 +177,7 @@ proc run_boot_dir {binaries} { } if {[have_include "load/ipxe"]} { - create_ipxe_iso_config + create_ipxe_config update_ipxe_boot_dir create_symlink_for_iso } diff --git a/tool/run/boot_dir/sel4 b/tool/run/boot_dir/sel4 index 1d169368ef..75a077630e 100644 --- a/tool/run/boot_dir/sel4 +++ b/tool/run/boot_dir/sel4 @@ -147,7 +147,7 @@ proc run_boot_dir {binaries} { } if {[have_spec x86] && [have_include "load/ipxe"]} { - create_ipxe_iso_config + create_ipxe_config update_ipxe_boot_dir create_symlink_for_iso } diff --git a/tool/run/load/ipxe b/tool/run/load/ipxe index 7c71ceed5c..a8952619e4 100644 --- a/tool/run/load/ipxe +++ b/tool/run/load/ipxe @@ -25,6 +25,18 @@ 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 # @@ -38,7 +50,7 @@ proc install_bender_to_run_dir { } { # 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 + exec ln -sfn [pwd]/[run_dir].[image_extension] [pwd]/[run_dir]/[run_name].[image_extension] } ## @@ -49,21 +61,19 @@ proc update_ipxe_boot_dir { } { } ## -# Create iPXE config file which directly boots an ISO file. +# Create iPXE config file which directly boots an image 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 - } +# 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 }