coreboot-kgpe-d16/util/cbfstool/fv.h
Dun Tan 4a35940137 util/cbftool: Fix the bug in parsing Uefipayload with extended header
The patch is to fix "Not a usable UEFI firmware volume" issue when
creating CBFS/flash image. This issue is caused by adding FvNameGuid
in UefiPayloadEntry.fdf in EDKII. There is an ext header between header
of Fv and header of PayloadEntry in Fv with FvNameGuid. The ext header
causes the UefiPayloadEntry to be found incorrectly when parsing Fv.

Commit in EDKII: 4bac086e8e007c7143e33f87bb96238326d1d6ba
Bugzila: https://bugzilla.tianocore.org/show_bug.cgi?id=3585

Signed-off-by: Dun Tan <dun.tan@intel.com>
Change-Id: Id063efb1c8e6c7a96ec2182e87b71c7e8b7b6423
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57296
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: King Sumo <kingsumos@gmail.com>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-09-02 06:07:08 +00:00

39 lines
826 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#define FV_SIGNATURE 0x4856465f
typedef struct {
uint8_t padding[16];
uint8_t guid[16];
uint64_t fv_length;
uint32_t signature;
uint32_t attributes;
uint16_t header_length;
uint16_t checksum;
uint16_t ext_header_offs;
uint8_t reserved;
uint8_t revision;
/* not used here: block map entries */
} firmware_volume_header_t;
#define FILETYPE_SEC 0x03
#define FILETYPE_PAD 0xf0
typedef struct {
uint8_t name[16];
uint16_t integrity;
uint8_t file_type;
uint8_t attributes;
uint8_t size[3];
uint8_t state;
} ffs_file_header_t;
#define SECTION_PE32 0x10
#define SECTION_RAW 0x19
typedef struct {
uint8_t size[3];
uint8_t section_type;
} common_section_header_t;
typedef struct {
uint8_t guid[16];
uint32_t ext_header_size;
} firmware_volume_ext_header_t;