[coreboot] New patch to review for coreboot: 161fd62 cbfstool: Handle alignment in UEFI payloads

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Sat Feb 9 13:28:28 CET 2013


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2334

-gerrit

commit 161fd6250c7ebe90cfc19d32ea43d852ad581cde
Author: Patrick Georgi <patrick at georgi-clan.de>
Date:   Sat Feb 9 13:26:19 2013 +0100

    cbfstool: Handle alignment in UEFI payloads
    
    Tiano for X64 is much cleaner to start up when using higher alignments in
    firmware volumes. These are implemented using padding files and sections
    that cbfstool knew nothing about. Skip these.
    
    Change-Id: Ibc433070ae6f822d00af2f187018ed8b358e2018
    Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
 util/cbfstool/cbfs-mkpayload.c | 10 ++++++++++
 util/cbfstool/fv.h             |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/util/cbfstool/cbfs-mkpayload.c b/util/cbfstool/cbfs-mkpayload.c
index e207b3e..6115e49 100644
--- a/util/cbfstool/cbfs-mkpayload.c
+++ b/util/cbfstool/cbfs-mkpayload.c
@@ -279,6 +279,11 @@ int parse_fv_to_payload(const struct buffer *input,
 	}
 
 	fh = (ffs_file_header_t *)(input->data + fv->header_length);
+	while (fh->file_type == FILETYPE_PAD) {
+		unsigned long offset = (fh->size[2] << 16) | (fh->size[1] << 8) | fh->size[0];
+		ERROR("skipping %d bytes of FV padding\n", offset);
+		fh = (ffs_file_header_t *)(((void*)fh) + offset);
+	}
 	if (fh->file_type != FILETYPE_SEC) {
 		ERROR("Not a usable UEFI firmware volume.\n");
 		INFO("First file in first FV not a SEC core.\n");
@@ -286,6 +291,11 @@ int parse_fv_to_payload(const struct buffer *input,
 	}
 
 	cs = (common_section_header_t *)&fh[1];
+	while (cs->section_type == SECTION_RAW) {
+		unsigned long offset = (cs->size[2] << 16) | (cs->size[1] << 8) | cs->size[0];
+		ERROR("skipping %d bytes of section padding\n", offset);
+		cs = (common_section_header_t *)(((void*)cs) + offset);
+	}
 	if (cs->section_type != SECTION_PE32) {
 		ERROR("Not a usable UEFI firmware volume.\n");
 		INFO("Section type not PE32.\n");
diff --git a/util/cbfstool/fv.h b/util/cbfstool/fv.h
index 1ea50e0..88457bf 100644
--- a/util/cbfstool/fv.h
+++ b/util/cbfstool/fv.h
@@ -33,6 +33,7 @@ typedef struct {
 } firmware_volume_header_t;
 
 #define FILETYPE_SEC 0x03
+#define FILETYPE_PAD 0xf0
 typedef struct {
 	uint8_t  name[16];
 	uint16_t integrity;
@@ -43,6 +44,7 @@ typedef struct {
 } ffs_file_header_t;
 
 #define SECTION_PE32 0x10
+#define SECTION_RAW 0x19
 typedef struct {
 	uint8_t size[3];
 	uint8_t section_type;



More information about the coreboot mailing list