loader.efi: Move probing the md up to before doing bootmgr

When someone has loaded a ram disk, that's a stronger hint about what to
boot than the UEFI boot manager. Prefer it and rework a little the #ifdefs
to reduce their number.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D59419
This commit is contained in:
Warner Losh committed 2026-09-10 22:15:27 -06:00
1 parent 752bde7da6
commit 69d1595ded
2 files changed
+12 -19

No files matched your search

+1 -5
View File
@@ -32,10 +32,6 @@
extern struct devsw vdisk_dev;
#ifdef MD_IMAGE_SIZE
extern struct devsw md_dev;
#endif
struct devsw *devsw[] = {
&efipart_fddev,
&efipart_cddev,
@@ -48,7 +44,7 @@ struct devsw *devsw[] = {
#ifdef EFI_ZFS_BOOT
&zfs_dev,
#endif
#ifdef MD_IMAGE_SIZE
#if defined(LOADER_MD_SUPPORT)
&md_dev,
#endif
NULL
+11 -14
View File
@@ -324,12 +324,10 @@ probe_zfs_currdev(uint64_t guid)
}
#endif
#ifdef MD_IMAGE_SIZE
extern struct devsw md_dev;
static bool
probe_md_currdev(void)
{
#ifdef LOADER_MD_SUPPORT
bool rv;
set_currdev_devsw(&md_dev, 0);
@@ -337,8 +335,10 @@ probe_md_currdev(void)
if (!rv)
printf("MD not present\n");
return (rv);
}
#else
return (false);
#endif
}
/*
* Try the passed in partition or entire disk to see if we can find a bootable
@@ -646,7 +646,13 @@ find_currdev(bool do_bootmgr, char *boot_info, size_t boot_info_sz)
} while (0);
/*
* Third choice: If we can find out image boot_info, and there's
* Third choice: If there is an MD device, try to use that.
*/
if (probe_md_currdev())
return (0);
/*
* Forth choice: If we can find out image boot_info, and there's
* a follow-on boot image in that boot_info, use that. In this
* case root will be the partition specified in that image and
* we'll load the kernel specified by the file path. Should there
@@ -664,15 +670,6 @@ find_currdev(bool do_bootmgr, char *boot_info, size_t boot_info_sz)
} /* Nothing specified, try normal match */
}
#ifdef MD_IMAGE_SIZE
/*
* Forth choice: If there is an embedded MD, try to use that.
*/
printf("Trying configured MD\n");
if (probe_md_currdev())
return (0);
#endif /* MD_IMAGE_SIZE */
/*
* Fifth choice: try all the partitions on the boot device.
*/