[edk2-devel] [PATCH] Support skipping automatic BM enumeration

Laszlo Ersek lersek at redhat.com
Tue Nov 5 09:33:45 UTC 2019


On 11/05/19 04:24, Ashish Singhal wrote:
> Hi Ray,
> 
> I did not see any example with which one can tell BDS not to
> enumerate a boot option. Can you please point me to an example where
> a protocol (Block IO, Simple FS or Load File) does not get enumerated
> as a boot option?

(I'm going to state the same thing that's been said in this thread
already, just maybe with a different formulation.)

In order for you to end up with a particular auto-generated option in
the boot manager, two "kinds" of things are necessary.


(1) Producing the protocol instance:

(1a) Your PlatformBootManagerLib instance must actively *connect* the
device in question to a suitable UEFI driver that follows to the UEFI
driver model, such that the UEFI driver produce the LoadFile protocol
instance. For example, you could be calling the
EfiBootManagerConnectAll() API, from UefiBootManagerLib.

(1b) Alternatively, if the device is a platform device, then you might
need a DXE driver, built into your platform firmware, that produces
LoadFile on top of the device, running (directly or indirectly) in the
driver's entry point function.


(2) Creating a boot option for the protocol instance:

(2a) With the LoadFile protocol instance existing, your
PlatformBootManagerLib instance must actively call a UefiBootManagerLib
API -- such as EfiBootManagerRefreshAllBootOption() -- that scans the
UEFI protocol database for various "bootable" protocols, and
auto-generates UEFI Boot#### variables for them (and updates BootOrder too).

(2b) Alternatively, your PlatformBootManagerLib instance may be
auto-setting Boot#### / BootOrder, in response to the LoadFile instance
in question, in some different manner.

----

The point is that *all* of the above actions are under your control. If
you want to prevent the auto-generation of a particular boot option,
then break the dependency chain in any one spot above, and then the
option will not be auto-generated.

- do not connect the device to a driver in your PlatformBootManagerLib,
- or remove the platform DXE driver, if you have that,

or:

- do not call EfiBootManagerRefreshAllBootOption(),
- or stop manually creating Boot#### / BootOrder for the subject
LoadFile (if you do that currently).

(

I did not point out all this when I first responded to your posting,
because I assumed your next question would be:

  OK, but then what do I call *instead of*
  EfiBootManagerRefreshAllBootOption()? I do need the auto-generation of
  boot options, speaking generally, except for this one LoadFile
  instance. I don't want to rewrite all of
  EfiBootManagerRefreshAllBootOption() as a platform function, just for
  the sake of this one exception.

Anticipating that counter-argument, I was tempted to suggest a different
approach (which we've done in the past): namely, making some lower-level
functions in UefiBootManagerLib public, so that PlatformBootManagerLib
instances can reuse those utility functions with finer granularity.

However, that approach is not extremely far from controlling
UefiBootManagerLib by different means, and in this particular case, I
couldn't suggest any obvious low-level functions from
UefiBootManagerLib, for making public, and to call in place of
EfiBootManagerRefreshAllBootOption(). For that, I think quite a bit of
refactoring would be necessary too.

And so I figured I'd let Ray and others respond first, to your proposal.

)

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#49962): https://edk2.groups.io/g/devel/message/49962
Mute This Topic: https://groups.io/mt/39747302/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list