[edk2-devel] [Patch 0/2] BaseTools: Generate EFI Variable default value file

Bob Feng posted 2 patches 2 years, 8 months ago
Only 0 patches received!
BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  54 ++
BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   5 +
BaseTools/Source/C/VfrCompile/VfrSyntax.g     |   6 +-
.../Source/C/VfrCompile/VfrUtilityLib.cpp     | 145 ++++-
BaseTools/Source/C/VfrCompile/VfrUtilityLib.h |  14 +-
BaseTools/Source/Python/AutoGen/DataPipe.py   |   2 +
.../Source/Python/AutoGen/GenDefaultVar.py    | 498 ++++++++++++++++++
.../Source/Python/AutoGen/ModuleAutoGen.py    |   9 +
.../Python/AutoGen/ModuleAutoGenHelper.py     |   4 +
BaseTools/Source/Python/Common/GlobalData.py  |   5 +
BaseTools/Source/Python/build/build.py        |  18 +
BaseTools/Source/Python/build/buildoptions.py |   1 +
12 files changed, 756 insertions(+), 5 deletions(-)
create mode 100644 BaseTools/Source/Python/AutoGen/GenDefaultVar.py
[edk2-devel] [Patch 0/2] BaseTools: Generate EFI Variable default value file
Posted by Bob Feng 2 years, 8 months ago
For the first time boot, when there is no data in the NvStore area, the platform needs to get the EFI variable default value from somewhere. 

The current solution to resolve this problem is leveraging the FCE tool, which is under the edk2-staging repo FceFmmt branch, to generate the EFI variable default value binary file in the post-build phase, and encapsulate it as an FFS, and then insert that FFS into BFV. In this way, the platform can read the EFI variables' default value.

This solution depends on the FCE tool which is not ready to be included in edk2 BaseTools. The user has to merge the FCE tool into edk2 basetools locally to apply this solution. That is not a good way for using edk2. 

FCE retrieves the EFI variable default value by scanning the entire fd file and reading the .efi files in the post-build phase. It's not an efficient way. The variable default value can be read from the VFR file (source file) directly and the variable default value binary file can be generated in the build phase.

Basetools need to enhance to generate efi variable default value in the platform build phase so that the platform build process can remove the dependency of FCE tool.

The new solution to replace FCE solution is that:
1. Enhance VfrCompile to generate EFI variable information file.

2. Enhance build tool to collect all the variable information files
and generate variable default value binary file.

3. In platform fdf file, under the BFV Fv section, add
FILE FREEFORM = 003e7b41-98a2-4be2-b27a-6c30c7655225 {
     SECTION RAW = $(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/FV/default.bin
}


Bob Feng (2):
  BaseTools: Enable VfrCompile to dump variable default value
  BaseTools: a new build option for variable default value generation

 BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  54 ++
 BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   5 +
 BaseTools/Source/C/VfrCompile/VfrSyntax.g     |   6 +-
 .../Source/C/VfrCompile/VfrUtilityLib.cpp     | 145 ++++-
 BaseTools/Source/C/VfrCompile/VfrUtilityLib.h |  14 +-
 BaseTools/Source/Python/AutoGen/DataPipe.py   |   2 +
 .../Source/Python/AutoGen/GenDefaultVar.py    | 498 ++++++++++++++++++
 .../Source/Python/AutoGen/ModuleAutoGen.py    |   9 +
 .../Python/AutoGen/ModuleAutoGenHelper.py     |   4 +
 BaseTools/Source/Python/Common/GlobalData.py  |   5 +
 BaseTools/Source/Python/build/build.py        |  18 +
 BaseTools/Source/Python/build/buildoptions.py |   1 +
 12 files changed, 756 insertions(+), 5 deletions(-)
 create mode 100644 BaseTools/Source/Python/AutoGen/GenDefaultVar.py

-- 
2.18.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79271): https://edk2.groups.io/g/devel/message/79271
Mute This Topic: https://groups.io/mt/84861452/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-