Generate and dump OVMF_VARS.fd files to/from YAML
This is a simple Python script to generate and dump OVMF_VARS.fd
files to and
from YAML. You can use this to generate OVMF_VARS.fd
files procedurally, as
well as examine their contents.
This is better than other solutions to modify OVMF_VARS.fd
because most other
solutions involve booting a UEFI shell inside a VM and using the UEFI APIs to
manipulate the variables. This script was written by reverse engineering the
format from the EDK2/OVMF source code. It's possible there are corner issues
with it, but it appears to work.
This tool probably won't work with OVMF_VARS.fd
which were not cleanly
written (e.g. the VM was terminated while variables were being modified) as it
doesn't implement the journaling functionality of the EDK2 variable store
format and assumes the store is clean.
ovmfvartool dump ./OVMF_VARS.fd
.ovmfvartool export ./OVMF_VARS.fd
.OVMF_VARS.fd
from a YAML file, run ovmfvartool compile vars.yaml OVMF_VARS.fd
.OVMF_VARS.fd
containing no variables (this is the sameOVMF_VARS.fd
distributed with OVMF builds), run ovmfvartool generate-blank OVMF_VARS.fd
.This tool might be useful in various circumstances, for example:
An example of a YAML file generated by this tool can be found here. This particular example was generated after installing Windows into a VM.
2021 Hugo Landau. Licenced under the GPLv3 or later.