Skip to content

Conversation

philnoh2
Copy link

@philnoh2 philnoh2 commented Sep 24, 2025

Currently the FMMT tool supports CRC32 GUID section (Ref. GuidTools.py, FmmtConf.ini). But it is found that there are errors for the FV with CRC32 section. For example, the errors are checked on the following commands.

--v : Show FV information except for the FV
--a : Show "Target Fv not found!!!" when adding an FFS file to the FV
--d : Show "Target Ffs not found!!!" when deleting an FFS file in the FV

They are caused by the mismatch for CRC32 section data between the FMMT and GenCrc32 tools. The FMMT tool returns CRC32 section data without CRC checksum field (4 bytes). The GenCrc32 tool (with -d option, verify CRC32 value for the input file) requires CRC32 section data including CRC checksum field (4 bytes).

Fix the issue through adjusting the section data to include CRC checksum field. Like the table below, currently DataOffset field for CRC32 GUID section is reported as 0x1C differently (GUID Section header length: 0x18 + Checksum field: 0x4).

Section Section Header Length DataOffset
TianoCompress 0x18 0x18
LzmaCompress 0x18 0x18
LzmaF86Compress 0x18 0x18
BrotliCompress 0x18 0x18
GenCrc32 0x18 0x1C

Instead of DataOffset field that includes CRC checksum field, configure the section data based on the offset from section header length (0x18) that was previously calculated. This update enables GUID sections to use the same offset consistently.

Ref>
FmmtConf.ini :
fc1bcdb0-7d31-49aa-936a-a4600d9dd083 CRC32 GenCrc32

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

The update has been tested and verified on AMD platforms that enable CRC32 GUID section for DXE FV compact.

Integration Instructions

N/A

Currently the FMMT tool supports CRC32 GUID section (Ref. GuidTools.py).
But it is found that there are errors for the FV with CRC32 section.
For example, the errors are checked on the following commands.

--v : Show FV information except for the FV
--a : Show "Target Fv not found!!!" when adding an FFS file to the FV
--d : Show "Target Ffs not found!!!" when deleting an FFS file in the FV

They are caused by the mismatch for CRC32 section data between the FMMT
and GenCrc32 tools. The FMMT tool returns CRC32 section data without CRC
checksum field (4 bytes). The GenCrc32 tool (with -d option, verify CRC32
value for the input file) requires CRC32 section data including CRC
checksum field (4 bytes).

Fix the issue through adjusting the section data to include CRC checksum
field. Currently DataOffset field for CRC32 GUID section is reported as
0x1C differently (GUID Section header length: 0x18 + Checksum field: 0x4).
Instead of DataOffset field that includes CRC checksum field, configure
the section data based on the offset from section header length (0x18)
that was previously calculated. This update enables GUID sections to use
the same offset consistently.

Signed-off-by: Phil Noh <Phil.Noh@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant