Search code examples
visual-c++windows-10uefi

persist custom data in NVRAM


My requirement is that I need to write some custom application data (that I currently store in a file) to NVRAM for persistence during imaging on Windows 10. How to achieve this?

Note: By using SetFirmwareEnvironmentVariable() API with firmware environment variable name as "myVar", I am able to store the data(tested till 10KB). Can I use this approach and what is the max data that can be stored in a variable?


Solution

  • The NVRAM variables can be created using these Windows API. The created variables can be viewed using EFI shell command 'dmpstore'. Following link explains on how to create a bootable EFI shell.

    https://github.com/tianocore/edk2/raw/master/ShellBinPkg/UefiShell/X64/Shell.efi