From: Michael Brown Date: Tue, 19 Mar 2024 15:13:59 +0000 (+0000) Subject: [efi] Set current working URI from our own device path URI, if present X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=390bce9516ce3a4adf599762b6c965813332595e;p=thirdparty%2Fipxe.git [efi] Set current working URI from our own device path URI, if present When booted via HTTP, our loaded image's device path will include the URI from which we were downloaded. Set this as the current working URI, so that an embedded script may perform subsequent downloads relative to the iPXE binary, or construct explicit relative paths via the ${cwduri} setting. Signed-off-by: Michael Brown --- diff --git a/src/interface/efi/efiprefix.c b/src/interface/efi/efiprefix.c index 261160681..f6395b65b 100644 --- a/src/interface/efi/efiprefix.c +++ b/src/interface/efi/efiprefix.c @@ -22,6 +22,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include +#include #include #include #include @@ -30,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include +#include #include /** @@ -80,6 +82,12 @@ static void efi_init_application ( void ) { EFI_HANDLE device = efi_loaded_image->DeviceHandle; EFI_DEVICE_PATH_PROTOCOL *devpath = efi_loaded_image_path; EFI_DEVICE_PATH_PROTOCOL *filepath = efi_loaded_image->FilePath; + struct uri *uri; + + /* Set current working URI from device path, if present */ + uri = efi_path_uri ( devpath ); + if ( uri ) + churi ( uri ); /* Identify autoboot device, if any */ efi_set_autoboot_ll_addr ( device, devpath ); @@ -89,6 +97,9 @@ static void efi_init_application ( void ) { /* Load autoexec script, if any */ efi_autoexec_load ( device, filepath ); + + /* Drop temporary reference to URI */ + uri_put ( uri ); } /** EFI application initialisation function */