From 82eb1970759de3fb7eacbbfc1e53bf64bf48dfe4 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 26 Jun 2026 08:45:55 -0600 Subject: [PATCH] loader.efi: Expand uefi_rootdev to probe disks uefi_rootdev had to be the exact device to work. This is often difficult to arrange and awkward. Instead, have it search the specified device: As a partition if it specifies the partition, and as the whole disk if the specified partition didn't work or it specifies a disk. This brings it into lone what we do with other devices. This overrides the boot manager search we do before we do this for the boot device, but this knob has always been meant to overload the boot manager search. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D57803 --- stand/efi/loader/main.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index 961ccc8f7065..78b397ca6870 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -629,10 +629,20 @@ find_currdev(bool do_bootmgr, char *boot_info, size_t boot_info_sz) efi_devpath_free(devpath); if (dp == NULL) break; - printf(" Setting currdev to UEFI path %s\n", - rootdev); - set_currdev_pdinfo(dp); - return (0); + printf(" Trying uefi_rootdev %s\n", rootdev); + /* if just a partition, just try that */ + h = NULL; + if (dp->pd_parent != NULL) { + if (try_as_currdev(dp, false)) + return (0); + /* That failed? Try the whole disk, but skip this part */ + h = dp->pd_handle; + dp = dp->pd_parent; + } + /* otherwise, it's a full disk, so try all its partitions */ + if (try_disk_and_partitions(dp, h) == 0) + return (0); + break; } while (0); /*