diff options
author | Yongbo Yao <yongbo.yao@dell.com> | 2021-04-07 18:33:22 +0000 |
---|---|---|
committer | Eric van Gyzen <vangyzen@FreeBSD.org> | 2021-04-07 18:40:57 +0000 |
commit | 5984246f9626fbc3d356ee2d3b3cd159f6d0a7c2 (patch) | |
tree | de2709528d01fb2b7555083604162ecab20ef8e3 /stand/efi/loader | |
parent | 0f07c234ca1d3ccce158bb68c03829a266942c6e (diff) | |
download | src-5984246f9626fbc3d356ee2d3b3cd159f6d0a7c2.tar.gz src-5984246f9626fbc3d356ee2d3b3cd159f6d0a7c2.zip |
Loader: support booting OS from memory disk (MD)
Until now, the boot image can be embedded into the loader with
/sys/tools/embed_mfs.sh, and memory disk (MD) is already supported
in loader source. But due to memory disk (MD) driver isn't registered
to the loader yet, the boot image can't be boot from embedded memory
disk.
Reviewed by: dab, tsoome
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29512
Diffstat (limited to 'stand/efi/loader')
-rw-r--r-- | stand/efi/loader/conf.c | 7 | ||||
-rw-r--r-- | stand/efi/loader/main.c | 24 |
2 files changed, 31 insertions, 0 deletions
diff --git a/stand/efi/loader/conf.c b/stand/efi/loader/conf.c index 217372939685..863c9188c72c 100644 --- a/stand/efi/loader/conf.c +++ b/stand/efi/loader/conf.c @@ -35,6 +35,10 @@ __FBSDID("$FreeBSD$"); extern struct devsw vdisk_dev; +#ifdef MD_IMAGE_SIZE +extern struct devsw md_dev; +#endif + struct devsw *devsw[] = { &efipart_fddev, &efipart_cddev, @@ -47,6 +51,9 @@ struct devsw *devsw[] = { #ifdef EFI_ZFS_BOOT &zfs_dev, #endif +#ifdef MD_IMAGE_SIZE + &md_dev, +#endif NULL }; diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index 32b278950745..ae32960e4049 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -296,6 +296,21 @@ probe_zfs_currdev(uint64_t guid) } #endif +#ifdef MD_IMAGE_SIZE +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) { @@ -569,6 +584,15 @@ find_currdev(bool do_bootmgr, bool is_last, } #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()) + return (0); +#endif /* MD_IMAGE_SIZE */ + /* * Try to find the block device by its handle based on the * image we're booting. If we can't find a sane partition, |