mirror of
https://github.com/ipxe/ipxe
synced 2026-05-04 03:03:43 +03:00
[efi] Use current boot option as a fallback for obtaining the boot URI
Some systems (observed with a Lenovo X1) fail to populate the loaded image device path with a Uri() component when performing a UEFI HTTP boot, instead creating a broken loaded image device path that represents a DHCP+TFTP boot that has not actually taken place. If no URI is found within the loaded image device path, then fall back to looking for a URI within the current boot option. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -81,13 +81,22 @@ EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle,
|
|||||||
static void efi_init_application ( void ) {
|
static void efi_init_application ( void ) {
|
||||||
EFI_HANDLE device = efi_loaded_image->DeviceHandle;
|
EFI_HANDLE device = efi_loaded_image->DeviceHandle;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *devpath = efi_loaded_image_path;
|
EFI_DEVICE_PATH_PROTOCOL *devpath = efi_loaded_image_path;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *bootpath;
|
||||||
struct uri *uri;
|
struct uri *uri;
|
||||||
|
|
||||||
/* Set current working URI from device path, if present */
|
/* Set current working URI from device path, if present */
|
||||||
|
bootpath = efi_current_boot_path();
|
||||||
|
DBGC ( device, "EFI has loaded image device path %s\n",
|
||||||
|
efi_devpath_text ( devpath ) );
|
||||||
|
DBGC ( device, "EFI has boot option device path %s\n",
|
||||||
|
efi_devpath_text ( bootpath ) );
|
||||||
uri = efi_path_uri ( devpath );
|
uri = efi_path_uri ( devpath );
|
||||||
|
if ( bootpath && ( ! uri ) )
|
||||||
|
uri = efi_path_uri ( bootpath );
|
||||||
if ( uri )
|
if ( uri )
|
||||||
churi ( uri );
|
churi ( uri );
|
||||||
uri_put ( uri );
|
uri_put ( uri );
|
||||||
|
free ( bootpath );
|
||||||
|
|
||||||
/* Identify autoboot device, if any */
|
/* Identify autoboot device, if any */
|
||||||
efi_set_autoboot_ll_addr ( device, devpath );
|
efi_set_autoboot_ll_addr ( device, devpath );
|
||||||
|
|||||||
Reference in New Issue
Block a user