[PATCH v7 0/3] efi_vars: Implement SPI Flash storage for EFI
Neil Armstrong
neil.armstrong at linaro.org
Wed Feb 11 09:34:46 CET 2026
On 2/3/26 12:51, Michal Simek wrote:
>
> This is updated series based on v3 version sent here
> https://lore.kernel.org/all/20231126220836.374956-1-i@shantur.com/
>
> that's why I am continuing on v4 instead of starting from scratch.
>
> Tested on kv260 with saving variables to location where User MTD partition
> is.
> CONFIG_EFI_VARIABLE_SF_STORE=y
> CONFIG_EFI_RT_VOLATILE_STORE=y
> CONFIG_EFI_VARIABLE_SF_OFFSET=0x22a0000
>
> In Linux:
> root at som:~# mount | grep efivars
> none on /sys/firmware/efi/efivars type efivarfs (rw,relatime)
> root at som:~# printf '\x07\x00\x00\x00Hello' \
> | sudo tee /sys/firmware/efi/efivars/TestVar-12345678-1234-1234-1234-123456789abc
> Helloroot at som:~#
> root at som:~# dd if=/sys/firmware/efi/efivars/VarToFile-b2ac5fc9-92b7-4acd-aeac-11e818c3130c \
> of=/tmp/vars skip=4 bs=1
> 1352+0 records in
> 1352+0 records out
> 1352 bytes (1.4 kB, 1.3 KiB) copied, 0.380992 s, 3.5 kB/s
> root at som:~# flashcp /tmp/vars /dev/mtd16
> root at som:~# reboot
>
> Reboot and then in U-Boot:
>
> ZynqMP> pri -e
> ...
> TestVar:
> 12345678-1234-1234-1234-123456789abc (12345678-1234-1234-1234-123456789abc)
> NV|BS|RT, DataSize = 0x5
> 00000000: 48 65 6c 6c 6f Hello
> ...
>
> Thanks,
> Michal
>
> Changes in v7:
> - sed -i 's/efi_var_from/efi_var_from_storage/g'
> - sed -i 's/efi_var_from/efi_var_from_storage/g'
>
> Changes in v6:
> - Return EFI_SUCCESS in efi_set_variable_int() when
> CONFIG_EFI_VARIABLE_NO_STORE is enabled
> - sed -i 's/efi_var_read/efi_var_from/g'
> - sed -i 's/efi_var_write/efi_var_to_storage/g'
> - sed -i 's/efi_var_read/efi_var_from/g'
> - sed -i 's/efi_var_write/efi_var_to_storage/g'
>
> Changes in v5:
> - Invert logic in efi_variable.c and avoid #if
>
> Changes in v4:
> - New patch based on review comments from v3
> - Extend Kconfig description
> - Extend commit message and describe efivar missing part
> - use unify methods for reading/writing variable
>
> Changes in v3:
> - Fixed compiler warnings.
>
> Changes in v2:
> - Refactored efi_var_file to move common parts out as requested
> - Changed ifdefs to use CONFIG_IS_DEFINED
> - Fixed typos
>
> Michal Simek (1):
> efi_var: Unify read/write access helper function
>
> Shantur Rathore (2):
> efi_var_file: refactor to move buffer functions
> efi_vars: Implement SPI Flash store
>
> include/efi_variable.h | 18 +++----
> lib/efi_loader/Kconfig | 34 +++++++++++-
> lib/efi_loader/Makefile | 3 +-
> lib/efi_loader/efi_var_common.c | 42 +++++++++++++++
> lib/efi_loader/efi_var_file.c | 65 ++---------------------
> lib/efi_loader/efi_var_sf.c | 92 +++++++++++++++++++++++++++++++++
> lib/efi_loader/efi_variable.c | 19 ++++---
> 7 files changed, 195 insertions(+), 78 deletions(-)
> create mode 100644 lib/efi_loader/efi_var_sf.c
>
Tested-by: Neil Armstrong <neil.armstrong at linaro.org> # on AML-S905D3-CC
Thanks,
Neil
More information about the U-Boot
mailing list