Date
1 - 4 of 4
EFI_SECTION_FREEFORM_SUBTYPE_GUID section
Yeh
Hello,
This really solves my question about the EFI_SECTION_FREEFORM_SUBTYPE_GUID. Many thanks for the help. Thanks, Yeh |
|
Konstantin Aladyshev
Just in case, here is a link for my GitHub PR to edk2, where you can
find all the series of patches including the patches to the VolInfo utility. https://github.com/tianocore/edk2/pull/3111 Best regards, Konstantin Aladyshev On Wed, Jul 20, 2022 at 5:17 PM Konstantin Aladyshev <aladyshev22@...> wrote:
|
|
Konstantin Aladyshev
Hello!
I've put more investigation into the subject. It looks like the syntax described in the https://edk2-docs.gitbook.io/edk-ii-fdf-specification/3_edk_ii_fdf_file_format/36_-fv-_sections currently is not supported by EDKII. I've created several patches to add support for SUBTYPE_GUID sections and have sent them to the mailing list. Please review. https://edk2.groups.io/g/devel/message/91584 [PATCH] BaseTools/GenSec: Support EFI_SECTION_FREEFORM_SUBTYPE_GUID sections https://edk2.groups.io/g/devel/message/91583 [PATCH] BaseTools: Add support for SUBTYPE_GUID section generation I have also created several patches to the EDKII VolInfo tool. You can find them as well in the mailing list. With it it is now possible to output the GUID value from the SUBTYPE_GUID sections. Here is minimal example in FDF: ``` [FD.SimpleImage] BaseAddress = 0x0 Size = 0x1000 ErasePolarity = 1 0x0|0x500 FV = SimpleVolume [FV.SimpleVolume] FvAlignment = 16 FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { SECTION SUBTYPE_GUID cf1fce30-b181-4d6a-b860-354c922e5c3f = $(WORKDIR)/hello.txt } ``` And its output by VolInfo: ``` $ VolInfo Build/UefiLessonsPkg/RELEASE_GCC5/FV/SIMPLEVOLUME.Fv VolInfo Version 1.0 Build Developer Build based on Revision: Unknown Signature: _FVH (4856465F) Attributes: 40800 EFI_FVB2_ERASE_POLARITY EFI_FVB2_ALIGNMENT_16 Header Length: 0x00000048 File System ID: 8c8ce578-8a3d-4f1c-9935-896185c32dd3 Revision: 0x0002 Number of Blocks: 0x00000500 Block Length: 0x00000001 Total Volume Size: 0x00000500 ============================================================ File Name: F6ED9CF0-CDC1-40A1-9909-AC6A2F435E23 File Offset: 0x00000048 File Length: 0x00000032 File Attributes: 0x00 File State: 0xF8 EFI_FILE_DATA_VALID File Type: 0x02 EFI_FV_FILETYPE_FREEFORM ------------------------------------------------------------ Type: EFI_SECTION_FREEFORM_SUBTYPE_GUID Size: 0x0000001A Guid: cf1fce30-b181-4d6a-b860-354c922e5c3f There are a total of 1 files in this FV ``` Best regards, Konstantin Aladyshev On Mon, Jul 18, 2022 at 6:54 PM Konstantin Aladyshev <aladyshev22@...> wrote:
|
|
Konstantin Aladyshev
Hello!
I'm trying trying to create a file with a section: ``` EFI_SECTION_FREEFORM_SUBTYPE_GUID Summary: A leaf section type that contains a single EFI_GUID in the header to describe the raw data. Prototype: typedef struct { EFI_COMMON_SECTION_HEADER CommonHeader; EFI_GUID SubTypeGuid; } EFI_FREEFORM_SUBTYPE_GUID_SECTION; Description: A free-form subtype GUID section is a leaf section that contains a single EFI_GUIDin the header to describe the raw data. ``` How can I do it with EDKII? From the https://edk2-docs.gitbook.io/edk-ii-fdf-specification/3_edk_ii_fdf_file_format/36_-fv-_sections docs it look like I should use something similar to this syntax: ``` FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { SECTION SUBTYPE_GUID af6098b5-890d-452d-8f41-d65a47012beb = $(WORKDIR)/myfile.txt } ``` But unfortunately this syntax just leads to build error. I've noticed that I can build this code: ``` FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { SECTION SUBTYPE_GUID = $(WORKDIR)/myfile.txt } ``` But it looks like this leads to an error where GenSec is called without a section type argument. The build returns successfully (?!), but instead of the EFI_COMMON_SECTION_HEADER there would be only 1 byte: 0x00. After some investigation I was able to fix this problem: ``` $ git diff diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py index 447828c8e5..8bb181ba08 100644 --- a/BaseTools/Source/Python/GenFds/Section.py +++ b/BaseTools/Source/Python/GenFds/Section.py @@ -23,7 +23,7 @@ from Common.DataType import * class Section (SectionClassObject): SectionType = { 'RAW' : 'EFI_SECTION_RAW', - 'FREEFORM' : 'EFI_SECTION_FREEFORM_SUBTYPE_GUID', + 'SUBTYPE_GUID' : 'EFI_SECTION_FREEFORM_SUBTYPE_GUID',^M BINARY_FILE_TYPE_PE32 : 'EFI_SECTION_PE32', BINARY_FILE_TYPE_PIC : 'EFI_SECTION_PIC', BINARY_FILE_TYPE_TE : 'EFI_SECTION_TE', ``` Now I'm able to use this syntax: ``` FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { SECTION SUBTYPE_GUID = $(WORKDIR)/myfile.txt } ``` And the section header is now generated correctly. Although it doesn't look like it is possible to set GUID for the SECTION in the same statement like https://edk2-docs.gitbook.io/edk-ii-fdf-specification/3_edk_ii_fdf_file_format/36_-fv-_sections suggests. 1) Am I using the syntax correctly? 2) Should I push my patch? 3) Is it true that edk2 currently doesn't support SUBTYPE_GUID section syntax fully? (in a way that it is not possible to set GUID like the docs suggest) Best regards, Konstantin Aladyshev |
|