Changeset View
Standalone View
stand/efi/loader/main.c
Show First 20 Lines • Show All 290 Lines • ▼ Show 20 Lines | if (buf != NULL) { | ||||
free(buf); | free(buf); | ||||
(void) zfs_attach_nvstore(&currdev); | (void) zfs_attach_nvstore(&currdev); | ||||
} | } | ||||
} | } | ||||
return (rv); | return (rv); | ||||
} | } | ||||
#endif | #endif | ||||
#ifdef MD_IMAGE_SIZE | |||||
static bool | static bool | ||||
probe_md_currdev(void) | |||||
{ | |||||
extern struct devsw md_dev; | |||||
bool rv; | |||||
set_currdev_devsw(&md_dev, 0); | |||||
rv = sanity_check_currdev(); | |||||
if (!rv) | |||||
printf("MD not present\n"); | |||||
return (rv); | |||||
} | |||||
#endif | |||||
static bool | |||||
try_as_currdev(pdinfo_t *hd, pdinfo_t *pp) | try_as_currdev(pdinfo_t *hd, pdinfo_t *pp) | ||||
{ | { | ||||
uint64_t guid; | uint64_t guid; | ||||
#ifdef EFI_ZFS_BOOT | #ifdef EFI_ZFS_BOOT | ||||
/* | /* | ||||
* If there's a zpool on this device, try it as a ZFS | * If there's a zpool on this device, try it as a ZFS | ||||
* filesystem, which has somewhat different setup than all | * filesystem, which has somewhat different setup than all | ||||
▲ Show 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | #ifdef EFI_ZFS_BOOT | ||||
* rather than the bootenv stuff that FreeBSD uses today. | * rather than the bootenv stuff that FreeBSD uses today. | ||||
*/ | */ | ||||
if (pool_guid != 0) { | if (pool_guid != 0) { | ||||
printf("Trying ZFS pool\n"); | printf("Trying ZFS pool\n"); | ||||
if (probe_zfs_currdev(pool_guid)) | if (probe_zfs_currdev(pool_guid)) | ||||
return (0); | return (0); | ||||
} | } | ||||
#endif /* EFI_ZFS_BOOT */ | #endif /* EFI_ZFS_BOOT */ | ||||
#ifdef MD_IMAGE_SIZE | |||||
/* | |||||
* If there is an embedded MD, try to use that. | |||||
*/ | |||||
printf("Trying MD\n"); | |||||
if (probe_md_currdev()) | |||||
kevans: I suspect md is pretty niche and we have no problem with this in concept, but md probe should… | |||||
Not Done Inline Actions(The problem is that you don't want to subvert the boot protocol if you otherwise did everything right to configure a partition to boot, e.g., maybe some kind of kevans: (The problem is that you don't want to subvert the boot protocol if you otherwise did… | |||||
Done Inline Actionsmd in loader stands for embedded memory disk, it is a specific case and not built in loader by default. In generic build, it wouldn't subvert the boot protocol. yongbo.yao_dell.com: md in loader stands for embedded memory disk, it is a specific case and not built in loader by… | |||||
Not Done Inline Actions(The specific problem I'm thinking of here is that you might accidentally subvert the boot protocol if you have an md setup but wanted to configure the firmware to boot off of, e.g., some kind of static rescue partition) kevans: (The specific problem I'm thinking of here is that you might accidentally subvert the boot… | |||||
Not Done Inline ActionsYea, I'm not sure this code would handle the case where we want root to be the md disk, but there's also another partition that could be root available. For the usecase with pxeboot, this won't matter, but might if we're booting off stable media that has other UFS partitions on it. imp: Yea, I'm not sure this code would handle the case where we want root to be the md disk, but… | |||||
Done Inline ActionsThere are three choices rootdev/uefi_rootdev/do_bootmgr before md. If they are not assigned, it will boot from md yongbo.yao_dell.com: There are three choices `rootdev`/`uefi_rootdev`/`do_bootmgr` before md. If they are not… | |||||
Done Inline ActionsIt can not be moved down. As Warner said, If md moves down, it can not handle the case where we want root to be the md disk, but there's also another partition that could be root available yongbo.yao_dell.com: It can not be moved down. As Warner said, If md moves down, it can not handle the case where we… | |||||
Not Done Inline ActionsYup, sorry, I've re-read the context below- kevans: Yup, sorry, I've re-read the context below- | |||||
return (0); | |||||
#endif /* MD_IMAGE_SIZE */ | |||||
/* | /* | ||||
* Try to find the block device by its handle based on the | * Try to find the block device by its handle based on the | ||||
* image we're booting. If we can't find a sane partition, | * image we're booting. If we can't find a sane partition, | ||||
* search all the other partitions of the disk. We do not | * search all the other partitions of the disk. We do not | ||||
* search other disks because it's a violation of the UEFI | * search other disks because it's a violation of the UEFI | ||||
* boot protocol to do so. We fail and let UEFI go on to | * boot protocol to do so. We fail and let UEFI go on to | ||||
* the next candidate. | * the next candidate. | ||||
▲ Show 20 Lines • Show All 1,056 Lines • Show Last 20 Lines |
I suspect md is pretty niche and we have no problem with this in concept, but md probe should likely move down since it's effectively "searching other disks" and we haven't exhausted all of the partitions on "this disk" yet.