aboutsummaryrefslogtreecommitdiffstats
path: root/Lessons_uncategorized
diff options
context:
space:
mode:
authorKonstantin Aladyshev <aladyshev22@gmail.com>2022-07-13 00:05:44 +0300
committerKonstantin Aladyshev <aladyshev22@gmail.com>2022-07-13 00:05:44 +0300
commit75b5627fdb4a4dc0a2fff26842e5e449d0d0ad24 (patch)
tree9f7616c6809b679f015657ec2939bda9c63cba24 /Lessons_uncategorized
parentf19cd2d50ad72f3a658c6d63ca1ba1eb749c2f35 (diff)
downloadUEFI-Lessons-75b5627fdb4a4dc0a2fff26842e5e449d0d0ad24.tar.gz
UEFI-Lessons-75b5627fdb4a4dc0a2fff26842e5e449d0d0ad24.tar.bz2
UEFI-Lessons-75b5627fdb4a4dc0a2fff26842e5e449d0d0ad24.zip
Add initial data for VPD lesson
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Diffstat (limited to 'Lessons_uncategorized')
-rw-r--r--Lessons_uncategorized/Lesson_VPD/README.md80
1 files changed, 80 insertions, 0 deletions
diff --git a/Lessons_uncategorized/Lesson_VPD/README.md b/Lessons_uncategorized/Lesson_VPD/README.md
new file mode 100644
index 0000000..fb9ba4f
--- /dev/null
+++ b/Lessons_uncategorized/Lesson_VPD/README.md
@@ -0,0 +1,80 @@
+
+
+
+
+```
+$ git diff OvmfPkg/OvmfPkgDefines.fdf.inc
+diff --git a/OvmfPkg/OvmfPkgDefines.fdf.inc b/OvmfPkg/OvmfPkgDefines.fdf.inc
+index 35fd454b97..d12ee97ea5 100644
+--- a/OvmfPkg/OvmfPkgDefines.fdf.inc
++++ b/OvmfPkg/OvmfPkgDefines.fdf.inc
+@@ -61,7 +61,10 @@ DEFINE FW_BLOCKS = 0x400
+ DEFINE CODE_BASE_ADDRESS = 0xFFC84000
+ DEFINE CODE_SIZE = 0x0037C000
+ DEFINE CODE_BLOCKS = 0x37C
+-DEFINE FVMAIN_SIZE = 0x00348000
++DEFINE VPD_OFFSET = 0x84000
++DEFINE VPD_SIZE = 0x01000
++DEFINE FVMAIN_OFFSET = 0x85000
++DEFINE FVMAIN_SIZE = 0x00347000
+ DEFINE SECFV_OFFSET = 0x003CC000
+ DEFINE SECFV_SIZE = 0x34000
+ !endif
+```
+
+If we want to create VPD file we need to add a special define `VPD_TOOL_GUID` to the DSC `[Defines]` section. This define determines a tool which would be used for VPD generation. EDK2 comes with one such tool, so let's try to use it.
+
+Add this to the `OvmfPkg/OvmfPkgX64.dsc` file:
+```
+[Defines]
+ ...
+ VPD_TOOL_GUID = 8C3D856A-9BE6-468E-850A-24F7A8D38E08
+```
+
+This GUID corresponds to the GUID of the tool `VPDTOOL` defined in the `Conf/tools_def.txt`:
+```
+##################
+# BPDG tool definitions
+##################
+*_*_*_VPDTOOL_PATH = BPDG
+*_*_*_VPDTOOL_GUID = 8C3D856A-9BE6-468E-850A-24F7A8D38E08
+```
+The tool `VPDTOOL` is a Python module from the folder [`BaseTools/Source/Python/BPDG/`](https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Python/BPDG/) which is used via [`BaseTools/BinWrappers/PosixLike/BPDG`](https://github.com/tianocore/edk2/blob/master/BaseTools/BinWrappers/PosixLike/BPDG) wrapper on Linux. As a wrapper folder `BaseTools/BinWrappers/PosixLike` gets added to the environment `PATH` variable after the `. edksetup.sh` command, we can simply declare path for `VPDTOOL` as `BPDG`.
+
+
+```
+[PcdsFixedAtBuild]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
+```
+
+```
+[PcdsDynamicVpd]
+ gUefiLessonsPkgTokenSpaceGuid.PcdMyDynamicVar32 | 0x40 | 0x55555555
+ gUefiLessonsPkgTokenSpaceGuid.PcdMyDynamicVar32_1 | * | 0x66666666
+```
+
+```
+$ git diff OvmfPkg/OvmfPkgX64.fdf
+diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
+index 5fa8c08958..be0f4b52ff 100644
+--- a/OvmfPkg/OvmfPkgX64.fdf
++++ b/OvmfPkg/OvmfPkgX64.fdf
+@@ -26,7 +26,12 @@ NumBlocks = $(FW_BLOCKS)
+
+ !include VarStore.fdf.inc
+
+-$(VARS_SIZE)|$(FVMAIN_SIZE)
++$(VPD_OFFSET)|$(VPD_SIZE)
++gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress
++FILE = $(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/FV/8C3D856A-9BE6-468E-850A-24F7A8D38E08.bin
++
++#$(VARS_SIZE)|$(FVMAIN_SIZE)
++$(FVMAIN_OFFSET)|$(FVMAIN_SIZE)
+ FV = FVMAIN_COMPACT
+```
+
+# Links
+
+[EDK II Build System Output File Format](https://edk2-docs.gitbook.io/edk-ii-dsc-specification/appendix_d_vpd_data_files/d1_edk_ii_build_system_output_file_format)
+
+[GUIDed Tools and PCD VPD Data](https://edk2-docs.gitbook.io/edk-ii-build-specification/7_build_environment/73_guided_tools)