Adding ESRT and EFI vars support for fwupd

Michał Kotyla michal.kotyla at
Mon Aug 22 01:29:57 PDT 2022

Hello DragonflyBSD community,
As some might know, FreeBSD gained an interface for querying ESRT about
a year ago ([1], [2]), which was done as part of [3].
Adding it allowed to make UEFI capsule plugin of fwupd [4] work for
FreeBSD [5] to perform firmware updates on EFI systems.
Now it's turn for DragonflyBSD and we would like to ask about requirements
and recommendations on the API and its implementation such that they
would be accepted by the upstream.
The same project is being done for OpenBSD [6] and NetBSD as well [7]
Initial idea is to use sysctl() interface like it was done in FreeBSD
implementation ([1] and [2]). Here is a list of wanted ESRT variables:
EFI variables
We also need a working efivar or similar implementation to be usable 
with fwupd:
• efi_append_variable() appends data of size to the variable specified 
by guid
and name
• efi_del_variable() deletes the variable specified by guid and name
• efi_get_variable() gets variable's data_size, and its attributes are 
in attributes
• efi_get_variable_attributes() gets attributes for the variable 
specified by
guid and name
• efi_get_variable_size() gets the size of the data for the variable 
by guid and name
• efi_get_next_variable_name() iterates across the currently extant 
passing back a guid and name
• efi_guid_to_name() translates from an efi_guid_t to a well known name
• efi_guid_to_symbol() translates from an efi_guid_t to a unique (within
libefivar) C-style symbol name
• efi_guid_to_str() allocates a suitable string and populates it with string
representation of a UEFI GUID
• efi_name_to_guid() translates from a well known name to an efi_guid_t
• efi_set_variable() sets the variable specified by guid and name
• efi_str_to_guid() parses a UEFI GUID from string form to an efi_guid_t
• efi_variables_supported() checks if EFI variables are accessible
• efi_generate_file_device_path() generates an EFI file device path for 
an EFI
binary from a filesystem path
It looks like those functionalities are already implemented in
Please help shaping this API for ESRT and UEFI capsules, so you'll be 
happy with
it :) The implementation is a separate thing, but let me know if you 
have any
specific ideas about it right away, they can help to avoid too many 
rounds of
Best regards,
Michał Kotyla

Michał Kotyla
Embedded Linux Developer
GPG: 14FC54DC259CF70A | @3mdeb_com

More information about the Kernel mailing list