diff options
Diffstat (limited to 'Lessons_uncategorized')
-rw-r--r-- | Lessons_uncategorized/Lesson_FDF_FV_2/README.md | 869 | ||||
-rw-r--r-- | Lessons_uncategorized/Lesson_FDF_FV_3/README.md | 394 | ||||
-rw-r--r-- | Lessons_uncategorized/Lesson_FDF_FV_4/README.md | 475 |
3 files changed, 869 insertions, 869 deletions
diff --git a/Lessons_uncategorized/Lesson_FDF_FV_2/README.md b/Lessons_uncategorized/Lesson_FDF_FV_2/README.md index 030943c..ff28e92 100644 --- a/Lessons_uncategorized/Lesson_FDF_FV_2/README.md +++ b/Lessons_uncategorized/Lesson_FDF_FV_2/README.md @@ -337,872 +337,3 @@ $ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/SIMPLEVOLUME.Fv -C Now you know how modular is flash image build. `build` tool that we use actually delegates many tasks to the simple utilities like `GenSec`/`GenFfs`/`GenFv` and many intermediate files are created along the build process. -# `EFI_SECTION_USER_INTERFACE` - -Let's investigate `EFI_SECTION_USER_INTERFACE=0x15` section type: -``` -EFI_SECTION_USER_INTERFACE - -Summary: -A leaf section type that contains a Unicode string that contains a human-readable file name. - -Prototype: -typedef struct { - EFI_COMMON_SECTION_HEADER CommonHeader; - CHAR16 FileNameString[]; -} EFI_USER_INTERFACE_SECTION; - -Description: -The user interface file name section is a leaf section that contains a Unicode string that contains a human-readable file name. -This section is optional and is not required for any file types. There must never be more than one user interface file name section contained within a file. -``` - -As you can see this section is really simple. Its data is just a `CHAR16` string. EDKII has syntax to initialize this section in-place: -``` -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION UI = "MyUI" -} -``` -`VolInfo` can display string of this section: -``` -$ VolInfo Build/UefiLessonsPkg/RELEASE_GCC5/FV/SIMPLEVOLUME.Fv -x Build/UefiLessonsPkg/RELEASE_GCC5/FV/Guid.xref -VolInfo Version 1.0 Build Developer Build based on Revision: Unknown -ParseGuidBaseNameFile: Build/UefiLessonsPkg/RELEASE_GCC5/FV/Guid.xref -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 MyUI -File Offset: 0x00000048 -File Length: 0x00000026 -File Attributes: 0x00 -File State: 0xF8 - EFI_FILE_DATA_VALID -File Type: 0x02 EFI_FV_FILETYPE_FREEFORM ------------------------------------------------------------- - Type: EFI_SECTION_USER_INTERFACE - Size: 0x0000000E - String: MyUI -There are a total of 1 files in this FV -``` - -Intermidiate file for this section would have `*.ui` extension: -``` -Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.ui -C -00000000 0e 00 00 15 4d 00 79 00 55 00 49 00 00 00 |....M.y.U.I...| -0000000e -``` - -# `EFI_SECTION_VERSION` - -Another simple section that you might come across is `EFI_SECTION_VERSION`: -``` -Summary: -A leaf section type that contains a numeric build number and an optional Unicode string that represents the file revision. - -Prototype: -typedef struct { - EFI_COMMON_SECTION_HEADER CommonHeader; - UINT16 BuildNumber; - CHAR16 VersionString[]; -} EFI_VERSION_SECTION; - -Parameters: -CommonHeader Common section header. CommonHeader.Type = EFI_SECTION_VERSION. -BuildNumber A UINT16 that represents a particular build. Subsequent builds have monotonically - increasing build numbers relative to earlier builds. -VersionString A null-terminated Unicode string that contains a text representation of the version. If - there is no text representation of the version, then an empty string must be provided. - -Description: -A version section is a leaf section that contains a numeric build number and an optional Unicode string that represents the file revision. -To facilitate versioning of PEIMs, DXE drivers, and other files, a version section may be included in a file. -There must never be more than one version section contained within a file. -``` - -The syntax for adding this section is this: -``` -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION BUILD_NUM = 42 VERSION = "MyVersion" -} -``` - -Once again `VolInfo` is able to display the content of this section: -``` -$ VolInfo Build/UefiLessonsPkg/RELEASE_GCC5/FV/SIMPLEVOLUME.Fv -x Build/UefiLessonsPkg/RELEASE_GCC5/FV/Guid.xref -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_VERSION - Size: 0x0000001A - Build Number: 0x002A - Version String: MyVersion -There are a total of 1 files in this FV -``` - -Intermidiate file for this section would have `*.ver` extension: -``` -$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.ver -C -00000000 1a 00 00 14 2a 00 4d 00 79 00 56 00 65 00 72 00 |....*.M.y.V.e.r.| -00000010 73 00 69 00 6f 00 6e 00 00 00 |s.i.o.n...| -0000001a -``` - -# `EFI_SECTION_FREEFORM_SUBTYPE_GUID` - -`EFI_SECTION_FREEFORM_SUBTYPE_GUID` section is very similar to raw, except that its header contains GUID value to describe the data inside the section. - -Here is definition from the PI specification: -``` -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; - -Parameters: -CommonHeader Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID. -SubtypeGuid This GUID is defined by the creator of the file. It is a vendor-defined file type. - -Description: -A free-form subtype GUID section is a leaf section that contains a single EFI_GUIDin the header to describe the raw data -``` - -The syntax for adding this section is this: -``` -SECTION SUBTYPE_GUID <Guid> = <File> -``` - -Let's try to use it: -``` -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION SUBTYPE_GUID cf1fce30-b181-4d6a-b860-354c922e5c3e = $(WORKDIR)/hello.txt -} -``` - -Here is how `VolInfo` output looks like in this case: -``` -$ 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: 0x00000033 -File Attributes: 0x00 -File State: 0xF8 - EFI_FILE_DATA_VALID -File Type: 0x02 EFI_FV_FILETYPE_FREEFORM ------------------------------------------------------------- - Type: EFI_SECTION_FREEFORM_SUBTYPE_GUID - Size: 0x0000001B - Guid: cf1fce30-b181-4d6a-b860-354c922e5c3e - -There are a total of 1 files in this FV -``` - -Intermidiate file for this section would have `*.guid` extension: -``` -$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.guid -C -00000000 1b 00 00 18 30 ce 1f cf 81 b1 6a 4d b8 60 35 4c |....0.....jM.`5L| -00000010 92 2e 5c 3e 68 65 6c 6c 6f 21 0a |..\>hello!.| -0000001b -``` - -# `EFI_SECTION_PE32`/`EFI_SECTION_PIC`/`EFI_SECTION_COMPATIBILITY16`/`EFI_SECTION_TE` - -Next there is a couple of sections for executable images. Most often you would use `EFI_SECTION_PE32` and include `.efi` code as your data. But nevertheless here is some info about all of the sections from the caption. - -Here in VolInfo output I will show you just the section part, as the rest doesn't have any interesting changes. Also as the build system doesn't check the content of the section data, I will just use the same `hello.txt` file for the section content that we've created earlier: - -## `EFI_SECTION_PE32` -``` -EFI_SECTION_PE32 -Summary -A leaf section type that contains a complete PE32+ image. -Prototype -typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION; - -Description -The PE32+ image section is a leaf section that contains a complete PE32+ image. Normal UEFI -executables are stored within PE32+ images -``` -Example usage: -``` -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION PE32 = $(WORKDIR)/hello.txt -} -``` -`VolInfo` display for the section: -``` ------------------------------------------------------------- - Type: EFI_SECTION_PE32 - Size: 0x0000000B -``` - -The section file extension is "*.pe32": -``` -$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.pe32 -C -00000000 0b 00 00 10 68 65 6c 6c 6f 21 0a |....hello!.| -0000000b -``` - -## `EFI_SECTION_PIC` -``` -EFI_SECTION_PIC -Summary -A leaf section type that contains a position-independent-code (PIC) image. -Prototype -typedef EFI_COMMON_SECTION_HEADER EFI_PIC_SECTION; - -Description -A PIC image section is a leaf section that contains a position-independent-code (PIC) image. -``` - -Example usage: -``` -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION PIC = $(WORKDIR)/hello.txt -} -``` - -`VolInfo` output for the section: -``` ------------------------------------------------------------- - Type: EFI_SECTION_PIC - Size: 0x0000000B -``` - -The section file extension is "*.pic": -``` -$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.pic -C -00000000 0b 00 00 11 68 65 6c 6c 6f 21 0a |....hello!.| -0000000b -``` - -## `EFI_SECTION_COMPATIBILITY16` -``` -EFI_SECTION_COMPATIBILITY16 - -Summary: -A leaf section type that contains an IA-32 16-bit executable image. - -Prototype: -typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION; - -Description: -A Compatibility16 image section is a leaf section that contains an IA-32 16-bit executable image. -IA-32 16-bit legacy code that may be included in PI Architecture firmware is stored in a 16-bit -executable image. -``` - -Example usage: -``` -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION COMPAT16 = $(WORKDIR)/hello.txt -} -``` -`VolInfo` output for the section: -``` ------------------------------------------------------------- - Type: EFI_SECTION_COMPATIBILITY16 - Size: 0x0000000B -``` - -The section file extension is "*.com16": -``` -$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.com16 -C -00000000 0b 00 00 16 68 65 6c 6c 6f 21 0a |....hello!.| -0000000b -``` - -## `EFI_SECTION_TE` -``` -EFI_SECTION_TE -Summary -A leaf section that contains a Terse Executable (TE) image. -Prototype -typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION; - -Description -The terse executable section is a leaf section that contains a Terse Executable (TE) image. A TE -image is an executable image format specific to the PI Architecture that is used for storing -executable images in a smaller amount of space than would be required by a full PE32+ image. -``` - -Example usage: -``` -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION TE = $(WORKDIR)/hello.txt -} -``` - -You would find that in this case build actually checks the file content. Build fails with the error: -``` -DOS header signature was not found in /<...>/hello.txt image. -``` -But if you would use correct file, the `VolInfo` would show you `EFI_SECTION_TE` section. - -The section file extension is "*.te": - -# `EFI_SECTION_COMPRESSION` - -The `EFI_SECTION_COMPRESSION` is encapsulation section in a sense that it is a section that have sections in itself. Here is full definition from the PI specification: -``` -EFI_SECTION_COMPRESSION - -Summary: -An encapsulation section type in which the section data is compressed. - -Prototype: -typedef struct { - EFI_COMMON_SECTION_HEADER CommonHeader; - UINT32 UncompressedLength; - UINT8 CompressionType; -} EFI_COMPRESSION_SECTION; - -Parameters: -CommonHeader Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION. -UncompressedLength UINT32 that indicates the size of the section data after decompression. -CompressionType Indicates which compression algorithm is used. - -Description: -A compression section is an encapsulation section in which the section data is compressed. To process the contents and extract the enclosed section stream, the section data must be decompressed using the decompressor indicated by the CompressionType parameter. The decompressed image is then interpreted as a section stream. -``` - -The example usage is this: -``` -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION COMPRESS { - SECTION RAW = $(WORKDIR)/hello.txt - SECTION RAW = $(WORKDIR)/hello.txt - SECTION RAW = $(WORKDIR)/hello.txt - } -} -``` - -`VolInfo` would parse it like this: -``` -$ 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: 0x00000042 -File Attributes: 0x00 -File State: 0xF8 - EFI_FILE_DATA_VALID -File Type: 0x02 EFI_FV_FILETYPE_FREEFORM ------------------------------------------------------------- - Type: EFI_SECTION_COMPRESSION - Size: 0x0000002A - Uncompressed Length: 0x00000023 - Compression Type: EFI_STANDARD_COMPRESSION -/------------ Encapsulation section start -----------------\ ------------------------------------------------------------- - Type: EFI_SECTION_RAW - Size: 0x0000000B ------------------------------------------------------------- - Type: EFI_SECTION_RAW - Size: 0x0000000B ------------------------------------------------------------- - Type: EFI_SECTION_RAW - Size: 0x0000000B -\------------ Encapsulation section end -------------------/ -There are a total of 1 files in this FV -``` - -It is possible to set compression type in the section syntax. By default compress uses standard `PI_STD` compression. - -If you want to you could point it explicitly. The output would be the same: -``` -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION COMPRESS PI_STD { - SECTION RAW = $(WORKDIR)/hello.txt - SECTION RAW = $(WORKDIR)/hello.txt - SECTION RAW = $(WORKDIR)/hello.txt - } -} -``` - -If you don't want any compression for your data you can use `PI_NONE` compression type. -``` -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION COMPRESS PI_NONE { - SECTION RAW = $(WORKDIR)/hello.txt - SECTION RAW = $(WORKDIR)/hello.txt - SECTION RAW = $(WORKDIR)/hello.txt - } -} -``` - -In this case section would just work as a section aggregator. - -For the proof compare the `hexdump` output from the compression section with `PI_STD` argument (or without any arguments): -``` -$ hexdump -C Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.com -00000000 2a 00 00 01 23 00 00 00 01 19 00 00 00 23 00 00 |*...#........#..| -00000010 00 00 0d 3a 51 8d 45 7d 6a 6a 52 e1 7e 0c 86 0b |...:Q.E}jjR.~...| -00000020 92 10 25 86 35 27 6d 1e c0 00 |..%.5'm...| -0000002a -``` -And with the `PI_NONE` argument: -``` -$ hexdump -C Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.com -00000000 2c 00 00 01 23 00 00 00 00 0b 00 00 19 68 65 6c |,...#........hel| -00000010 6c 6f 21 0a 00 0b 00 00 19 68 65 6c 6c 6f 21 0a |lo!......hello!.| -00000020 00 0b 00 00 19 68 65 6c 6c 6f 21 0a |.....hello!.| -0000002c -``` -In the second case you can clearly see the `hello!` strings from our `hello.txt` file. - -As you might have guessed already the extenstion of a file for this section is "*.com". - -# `EFI_SECTION_GUID_DEFINED` - -The `EFI_SECTION_GUID_DEFINED` is another encapsulation section. But in this case the data inside is processed with a specific tool, and the GUID of this tool is written to the section header, so you would know how exactly you need to interpret/decompress the data. In a way it is a more advanced `COMPRESS` section. The complete definition from the specification is this: -``` -EFI_SECTION_GUID_DEFINED - -Summary: -An encapsulation section type in which the method of encapsulation is defined by an identifying GUID. - -Prototype: -typedef struct { - EFI_COMMON_SECTION_HEADER CommonHeader; - EFI_GUID SectionDefinitionGuid; - UINT16 DataOffset; - UINT16 Attributes; - // GuidSpecificHeaderFields; -} EFI_GUID_DEFINED_SECTION; - -Parameters: -CommonHeader Common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED. -SectionDefinitionGuid GUID that defines the format of the data that follows. It is a vendor-defined section type. -DataOffset Contains the offset in bytes from the beginning of the common header to the first byte of the data. -Attributes Bit field that declares some specific characteristics of the section contents. -GuidSpecificHeaderFields Zero or more bytes of data that are defined by the section’s GUID. An example of this data would be a digital signature and manifest. -Data Zero or more bytes of arbitrary data. The format of the data is defined by SectionDefinitionGuid. - -Description: -A GUID-defined section contains a section-type-specific header that contains an identifying GUID, followed by an arbitrary amount of data. It is an encapsulation section in which the method of encapsulation is defined by the GUID. A matching instance of EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL (DXE) or EFI_GUIDED_SECTION_EXTRACTION_PPI (PEI) is required to extract the contents of this encapsulation section. -The GUID-defined section enables custom encapsulation section types for any purpose. One commonly expected use is creating an encapsulation section to enable a cryptographic authentication of the section contents. -``` - -The syntax for this section look like this: -``` -SECTION GUIDED <Guid> { - <...> -} -``` - -What GUIDs you can use? The ones that you have in you `Conf/tools_def.txt`. For example: -``` -################## -# GenCrc32 tool definitions -################## -*_*_*_CRC32_PATH = GenCrc32 -*_*_*_CRC32_GUID = FC1BCDB0-7D31-49AA-936A-A4600D9DD083 - -################## -# BrotliCompress tool definitions -################## -*_*_*_BROTLI_PATH = BrotliCompress -*_*_*_BROTLI_GUID = 3D532050-5CDA-4FD0-879E-0F7F630D5AFB - -################## -# LzmaCompress tool definitions -################## -*_*_*_LZMA_PATH = LzmaCompress -*_*_*_LZMA_GUID = EE4E5898-3914-4259-9D6E-DC7BD79403CF - -################## -# LzmaF86Compress tool definitions with converter for x86 code. -# It can improve the compression ratio if the input file is IA32 or X64 PE image. -################## -*_*_*_LZMAF86_PATH = LzmaF86Compress -*_*_*_LZMAF86_GUID = D42AE6BD-1352-4bfb-909A-CA72A6EAE889 - -################## -# TianoCompress tool definitions -################## -*_*_*_TIANO_PATH = TianoCompress -*_*_*_TIANO_GUID = A31280AD-481E-41B6-95E8-127F4C984779 -``` - -If you'll want to write your own utility someday, this is the typical call for the utility: -``` -<tool> -e -o <output_file> <input_file> -``` -`-e` here means `encode` and `-o` the output file. - - -Now let's write an example that uses GUIDED section. Here we use `TianoCompress` utility GUID for the processing tool: -``` -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION GUIDED A31280AD-481E-41B6-95E8-127F4C984779 { - SECTION RAW = $(WORKDIR)/hello.txt - SECTION RAW = $(WORKDIR)/hello.txt - SECTION RAW = $(WORKDIR)/hello.txt - } -} -``` - -The `hexdump` of this section would look like this: -``` -$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.guided -C -00000000 39 00 00 02 ad 80 12 a3 1e 48 b6 41 95 e8 12 7f |9........H.A....| -00000010 4c 98 47 79 18 00 01 00 19 00 00 00 23 00 00 00 |L.Gy........#...| -00000020 00 0d 3a 51 8d 45 7d 6a 6a 52 e1 7e 0c 86 0b 92 |..:Q.E}jjR.~....| -00000030 10 09 61 8d 49 db 47 b0 00 |..a.I.G..| -00000039 -``` - -And the `VolInfo` output for the FV would look like this: -``` -$ 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: 0x00000051 -File Attributes: 0x00 -File State: 0xF8 - EFI_FILE_DATA_VALID -File Type: 0x02 EFI_FV_FILETYPE_FREEFORM ------------------------------------------------------------- - Type: EFI_SECTION_GUID_DEFINED - Size: 0x00000039 - SectionDefinitionGuid: a31280ad-481e-41b6-95e8-127f4c984779 - - DataOffset: 0x0018 - Attributes: 0x0001 -/------------ Encapsulation section start -----------------\ ------------------------------------------------------------- - Type: EFI_SECTION_RAW - Size: 0x0000000B ------------------------------------------------------------- - Type: EFI_SECTION_RAW - Size: 0x0000000B ------------------------------------------------------------- - Type: EFI_SECTION_RAW - Size: 0x0000000B -\------------ Encapsulation section end -------------------/ -There are a total of 1 files in this FV -``` - -One more notice. If you woudn't supply any GUID like this: -``` -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION GUIDED { - SECTION RAW = $(WORKDIR)/hello.txt - SECTION RAW = $(WORKDIR)/hello.txt - SECTION RAW = $(WORKDIR)/hello.txt - } -} -``` -The section would be processed by the `fc1bcdb0-7d31-49aa-936a-a4600d9dd083` tool, which correspond to the `GenCrc32` tool. For the proof look at hexdump: -``` -$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.guided -C -00000000 3f 00 00 02 b0 cd 1b fc 31 7d aa 49 93 6a a4 60 |?.......1}.I.j.`| -00000010 0d 9d d0 83 1c 00 02 00 84 3e 2b 76 0b 00 00 19 |.........>+v....| -00000020 68 65 6c 6c 6f 21 0a 00 0b 00 00 19 68 65 6c 6c |hello!......hell| -00000030 6f 21 0a 00 0b 00 00 19 68 65 6c 6c 6f 21 0a |o!......hello!.| -0000003f -``` - -Or `VolInfo` output: -``` -$ 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: 0x00000057 -File Attributes: 0x00 -File State: 0xF8 - EFI_FILE_DATA_VALID -File Type: 0x02 EFI_FV_FILETYPE_FREEFORM ------------------------------------------------------------- - Type: EFI_SECTION_GUID_DEFINED - Size: 0x0000003F - SectionDefinitionGuid: fc1bcdb0-7d31-49aa-936a-a4600d9dd083 - - DataOffset: 0x001C - Attributes: 0x0002 -/------------ Encapsulation section start -----------------\ ------------------------------------------------------------- - Type: EFI_SECTION_RAW - Size: 0x0000000B ------------------------------------------------------------- - Type: EFI_SECTION_RAW - Size: 0x0000000B ------------------------------------------------------------- - Type: EFI_SECTION_RAW - Size: 0x0000000B -\------------ Encapsulation section end -------------------/ -There are a total of 1 files in this FV -``` - -## `EFI_GUID_DEFINED_SECTION.Attributes` - -``` -//***************************************************** -// Bit values for GuidedSectionHeader.Attributes -//***************************************************** -#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01 // Set to 1 if the section requires processing to obtain meaningful data from the section contents -#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02 // Set to 1 if the section contains authentication data that is reported -``` - -Look at the `DataOffset` and `Attributes` -- for the `TianoCompress` section -``` -DataOffset: 0x0018 -Attributes: 0x0001 -``` -- for the `GenCrc32` section: -``` -DataOffset: 0x001C -Attributes: 0x0002 -``` -Here you can see that `TianoCompress` section sets `EFI_GUIDED_SECTION_PROCESSING_REQUIRED` bit. Indeed, in this case the content of the section is compressed, and we need to decompress it before usage. `DataOffset` in this case points to the start of the data right after the header. - -In case of `GenCrc32` section the `EFI_GUIDED_SECTION_PROCESSING_REQUIRED` bit is unset, but in turn `EFI_GUIDED_SECTION_AUTH_STATUS_VALID` bit is set. `GenCrc32` just prepends the data with the CRC32 value. This is why DataOffset is increased to 4. And as we have some checksum, the auth bit is set. - - -If you want to, you can explicitly set these parameters. For example here is how you can invert these bits for our `TianoCompress` section: -``` -SECTION GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = FALSE AUTH_STATUS_VALID = TRUE { - ... -} -``` -This doesn't change `DataOffset`, but changes `Attributes`. If you wull look to the image with VolInfo you would see: -``` -Attributes: 0x0002 -``` - -As you might have guessed already the extenstion of a file for this section is "*.guided". - -# `EFI_SECTION_FIRMWARE_VOLUME_IMAGE` - -With the help of `EFI_SECTION_FIRMWARE_VOLUME_IMAGE` section we can include full Firmware Volumes (FV's) into the sections: -``` -EFI_SECTION_FIRMWARE_VOLUME_IMAGE - -Summary: -A leaf section type that contains a PI Firmware Volume. - -Prototype: -typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION; - -Description: -A firmware volume image section is a leaf section that contains a PI Firmware Volume Image. -``` - -The syntax look like this: -``` -SECTION FV_IMAGE = <FV_name> -``` -Off couse `[FV.<FV_name>]` should be defined in this case. - -Let's create another Firmware Volume with one simple file and test this type of section: -``` -[FD.SimpleImage] -BaseAddress = 0x0 -Size = 0x1000 -ErasePolarity = 1 - -0x100|0x500 -FV = SimpleVolume - -[FV.SimpleVolume] -FvAlignment = 16 - -FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { - SECTION FV_IMAGE = SimpleSubVolume -} - - -[FV.SimpleSubVolume] -FvAlignment = 16 - -FILE FREEFORM = dc070116-d211-4ab1-a657-e0b6c64b2643 { - SECTION RAW = $(WORKDIR)/hello.txt -} -``` - -Here is `VolInfo` output for this case: -``` -$ 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: 0x00000098 -File Attributes: 0x08 -File State: 0xF8 - EFI_FILE_DATA_VALID -File Type: 0x02 EFI_FV_FILETYPE_FREEFORM ------------------------------------------------------------- - Type: EFI_SECTION_RAW - Size: 0x0000000C ------------------------------------------------------------- - Type: EFI_SECTION_FIRMWARE_VOLUME_IMAGE - Size: 0x00000074 -/------------ Firmware Volume section start ---------------\ -============================================================ -File Name: DC070116-D211-4AB1-A657-E0B6C64B2643 -File Offset: 0x00000048 -File Length: 0x00000023 -File Attributes: 0x00 -File State: 0xF8 - EFI_FILE_DATA_VALID -File Type: 0x02 EFI_FV_FILETYPE_FREEFORM ------------------------------------------------------------- - Type: EFI_SECTION_RAW - Size: 0x0000000B -There are a total of 1 files in the child FV -\------------ Firmware Volume section end -----------------/ -There are a total of 1 files in this FV -``` - -The section file extension is "*fv.sec": -``` -$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1fv.sec -C -00000000 74 00 00 17 00 00 00 00 00 00 00 00 00 00 00 00 |t...............| -00000010 00 00 00 00 78 e5 8c 8c 3d 8a 1c 4f 99 35 89 61 |....x...=..O.5.a| -00000020 85 c3 2d d3 70 00 00 00 00 00 00 00 5f 46 56 48 |..-.p......._FVH| -00000030 00 08 04 00 48 00 ed ec 00 00 00 02 70 00 00 00 |....H.......p...| -00000040 01 00 00 00 00 00 00 00 00 00 00 00 16 01 07 dc |................| -00000050 11 d2 b1 4a a6 57 e0 b6 c6 4b 26 43 f6 aa 02 00 |...J.W...K&C....| -00000060 23 00 00 f8 0b 00 00 19 68 65 6c 6c 6f 21 0a ff |#.......hello!..| -00000070 ff ff ff ff |....| -00000074 -``` - -# `EFI_SECTION_DISPOSABLE` - -Creation of this type of section is not supported by edk2. There is no syntax for it. But nevertheless here is definition from the specification: -``` -EFI_SECTION_DISPOSABLE - -Summary: -An encapsulation section type in which the section data is disposable. - -Prototype: -typedef EFI_COMMON_SECTION_HEADER EFI_DISPOSABLE_SECTION; - -Description: -A disposable section is an encapsulation section in which the section data may be disposed of during the process of creating or updating a firmware image without significant impact on the usefulness of the file. -``` - -# `EFI_SECTION_PEI_DEPEX`/`EFI_SECTION_DXE_DEPEX` - -There are also sections for the dependency expressions for DXE and PEI stages. You probably wouldn't write them yourself, but here is their description for completeness: - -``` -EFI_SECTION_PEI_DEPEX - -Summary: -A leaf section type that is used to determine dispatch order for a PEIM. - -Prototype: -typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION; - -Description: -The PEI dependency expression section is a leaf section that contains a dependency expression that is used to determine dispatch order for a PEIM. See the Platform Initialization Pre-EFI Initialization Core Interface Specification for details regarding the format of the dependency expression. -``` - -``` -EFI_SECTION_DXE_DEPEX - -Summary: -A leaf section type that is used to determine the dispatch order for a DXE driver. - -Prototype: -typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION; - -Description -The DXE dependency expression section is a leaf section that contains a dependency expression that is used to determine the dispatch order for a DXE driver. See the Platform Initialization Driver Execution Environment Core Interface Specification for details regarding the format of the dependency expression. -``` - -The section file extension for these sections is "*.dpx" - diff --git a/Lessons_uncategorized/Lesson_FDF_FV_3/README.md b/Lessons_uncategorized/Lesson_FDF_FV_3/README.md new file mode 100644 index 0000000..4ce7e8d --- /dev/null +++ b/Lessons_uncategorized/Lesson_FDF_FV_3/README.md @@ -0,0 +1,394 @@ +# `EFI_SECTION_USER_INTERFACE` + +Let's investigate `EFI_SECTION_USER_INTERFACE=0x15` section type: +``` +EFI_SECTION_USER_INTERFACE + +Summary: +A leaf section type that contains a Unicode string that contains a human-readable file name. + +Prototype: +typedef struct { + EFI_COMMON_SECTION_HEADER CommonHeader; + CHAR16 FileNameString[]; +} EFI_USER_INTERFACE_SECTION; + +Description: +The user interface file name section is a leaf section that contains a Unicode string that contains a human-readable file name. +This section is optional and is not required for any file types. There must never be more than one user interface file name section contained within a file. +``` + +As you can see this section is really simple. Its data is just a `CHAR16` string. EDKII has syntax to initialize this section in-place: +``` +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION UI = "MyUI" +} +``` +`VolInfo` can display string of this section: +``` +$ VolInfo Build/UefiLessonsPkg/RELEASE_GCC5/FV/SIMPLEVOLUME.Fv -x Build/UefiLessonsPkg/RELEASE_GCC5/FV/Guid.xref +VolInfo Version 1.0 Build Developer Build based on Revision: Unknown +ParseGuidBaseNameFile: Build/UefiLessonsPkg/RELEASE_GCC5/FV/Guid.xref +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 MyUI +File Offset: 0x00000048 +File Length: 0x00000026 +File Attributes: 0x00 +File State: 0xF8 + EFI_FILE_DATA_VALID +File Type: 0x02 EFI_FV_FILETYPE_FREEFORM +------------------------------------------------------------ + Type: EFI_SECTION_USER_INTERFACE + Size: 0x0000000E + String: MyUI +There are a total of 1 files in this FV +``` + +Intermidiate file for this section would have `*.ui` extension: +``` +Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.ui -C +00000000 0e 00 00 15 4d 00 79 00 55 00 49 00 00 00 |....M.y.U.I...| +0000000e +``` + +# `EFI_SECTION_VERSION` + +Another simple section that you might come across is `EFI_SECTION_VERSION`: +``` +Summary: +A leaf section type that contains a numeric build number and an optional Unicode string that represents the file revision. + +Prototype: +typedef struct { + EFI_COMMON_SECTION_HEADER CommonHeader; + UINT16 BuildNumber; + CHAR16 VersionString[]; +} EFI_VERSION_SECTION; + +Parameters: +CommonHeader Common section header. CommonHeader.Type = EFI_SECTION_VERSION. +BuildNumber A UINT16 that represents a particular build. Subsequent builds have monotonically + increasing build numbers relative to earlier builds. +VersionString A null-terminated Unicode string that contains a text representation of the version. If + there is no text representation of the version, then an empty string must be provided. + +Description: +A version section is a leaf section that contains a numeric build number and an optional Unicode string that represents the file revision. +To facilitate versioning of PEIMs, DXE drivers, and other files, a version section may be included in a file. +There must never be more than one version section contained within a file. +``` + +The syntax for adding this section is this: +``` +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION BUILD_NUM = 42 VERSION = "MyVersion" +} +``` + +Once again `VolInfo` is able to display the content of this section: +``` +$ VolInfo Build/UefiLessonsPkg/RELEASE_GCC5/FV/SIMPLEVOLUME.Fv -x Build/UefiLessonsPkg/RELEASE_GCC5/FV/Guid.xref +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_VERSION + Size: 0x0000001A + Build Number: 0x002A + Version String: MyVersion +There are a total of 1 files in this FV +``` + +Intermidiate file for this section would have `*.ver` extension: +``` +$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.ver -C +00000000 1a 00 00 14 2a 00 4d 00 79 00 56 00 65 00 72 00 |....*.M.y.V.e.r.| +00000010 73 00 69 00 6f 00 6e 00 00 00 |s.i.o.n...| +0000001a +``` + +# `EFI_SECTION_FREEFORM_SUBTYPE_GUID` + +`EFI_SECTION_FREEFORM_SUBTYPE_GUID` section is very similar to raw, except that its header contains GUID value to describe the data inside the section. + +Here is definition from the PI specification: +``` +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; + +Parameters: +CommonHeader Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID. +SubtypeGuid This GUID is defined by the creator of the file. It is a vendor-defined file type. + +Description: +A free-form subtype GUID section is a leaf section that contains a single EFI_GUIDin the header to describe the raw data +``` + +The syntax for adding this section is this: +``` +SECTION SUBTYPE_GUID <Guid> = <File> +``` + +Let's try to use it: +``` +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION SUBTYPE_GUID cf1fce30-b181-4d6a-b860-354c922e5c3e = $(WORKDIR)/hello.txt +} +``` + +Here is how `VolInfo` output looks like in this case: +``` +$ 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: 0x00000033 +File Attributes: 0x00 +File State: 0xF8 + EFI_FILE_DATA_VALID +File Type: 0x02 EFI_FV_FILETYPE_FREEFORM +------------------------------------------------------------ + Type: EFI_SECTION_FREEFORM_SUBTYPE_GUID + Size: 0x0000001B + Guid: cf1fce30-b181-4d6a-b860-354c922e5c3e + +There are a total of 1 files in this FV +``` + +Intermidiate file for this section would have `*.guid` extension: +``` +$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.guid -C +00000000 1b 00 00 18 30 ce 1f cf 81 b1 6a 4d b8 60 35 4c |....0.....jM.`5L| +00000010 92 2e 5c 3e 68 65 6c 6c 6f 21 0a |..\>hello!.| +0000001b +``` + +# `EFI_SECTION_PE32`/`EFI_SECTION_PIC`/`EFI_SECTION_COMPATIBILITY16`/`EFI_SECTION_TE` + +Next there is a couple of sections for executable images. Most often you would use `EFI_SECTION_PE32` and include `.efi` code as your data. But nevertheless here is some info about all of the sections from the caption. + +Here in VolInfo output I will show you just the section part, as the rest doesn't have any interesting changes. Also as the build system doesn't check the content of the section data, I will just use the same `hello.txt` file for the section content that we've created earlier: + +## `EFI_SECTION_PE32` +``` +EFI_SECTION_PE32 +Summary +A leaf section type that contains a complete PE32+ image. +Prototype +typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION; + +Description +The PE32+ image section is a leaf section that contains a complete PE32+ image. Normal UEFI +executables are stored within PE32+ images +``` +Example usage: +``` +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION PE32 = $(WORKDIR)/hello.txt +} +``` +`VolInfo` display for the section: +``` +------------------------------------------------------------ + Type: EFI_SECTION_PE32 + Size: 0x0000000B +``` + +The section file extension is "*.pe32": +``` +$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.pe32 -C +00000000 0b 00 00 10 68 65 6c 6c 6f 21 0a |....hello!.| +0000000b +``` + +## `EFI_SECTION_PIC` +``` +EFI_SECTION_PIC +Summary +A leaf section type that contains a position-independent-code (PIC) image. +Prototype +typedef EFI_COMMON_SECTION_HEADER EFI_PIC_SECTION; + +Description +A PIC image section is a leaf section that contains a position-independent-code (PIC) image. +``` + +Example usage: +``` +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION PIC = $(WORKDIR)/hello.txt +} +``` + +`VolInfo` output for the section: +``` +------------------------------------------------------------ + Type: EFI_SECTION_PIC + Size: 0x0000000B +``` + +The section file extension is "*.pic": +``` +$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.pic -C +00000000 0b 00 00 11 68 65 6c 6c 6f 21 0a |....hello!.| +0000000b +``` + +## `EFI_SECTION_COMPATIBILITY16` +``` +EFI_SECTION_COMPATIBILITY16 + +Summary: +A leaf section type that contains an IA-32 16-bit executable image. + +Prototype: +typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION; + +Description: +A Compatibility16 image section is a leaf section that contains an IA-32 16-bit executable image. +IA-32 16-bit legacy code that may be included in PI Architecture firmware is stored in a 16-bit +executable image. +``` + +Example usage: +``` +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION COMPAT16 = $(WORKDIR)/hello.txt +} +``` +`VolInfo` output for the section: +``` +------------------------------------------------------------ + Type: EFI_SECTION_COMPATIBILITY16 + Size: 0x0000000B +``` + +The section file extension is "*.com16": +``` +$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.com16 -C +00000000 0b 00 00 16 68 65 6c 6c 6f 21 0a |....hello!.| +0000000b +``` + +## `EFI_SECTION_TE` +``` +EFI_SECTION_TE +Summary +A leaf section that contains a Terse Executable (TE) image. +Prototype +typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION; + +Description +The terse executable section is a leaf section that contains a Terse Executable (TE) image. A TE +image is an executable image format specific to the PI Architecture that is used for storing +executable images in a smaller amount of space than would be required by a full PE32+ image. +``` + +Example usage: +``` +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION TE = $(WORKDIR)/hello.txt +} +``` + +You would find that in this case build actually checks the file content. Build fails with the error: +``` +DOS header signature was not found in /<...>/hello.txt image. +``` +But if you would use correct file, the `VolInfo` would show you `EFI_SECTION_TE` section. + +The section file extension is "*.te": + +# `EFI_SECTION_DISPOSABLE` + +Creation of this type of section is not supported by edk2. There is no syntax for it. But nevertheless here is definition from the specification: +``` +EFI_SECTION_DISPOSABLE + +Summary: +An encapsulation section type in which the section data is disposable. + +Prototype: +typedef EFI_COMMON_SECTION_HEADER EFI_DISPOSABLE_SECTION; + +Description: +A disposable section is an encapsulation section in which the section data may be disposed of during the process of creating or updating a firmware image without significant impact on the usefulness of the file. +``` + +# `EFI_SECTION_PEI_DEPEX`/`EFI_SECTION_DXE_DEPEX` + +There are also sections for the dependency expressions for DXE and PEI stages. You probably wouldn't write them yourself, but here is their description for completeness: + +``` +EFI_SECTION_PEI_DEPEX + +Summary: +A leaf section type that is used to determine dispatch order for a PEIM. + +Prototype: +typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION; + +Description: +The PEI dependency expression section is a leaf section that contains a dependency expression that is used to determine dispatch order for a PEIM. See the Platform Initialization Pre-EFI Initialization Core Interface Specification for details regarding the format of the dependency expression. +``` + +``` +EFI_SECTION_DXE_DEPEX + +Summary: +A leaf section type that is used to determine the dispatch order for a DXE driver. + +Prototype: +typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION; + +Description +The DXE dependency expression section is a leaf section that contains a dependency expression that is used to determine the dispatch order for a DXE driver. See the Platform Initialization Driver Execution Environment Core Interface Specification for details regarding the format of the dependency expression. +``` + +The section file extension for these sections is "*.dpx" + diff --git a/Lessons_uncategorized/Lesson_FDF_FV_4/README.md b/Lessons_uncategorized/Lesson_FDF_FV_4/README.md new file mode 100644 index 0000000..3858062 --- /dev/null +++ b/Lessons_uncategorized/Lesson_FDF_FV_4/README.md @@ -0,0 +1,475 @@ +# `EFI_SECTION_COMPRESSION` + +The `EFI_SECTION_COMPRESSION` is encapsulation section in a sense that it is a section that have sections in itself. Here is full definition from the PI specification: +``` +EFI_SECTION_COMPRESSION + +Summary: +An encapsulation section type in which the section data is compressed. + +Prototype: +typedef struct { + EFI_COMMON_SECTION_HEADER CommonHeader; + UINT32 UncompressedLength; + UINT8 CompressionType; +} EFI_COMPRESSION_SECTION; + +Parameters: +CommonHeader Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION. +UncompressedLength UINT32 that indicates the size of the section data after decompression. +CompressionType Indicates which compression algorithm is used. + +Description: +A compression section is an encapsulation section in which the section data is compressed. To process the contents and extract the enclosed section stream, the section data must be decompressed using the decompressor indicated by the CompressionType parameter. The decompressed image is then interpreted as a section stream. +``` + +The example usage is this: +``` +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION COMPRESS { + SECTION RAW = $(WORKDIR)/hello.txt + SECTION RAW = $(WORKDIR)/hello.txt + SECTION RAW = $(WORKDIR)/hello.txt + } +} +``` + +`VolInfo` would parse it like this: +``` +$ 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: 0x00000042 +File Attributes: 0x00 +File State: 0xF8 + EFI_FILE_DATA_VALID +File Type: 0x02 EFI_FV_FILETYPE_FREEFORM +------------------------------------------------------------ + Type: EFI_SECTION_COMPRESSION + Size: 0x0000002A + Uncompressed Length: 0x00000023 + Compression Type: EFI_STANDARD_COMPRESSION +/------------ Encapsulation section start -----------------\ +------------------------------------------------------------ + Type: EFI_SECTION_RAW + Size: 0x0000000B +------------------------------------------------------------ + Type: EFI_SECTION_RAW + Size: 0x0000000B +------------------------------------------------------------ + Type: EFI_SECTION_RAW + Size: 0x0000000B +\------------ Encapsulation section end -------------------/ +There are a total of 1 files in this FV +``` + +It is possible to set compression type in the section syntax. By default compress uses standard `PI_STD` compression. + +If you want to you could point it explicitly. The output would be the same: +``` +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION COMPRESS PI_STD { + SECTION RAW = $(WORKDIR)/hello.txt + SECTION RAW = $(WORKDIR)/hello.txt + SECTION RAW = $(WORKDIR)/hello.txt + } +} +``` + +If you don't want any compression for your data you can use `PI_NONE` compression type. +``` +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION COMPRESS PI_NONE { + SECTION RAW = $(WORKDIR)/hello.txt + SECTION RAW = $(WORKDIR)/hello.txt + SECTION RAW = $(WORKDIR)/hello.txt + } +} +``` + +In this case section would just work as a section aggregator. + +For the proof compare the `hexdump` output from the compression section with `PI_STD` argument (or without any arguments): +``` +$ hexdump -C Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.com +00000000 2a 00 00 01 23 00 00 00 01 19 00 00 00 23 00 00 |*...#........#..| +00000010 00 00 0d 3a 51 8d 45 7d 6a 6a 52 e1 7e 0c 86 0b |...:Q.E}jjR.~...| +00000020 92 10 25 86 35 27 6d 1e c0 00 |..%.5'm...| +0000002a +``` +And with the `PI_NONE` argument: +``` +$ hexdump -C Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.com +00000000 2c 00 00 01 23 00 00 00 00 0b 00 00 19 68 65 6c |,...#........hel| +00000010 6c 6f 21 0a 00 0b 00 00 19 68 65 6c 6c 6f 21 0a |lo!......hello!.| +00000020 00 0b 00 00 19 68 65 6c 6c 6f 21 0a |.....hello!.| +0000002c +``` +In the second case you can clearly see the `hello!` strings from our `hello.txt` file. + +As you might have guessed already the extenstion of a file for this section is "*.com". + +# `EFI_SECTION_GUID_DEFINED` + +The `EFI_SECTION_GUID_DEFINED` is another encapsulation section. But in this case the data inside is processed with a specific tool, and the GUID of this tool is written to the section header, so you would know how exactly you need to interpret/decompress the data. In a way it is a more advanced `COMPRESS` section. The complete definition from the specification is this: +``` +EFI_SECTION_GUID_DEFINED + +Summary: +An encapsulation section type in which the method of encapsulation is defined by an identifying GUID. + +Prototype: +typedef struct { + EFI_COMMON_SECTION_HEADER CommonHeader; + EFI_GUID SectionDefinitionGuid; + UINT16 DataOffset; + UINT16 Attributes; + // GuidSpecificHeaderFields; +} EFI_GUID_DEFINED_SECTION; + +Parameters: +CommonHeader Common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED. +SectionDefinitionGuid GUID that defines the format of the data that follows. It is a vendor-defined section type. +DataOffset Contains the offset in bytes from the beginning of the common header to the first byte of the data. +Attributes Bit field that declares some specific characteristics of the section contents. +GuidSpecificHeaderFields Zero or more bytes of data that are defined by the section’s GUID. An example of this data would be a digital signature and manifest. +Data Zero or more bytes of arbitrary data. The format of the data is defined by SectionDefinitionGuid. + +Description: +A GUID-defined section contains a section-type-specific header that contains an identifying GUID, followed by an arbitrary amount of data. It is an encapsulation section in which the method of encapsulation is defined by the GUID. A matching instance of EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL (DXE) or EFI_GUIDED_SECTION_EXTRACTION_PPI (PEI) is required to extract the contents of this encapsulation section. +The GUID-defined section enables custom encapsulation section types for any purpose. One commonly expected use is creating an encapsulation section to enable a cryptographic authentication of the section contents. +``` + +The syntax for this section look like this: +``` +SECTION GUIDED <Guid> { + <...> +} +``` + +What GUIDs you can use? The ones that you have in you `Conf/tools_def.txt`. For example: +``` +################## +# GenCrc32 tool definitions +################## +*_*_*_CRC32_PATH = GenCrc32 +*_*_*_CRC32_GUID = FC1BCDB0-7D31-49AA-936A-A4600D9DD083 + +################## +# BrotliCompress tool definitions +################## +*_*_*_BROTLI_PATH = BrotliCompress +*_*_*_BROTLI_GUID = 3D532050-5CDA-4FD0-879E-0F7F630D5AFB + +################## +# LzmaCompress tool definitions +################## +*_*_*_LZMA_PATH = LzmaCompress +*_*_*_LZMA_GUID = EE4E5898-3914-4259-9D6E-DC7BD79403CF + +################## +# LzmaF86Compress tool definitions with converter for x86 code. +# It can improve the compression ratio if the input file is IA32 or X64 PE image. +################## +*_*_*_LZMAF86_PATH = LzmaF86Compress +*_*_*_LZMAF86_GUID = D42AE6BD-1352-4bfb-909A-CA72A6EAE889 + +################## +# TianoCompress tool definitions +################## +*_*_*_TIANO_PATH = TianoCompress +*_*_*_TIANO_GUID = A31280AD-481E-41B6-95E8-127F4C984779 +``` + +If you'll want to write your own utility someday, this is the typical call for the utility: +``` +<tool> -e -o <output_file> <input_file> +``` +`-e` here means `encode` and `-o` the output file. + + +Now let's write an example that uses GUIDED section. Here we use `TianoCompress` utility GUID for the processing tool: +``` +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION GUIDED A31280AD-481E-41B6-95E8-127F4C984779 { + SECTION RAW = $(WORKDIR)/hello.txt + SECTION RAW = $(WORKDIR)/hello.txt + SECTION RAW = $(WORKDIR)/hello.txt + } +} +``` + +The `hexdump` of this section would look like this: +``` +$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.guided -C +00000000 39 00 00 02 ad 80 12 a3 1e 48 b6 41 95 e8 12 7f |9........H.A....| +00000010 4c 98 47 79 18 00 01 00 19 00 00 00 23 00 00 00 |L.Gy........#...| +00000020 00 0d 3a 51 8d 45 7d 6a 6a 52 e1 7e 0c 86 0b 92 |..:Q.E}jjR.~....| +00000030 10 09 61 8d 49 db 47 b0 00 |..a.I.G..| +00000039 +``` + +And the `VolInfo` output for the FV would look like this: +``` +$ 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: 0x00000051 +File Attributes: 0x00 +File State: 0xF8 + EFI_FILE_DATA_VALID +File Type: 0x02 EFI_FV_FILETYPE_FREEFORM +------------------------------------------------------------ + Type: EFI_SECTION_GUID_DEFINED + Size: 0x00000039 + SectionDefinitionGuid: a31280ad-481e-41b6-95e8-127f4c984779 + + DataOffset: 0x0018 + Attributes: 0x0001 +/------------ Encapsulation section start -----------------\ +------------------------------------------------------------ + Type: EFI_SECTION_RAW + Size: 0x0000000B +------------------------------------------------------------ + Type: EFI_SECTION_RAW + Size: 0x0000000B +------------------------------------------------------------ + Type: EFI_SECTION_RAW + Size: 0x0000000B +\------------ Encapsulation section end -------------------/ +There are a total of 1 files in this FV +``` + +One more notice. If you woudn't supply any GUID like this: +``` +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION GUIDED { + SECTION RAW = $(WORKDIR)/hello.txt + SECTION RAW = $(WORKDIR)/hello.txt + SECTION RAW = $(WORKDIR)/hello.txt + } +} +``` +The section would be processed by the `fc1bcdb0-7d31-49aa-936a-a4600d9dd083` tool, which correspond to the `GenCrc32` tool. For the proof look at hexdump: +``` +$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1.guided -C +00000000 3f 00 00 02 b0 cd 1b fc 31 7d aa 49 93 6a a4 60 |?.......1}.I.j.`| +00000010 0d 9d d0 83 1c 00 02 00 84 3e 2b 76 0b 00 00 19 |.........>+v....| +00000020 68 65 6c 6c 6f 21 0a 00 0b 00 00 19 68 65 6c 6c |hello!......hell| +00000030 6f 21 0a 00 0b 00 00 19 68 65 6c 6c 6f 21 0a |o!......hello!.| +0000003f +``` + +Or `VolInfo` output: +``` +$ 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: 0x00000057 +File Attributes: 0x00 +File State: 0xF8 + EFI_FILE_DATA_VALID +File Type: 0x02 EFI_FV_FILETYPE_FREEFORM +------------------------------------------------------------ + Type: EFI_SECTION_GUID_DEFINED + Size: 0x0000003F + SectionDefinitionGuid: fc1bcdb0-7d31-49aa-936a-a4600d9dd083 + + DataOffset: 0x001C + Attributes: 0x0002 +/------------ Encapsulation section start -----------------\ +------------------------------------------------------------ + Type: EFI_SECTION_RAW + Size: 0x0000000B +------------------------------------------------------------ + Type: EFI_SECTION_RAW + Size: 0x0000000B +------------------------------------------------------------ + Type: EFI_SECTION_RAW + Size: 0x0000000B +\------------ Encapsulation section end -------------------/ +There are a total of 1 files in this FV +``` + +## `EFI_GUID_DEFINED_SECTION.Attributes` + +``` +//***************************************************** +// Bit values for GuidedSectionHeader.Attributes +//***************************************************** +#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01 // Set to 1 if the section requires processing to obtain meaningful data from the section contents +#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02 // Set to 1 if the section contains authentication data that is reported +``` + +Look at the `DataOffset` and `Attributes` +- for the `TianoCompress` section +``` +DataOffset: 0x0018 +Attributes: 0x0001 +``` +- for the `GenCrc32` section: +``` +DataOffset: 0x001C +Attributes: 0x0002 +``` +Here you can see that `TianoCompress` section sets `EFI_GUIDED_SECTION_PROCESSING_REQUIRED` bit. Indeed, in this case the content of the section is compressed, and we need to decompress it before usage. `DataOffset` in this case points to the start of the data right after the header. + +In case of `GenCrc32` section the `EFI_GUIDED_SECTION_PROCESSING_REQUIRED` bit is unset, but in turn `EFI_GUIDED_SECTION_AUTH_STATUS_VALID` bit is set. `GenCrc32` just prepends the data with the CRC32 value. This is why DataOffset is increased to 4. And as we have some checksum, the auth bit is set. + + +If you want to, you can explicitly set these parameters. For example here is how you can invert these bits for our `TianoCompress` section: +``` +SECTION GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = FALSE AUTH_STATUS_VALID = TRUE { + ... +} +``` +This doesn't change `DataOffset`, but changes `Attributes`. If you wull look to the image with VolInfo you would see: +``` +Attributes: 0x0002 +``` + +As you might have guessed already the extenstion of a file for this section is "*.guided". + +# `EFI_SECTION_FIRMWARE_VOLUME_IMAGE` + +With the help of `EFI_SECTION_FIRMWARE_VOLUME_IMAGE` section we can include full Firmware Volumes (FV's) into the sections: +``` +EFI_SECTION_FIRMWARE_VOLUME_IMAGE + +Summary: +A leaf section type that contains a PI Firmware Volume. + +Prototype: +typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION; + +Description: +A firmware volume image section is a leaf section that contains a PI Firmware Volume Image. +``` + +The syntax look like this: +``` +SECTION FV_IMAGE = <FV_name> +``` +Off couse `[FV.<FV_name>]` should be defined in this case. + +Let's create another Firmware Volume with one simple file and test this type of section: +``` +[FD.SimpleImage] +BaseAddress = 0x0 +Size = 0x1000 +ErasePolarity = 1 + +0x100|0x500 +FV = SimpleVolume + +[FV.SimpleVolume] +FvAlignment = 16 + +FILE FREEFORM = f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23 { + SECTION FV_IMAGE = SimpleSubVolume +} + + +[FV.SimpleSubVolume] +FvAlignment = 16 + +FILE FREEFORM = dc070116-d211-4ab1-a657-e0b6c64b2643 { + SECTION RAW = $(WORKDIR)/hello.txt +} +``` + +Here is `VolInfo` output for this case: +``` +$ 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: 0x00000098 +File Attributes: 0x08 +File State: 0xF8 + EFI_FILE_DATA_VALID +File Type: 0x02 EFI_FV_FILETYPE_FREEFORM +------------------------------------------------------------ + Type: EFI_SECTION_RAW + Size: 0x0000000C +------------------------------------------------------------ + Type: EFI_SECTION_FIRMWARE_VOLUME_IMAGE + Size: 0x00000074 +/------------ Firmware Volume section start ---------------\ +============================================================ +File Name: DC070116-D211-4AB1-A657-E0B6C64B2643 +File Offset: 0x00000048 +File Length: 0x00000023 +File Attributes: 0x00 +File State: 0xF8 + EFI_FILE_DATA_VALID +File Type: 0x02 EFI_FV_FILETYPE_FREEFORM +------------------------------------------------------------ + Type: EFI_SECTION_RAW + Size: 0x0000000B +There are a total of 1 files in the child FV +\------------ Firmware Volume section end -----------------/ +There are a total of 1 files in this FV +``` + +The section file extension is "*fv.sec": +``` +$ hexdump Build/UefiLessonsPkg/RELEASE_GCC5/FV/Ffs/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SIMPLEVOLUME/f6ed9cf0-cdc1-40a1-9909-ac6a2f435e23SEC1fv.sec -C +00000000 74 00 00 17 00 00 00 00 00 00 00 00 00 00 00 00 |t...............| +00000010 00 00 00 00 78 e5 8c 8c 3d 8a 1c 4f 99 35 89 61 |....x...=..O.5.a| +00000020 85 c3 2d d3 70 00 00 00 00 00 00 00 5f 46 56 48 |..-.p......._FVH| +00000030 00 08 04 00 48 00 ed ec 00 00 00 02 70 00 00 00 |....H.......p...| +00000040 01 00 00 00 00 00 00 00 00 00 00 00 16 01 07 dc |................| +00000050 11 d2 b1 4a a6 57 e0 b6 c6 4b 26 43 f6 aa 02 00 |...J.W...K&C....| +00000060 23 00 00 f8 0b 00 00 19 68 65 6c 6c 6f 21 0a ff |#.......hello!..| +00000070 ff ff ff ff |....| +00000074 +``` + |