aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2021-01-25 16:34:22 +0000
committerMichael Brown <mcb30@ipxe.org>2021-01-25 17:04:44 +0000
commita3f1e8fb6707811e6eb90e339d7ebe813fd89a63 (patch)
treed97f693d64a39191a02f472f8fdc3ca4f02a80e0 /src/util
parent989a7a8032db02eb0524bd78a674d3b087dea3a6 (diff)
downloadipxe-a3f1e8fb6707811e6eb90e339d7ebe813fd89a63.tar.gz
[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>
Diffstat (limited to 'src/util')
-rwxr-xr-xsrc/util/genfsimg3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/util/genfsimg b/src/util/genfsimg
index 345673460..d31e4995d 100755
--- a/src/util/genfsimg
+++ b/src/util/genfsimg
@@ -203,6 +203,9 @@ for FILENAME ; do
DESTFILE=$(efi_boot_name "${FILENAME}")
if [ -z "${EFI}" ] ; then
mkdir -p "${DESTDIR}"
+ if [ -n "${SCRIPT}" ] ; then
+ cp "${SCRIPT}" "${FATDIR}/autoexec.ipxe"
+ fi
fi
EFI=1
;;