Skip to content

Describe runtime access to file-backed variable stores - #169

Merged
vstehle merged 2 commits into
ARM-software:mainfrom
ricardosalveti:rt-variable-handover
Oct 8, 2026
Merged

vstehle merged 2 commits into
ARM-software:mainfrom
ricardosalveti:rt-variable-handover

Conversation

@ricardosalveti

@ricardosalveti ricardosalveti commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Describe the mechanism U-Boot uses to keep SetVariable() available at
runtime with a file-backed variable store, following up on #143 and the
EBBR call of Sep 9: the firmware services the variable runtime services
from memory and exports the store file content through two volatile
variables, RTStorageVolatile and VarToFile, which the OS writes back to
the ESP. libefivar supports it since rhboot/efivar#282 (systemd doesn't
use libefivar; equivalent support is proposed in systemd/systemd#42905).

Chapter 5 describes the mechanism, variables included, in an informative
section as an example only, and records its limitations (only software
aware of the mechanism persists its changes). Chapter 2 keeps the runtime
services table unchanged and only points to that section in a note.
Nothing is required from firmware or the OS.

@vstehle

vstehle commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Hi @ricardosalveti, shall we discuss this pull request during our EBBR call of Sep 9 if that helps?

@ricardosalveti

Copy link
Copy Markdown
Contributor Author

Hi @ricardosalveti, shall we discuss this pull request during our EBBR call of Sep 9 if that helps?

Sure, that should be fine.

Comment thread source/chapter2-uefi.rst
Comment thread source/chapter2-uefi.rst Outdated
Comment thread source/chapter2-uefi.rst Outdated
@xypron

xypron commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Hello Ricardo,

thank you for contributing this suggestion.

I think we can make GetVariable(), GetNextVariable(), and QueryVariableInfo required both before and after ExitBootServices().

SetVariable() with efivar support only works for use cases where the efivar lib is used. It is a nice hack which works for GRUB and efibootmgr but will fail for any application directly talking to the kernel. Other operating systems like Windows will never support it. As EBBR is a firmware spec it should not impose requirements on an OS.

Best regards

Heinrich

@vstehle vstehle left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To follow up with the EBBR call of Sep 9, we would like to suggest the following changes:

  • Move to a different section (e.g. under chapter 5)
  • Mention the U-Boot/libefivar method as an example only, do not require or make it mandatory

@vstehle
vstehle marked this pull request as draft September 9, 2026 13:14
@ricardosalveti
ricardosalveti marked this pull request as ready for review October 6, 2026 22:24
@ricardosalveti ricardosalveti changed the title Specify runtime access to file-backed variable stores Describe runtime access to file-backed variable stores Oct 6, 2026
@ricardosalveti

Copy link
Copy Markdown
Contributor Author

Hi, sorry for the delay.

I think we can make GetVariable(), GetNextVariable(), and QueryVariableInfo required both before and after ExitBootServices().

SetVariable() with efivar support only works for use cases where the efivar lib is used. It is a nice hack which works for GRUB and efibootmgr but will fail for any application directly talking to the kernel. Other operating systems like Windows will never support it. As EBBR is a firmware spec it should not impose requirements on an OS.

Agreed, and reworked following the call notes: table is back to "Optional" for all three services, the chapter 2 requirement is gone (replaced by a note pointing to chapter 5), and chapter 5 now describes the u-boot / libefivar mechanism as an informative example, with the limitation spelled out that only software aware of the mechanism
(libefivar users) persists its changes.

@ricardosalveti

Copy link
Copy Markdown
Contributor Author

To follow up with the EBBR call of Sep 9, we would like to suggest the following changes:

  • Move to a different section (e.g. under chapter 5)
  • Mention the U-Boot/libefivar method as an example only, do not require or make it mandatory

Sure, reworked as discussed on Sep 9: nothing is required anymore. Chapter 5 describes the u-boot / libefivar mechanism, variables included, in an informative section as an example only, and chapter 2 keeps the runtime services table unchanged and only points to that section in a note.

Move to review again, from draft.

Comment thread source/chapter5-variable-storage.rst Outdated
Comment thread source/chapter5-variable-storage.rst Outdated
Comment thread source/chapter5-variable-storage.rst Outdated
@ricardosalveti

Copy link
Copy Markdown
Contributor Author

@xypron thanks for the review, updated the pr reflecting your comments.

Comment thread source/chapter5-variable-storage.rst Outdated
Comment thread source/chapter5-variable-storage.rst Outdated
Comment thread source/chapter5-variable-storage.rst Outdated
@vstehle

vstehle commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Thank you @ricardosalveti, overall this looks good to me.
Let's discuss during the EBBR call.

Comment thread source/chapter5-variable-storage.rst Outdated
Firmware that stores EFI variables in a file cannot write that file
once the OS controls the storage device. U-Boot can keep servicing the
variable runtime services from a memory-backed store and delegate
persisting it to the OS: the RTStorageVolatile variable names the
store file on the ESP and VarToFile exports the content the file must
have. libefivar supports the mechanism (rhboot/efivar#282), but it is
not documented outside of the U-Boot sources.

Describe the mechanism in a non-normative section, as an example of
how the variable store file can be updated at runtime, with U-Boot and
libefivar as example implementations of the firmware and OS sides,
without making it, or the variables it relies on, an EBBR requirement,
and record its limitations: only modifications made by software aware
of the mechanism persist across reset.

While at it, retitle the chapter, whose scope now goes beyond the
store file format, and add the chapter 2 anchor the new section refers
to.

This follows up on the discussion in ARM-software#143.

Suggested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
The Runtime Variable Access section recommends caching the variables
in memory so that GetVariable() and GetNextVariableName() keep working
when SetVariable() is not supported during runtime services.

Add a note mentioning that firmware can go one step further and also
accept SetVariable() on the cached copy, relying on the OS to persist
the variable store, and point to the example now described in chapter
5. This is not a generic solution and is not required by EBBR: the
runtime services requirements are unchanged.

Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
@ricardosalveti

Copy link
Copy Markdown
Contributor Author

@vstehle updated, let me know if additional changes are required.

@vstehle
vstehle merged commit 524a0f2 into ARM-software:main Oct 8, 2026
1 check passed
@vstehle

vstehle commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Thank you @ricardosalveti; merging as per our EBBR call of Oct 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants