Filter non-UEFI drives


Tim Crawford
 

Thanks Ashish, that looks useful for keeping some of our custom logic out of MdeModulePkg. I've added it to my list of things to do for rebasing on edk2 master.


Ashish Singhal
 

Hello Tim,

I had a similar issue some time back and after discussion with edk2 community, I added a new protocol to MdeModulePkg that allows platform-specific hooks to take care of this. Please refer to commit 972d88726410e21b1fff1a528854202c67e97ef1 to see what has been added.

In your implementation of RefreshAllBootOptions api, you can parse the auto enumerated boot options (generated by BmEnumerateBootOptions()) and return back only the ones which you want to use.

Thanks
Ashish

On Wed, Feb 5, 2020 at 02:59 PM, Tim Crawford wrote:


Hi all,

I'm looking for a way to filter boot options to only those that contain EFI
volumes. Right now, testing in QEMU, I see things like empty CD-ROM drives and
blank USB drives as boot options.

In IntelFrameworkModulePkg, I accomplished this by adding a call to
BdsLibGetBootableHandle() in BdsLibEnumerateAllBootOption(). If I didn't get
a handle from the device, I skipped building a boot option for it.

In MdeModulePkg, this seems to correspond to BmEnumerateBootOptions(). But I'm
unsure of how to filter out non-EFI drives here.
(BmIsLoadOptionPeHeaderValid()
in BmLoadOption.c sounds promising for what I want.)

Thanks,
Tim


Tim Crawford
 

Hi all,

I'm looking for a way to filter boot options to only those that contain EFI
volumes. Right now, testing in QEMU, I see things like empty CD-ROM drives and
blank USB drives as boot options.

In IntelFrameworkModulePkg, I accomplished this by adding a call to
BdsLibGetBootableHandle() in BdsLibEnumerateAllBootOption(). If I didn't get
a handle from the device, I skipped building a boot option for it.

In MdeModulePkg, this seems to correspond to BmEnumerateBootOptions(). But I'm
unsure of how to filter out non-EFI drives here. (BmIsLoadOptionPeHeaderValid()
in BmLoadOption.c sounds promising for what I want.)

Thanks,
Tim