dump_fmap: Find correct FMAP structure by checking version.

Firmware images reading its own FMAP structure may have FMAP signature in code
and cause dump_fmap to parse incorrectly. Since currently there is only one
major version for FMAP (and the structure defined in fmap.h also applies only to
current version), we can improve that by checking major version number to skip
signatures in firmware code.

BUG=chromium:236347
TEST=emerge vboot_reference; dump_fmap /build/daisy/firmware/image.bin # success
BRANCH=none

Change-Id: I1d8f49bb88357e7a3a945fbdba9d9a7c4e177ac4
Reviewed-on: https://gerrit.chromium.org/gerrit/59362
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
This commit is contained in:
Hung-Te Lin
2013-06-20 10:32:48 +08:00
committed by ChromeBot
parent a75071c252
commit 556ec4fd60
2 changed files with 9 additions and 3 deletions

View File

@@ -15,6 +15,7 @@
#define FMAP_SIGNATURE "__FMAP__"
#define FMAP_SIGNATURE_SIZE 8
#define FMAP_SEARCH_STRIDE 4
#define FMAP_VER_MAJOR 1
typedef struct _FmapHeader {
char fmap_signature[FMAP_SIGNATURE_SIZE]; /* avoiding endian issues */
uint8_t fmap_ver_major;