[U-Boot] [U-Boot,RFC] efi: variable support

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Jun 25 05:06:48 UTC 2017

On 06/25/2017 12:29 AM, Rob Clark wrote:
> Mapping from EFI variables to grub variables.  Still almost as many
> TODOs as lines of code, but just figured I'd send out an early version
> for comments.
> I was thinking of it as a useful way for u-boot to pass values to grub
> (although grub is still missing a way for grub scripts to retrieve
> UEFI variables).
> The rough idea is to encode GUID + variable name plus "efi_" prefix
> (to avoid unintended u-boot variables leaking into the UEFI world).
> And then encode the type (and attributes?) in the string value of the
> variable.  Ie. something like:
>   setenv efi_8be4df6193ca11d2aa0d00e098032b8c_OsIndicationsSupported (u64)0

Hello Rob,

thank you for your effort for a first implementation of EFI variables.

The UEFI variable runtime services consists of the following functions:
GetVariable, GetNextVariableName, SetVariable, QueryVariableInfo.

SetVariable is meant to persistently store variables. The value has to
be maintained across reboots.

A variable consists of a variable name, a vendor GUID, an attribute
bitmask and the variable value.

SetVariable has to support appending to the value.

The UEFI spec also defines some global variables marked by the

Grub uses UEFI variables to store boot entries for GPT disks.

To do so it requires that the EFI runtime services are available after
Linux is booted.

So my conclusion is that it would be valuable to implement the EFI
variable services. This implementation has to include a persistent
store. The runtime service has to be available after Linux boot.

If we want to manipulate variables from U-Boot we would need two new
commands to set and get EFI variable names, GUIDs, attributes, and values.

Could you, please, provide your use case for manipulating EFI variables
from U-Boot.

One use case I could think of is to let Linux write the dtb name into an
EFI variable and let U-Boot read this EFI variable to decide which dtb
file to load.

Best regards

Heinrich Schuchardt

More information about the U-Boot mailing list