git: 197df29edb39 - main - loader.efi: Only try to download md if we're netbooting
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 12 Sep 2026 18:19:13 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=197df29edb39782464276701f8fd9891793d4979
commit 197df29edb39782464276701f8fd9891793d4979
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2026-09-11 16:05:16 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-09-12 16:59:17 +0000
loader.efi: Only try to download md if we're netbooting
The only possible time we could download the initmd that the dhcp server
told us about is if we're netbooting. So only attempt to do that if the
load device for loader.efi is a network. IF you are booting off disk and
then need to snag an initmd off the network, that's a different path,
and wouldn't need to necessarily do a dhcp exchange, except to get the
IP address.
Sponsored by: Netflix
---
stand/efi/loader/main.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index 95aa64191fe5..488e3eb1100b 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -1273,6 +1273,16 @@ set_boot_policy(void)
policy, policy_map[boot_policy]);
}
+static bool
+is_efi_netboot(void)
+{
+ EFI_DEVICE_PATH *devpath;
+ uint8_t mac[6];
+
+ devpath = efi_lookup_devpath(boot_img->DeviceHandle);
+ return (efi_devpath_get_mac(devpath, mac));
+}
+
EFI_STATUS
main(int argc, CHAR16 *argv[])
{
@@ -1360,7 +1370,12 @@ main(int argc, CHAR16 *argv[])
efiblk_memdisk_preload();
devinit();
- if (!has_ipxe)
+
+ /*
+ * If we didn't find a ipxe image, and we're netbooting, try to
+ * download an initmd that the dhcp server tells us about.
+ */
+ if (!has_ipxe && is_efi_netboot())
maybe_download_initmd();
/*