aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2026-06-26 14:45:55 +0000
committerWarner Losh <imp@FreeBSD.org>2026-06-26 14:54:36 +0000
commit82eb1970759de3fb7eacbbfc1e53bf64bf48dfe4 (patch)
treef2ab59a688d537c56c3d6b7fdaa28020b45002a7
parentce9bfd781679ba67123345352a754c2e2dd1ef0b (diff)
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
-rw-r--r--stand/efi/loader/main.c18
1 files 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);
/*