]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[efi] Automatically load "/autoexec.ipxe" when booted from a filesystem
authorMichael Brown <mcb30@ipxe.org>
Mon, 25 Jan 2021 16:34:22 +0000 (16:34 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 25 Jan 2021 17:04:44 +0000 (17:04 +0000)
commita3f1e8fb6707811e6eb90e339d7ebe813fd89a63
treed97f693d64a39191a02f472f8fdc3ca4f02a80e0
parent989a7a8032db02eb0524bd78a674d3b087dea3a6
[efi] Automatically load "/autoexec.ipxe" when booted from a filesystem

When booting iPXE from a filesystem (e.g. a FAT-formatted USB key) it
can be useful to have an iPXE script loaded automatically from the
same filesystem.  Compared to using an embedded script, this has the
advantage that the script can be edited without recompiling the iPXE
binary.

For the BIOS version of iPXE, loading from a filesystem is handled
using syslinux (or isolinux) which allows the script to be passed to
the iPXE .lkrn image as an initrd.

For the UEFI version of iPXE, the platform firmware loads the iPXE
.efi image directly and there is currently no equivalent of the BIOS
initrd mechanism.

Add support for automatically loading a file "autoexec.ipxe" (if
present) from the root of the filesystem containing the UEFI iPXE
binary.

A combined BIOS and UEFI image for a USB key can be created using e.g.

  ./util/genfsimg -o usbkey.img -s myscript.ipxe \
      bin-x86_64-efi/ipxe.efi bin/ipxe.lkrn

The file "myscript.ipxe" would appear as "autoexec.ipxe" on the USB
key, and would be loaded automatically on both BIOS and UEFI systems.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/errfile.h
src/interface/efi/efi_autoboot.c
src/util/genfsimg