summaryrefslogtreecommitdiff
path: root/lib/efi_loader
diff options
context:
space:
mode:
authorIlias Apalodimas <[email protected]>2025-05-23 16:04:04 +0300
committerHeinrich Schuchardt <[email protected]>2025-05-25 11:40:15 +0200
commitf8949b1d1d0d4dc4d5abb458c59e831b9e2a0dca (patch)
tree245cf5035b0e115368d2eb0df6a2a38dc5100e66 /lib/efi_loader
parent29c449ccb5bd688bc7a347faca120c6f021e543c (diff)
efi_loader: Run dhcp if an http boot option is selected
The EFI boot manager relies on having an IP address before trying to boot an EFI HTTP(s) boot entry. However, defining it as a boot or pre-boot command is not always the right answer since it will unconditionally add delay to the board boot, even if we don't boot over the network. So let's do a DHCP request from the boot manager, if 'ipaddr' is empty and fail early if we don't have an address. Signed-off-by: Ilias Apalodimas <[email protected]> Tested-by: Michal Simek <[email protected]>
Diffstat (limited to 'lib/efi_loader')
-rw-r--r--lib/efi_loader/efi_bootmgr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index 3ef0a9e73f3..1a3461f5a9d 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -480,6 +480,13 @@ static efi_status_t try_load_from_uri_path(struct efi_device_path_uri *uridp,
if (!ctx)
return EFI_OUT_OF_RESOURCES;
+ s = env_get("ipaddr");
+ if (!s && dhcp_run(0, NULL, false)) {
+ log_err("Error: Can't find a valid IP address\n");
+ ret = EFI_DEVICE_ERROR;
+ goto err;
+ }
+
s = env_get("loadaddr");
if (!s) {
log_err("Error: loadaddr is not set\n");