summaryrefslogtreecommitdiffstats
path: root/util/cbfstool/cbfs_image.h
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2014-12-23 15:10:12 -0800
committerPatrick Georgi <pgeorgi@google.com>2015-04-18 08:48:05 +0200
commit458a12e52beb9dfcb1884dfad6effa8b3d98e8a4 (patch)
tree03ec1a47ffe8990aa2fd33cdbac31395294ce0b9 /util/cbfstool/cbfs_image.h
parent14ecb5434b88b5620c4b4bb771a3c2b00c2efe6b (diff)
downloadcoreboot-458a12e52beb9dfcb1884dfad6effa8b3d98e8a4.tar.gz
coreboot-458a12e52beb9dfcb1884dfad6effa8b3d98e8a4.tar.bz2
coreboot-458a12e52beb9dfcb1884dfad6effa8b3d98e8a4.zip
cbfstool: allow user to explicitly specify header location
There potentially could be multiple CBFS instances present in the firmware image. cbfstool should be able to operate on any of them, not just the first one present. To accomplish that, allow all CBFS commands to accept the -H parameter (which specifies the exact CBFS header location in the image). If this parameter is specified, the image is not searched for the CBFS header, only the specified location is checked for validity, If the location is valid, it is considered to be the CBFS header, if not - the tool exits with an error status. Note, that default behavior of the tool does not change. BRANCH=storm BUG=chrome-os-partner:34161, chromium:445938 TEST=run the following experiments: - examined an image with three CBFS instances, was able to print all of them. - built a rambi coreboot image and tried the following (cbfstool output abbreviated): $ ./util/cbfstool/cbfstool /build/rambi/firmware/coreboot.rom print coreboot.rom: 8192 kB, bootblocksize 2448, romsize 8388608, offset 0x700000 alignment: 64 bytes, architecture: x86 Name Offset Type Size cmos_layout.bin 0x700000 cmos_layout 1164 ... (empty) 0x7ec600 null 77848 $ \od -tx4 -Ax /build/rambi/firmware/coreboot.rom | tail -2 7ffff0 fff67de9 000000ff fff6dfe9 fffff650 800000 $ ./util/cbfstool/cbfstool /build/rambi/firmware/coreboot.rom print -H 0x7ff650 coreboot.rom: 8192 kB, bootblocksize 2448, romsize 8388608, offset 0x700000 alignment: 64 bytes, architecture: x86 Name Offset Type Size cmos_layout.bin 0x700000 cmos_layout 1164 ... (empty) 0x7ec600 null 77848 $ ./util/cbfstool/cbfstool /build/rambi/firmware/coreboot.rom print -H 0x7ff654 E: /build/rambi/firmware/coreboot.rom does not have CBFS master header. E: Could not load ROM image '/build/rambi/firmware/coreboot.rom'. $ Change-Id: I64cbdc79096f3c7a113762b641305542af7bbd60 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 86b88222df6eed25bb176d653305e2e57e18b73a Original-Change-Id: I486092e222c96c65868ae7d41a9e8976ffcc93c4 Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/237485 Original-Reviewed-by: David Hendricks <dhendrix@chromium.org> Original-Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Original-Reviewed-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/9741 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util/cbfstool/cbfs_image.h')
-rw-r--r--util/cbfstool/cbfs_image.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/util/cbfstool/cbfs_image.h b/util/cbfstool/cbfs_image.h
index 0a05eb284118..2c1be3da1c09 100644
--- a/util/cbfstool/cbfs_image.h
+++ b/util/cbfstool/cbfs_image.h
@@ -52,7 +52,8 @@ int cbfs_image_create(struct cbfs_image *image,
int32_t entries_offset);
/* Loads a CBFS image from file. Returns 0 on success, otherwise non-zero. */
-int cbfs_image_from_file(struct cbfs_image *image, const char *filename);
+int cbfs_image_from_file(struct cbfs_image *image,
+ const char *filename, uint32_t offset);
/* Writes a CBFS image into file. Returns 0 on success, otherwise non-zero. */
int cbfs_image_write_file(struct cbfs_image *image, const char *filename);
@@ -106,7 +107,8 @@ int cbfs_walk(struct cbfs_image *image, cbfs_entry_callback callback, void *arg)
* NULL (including when multiple headers were found). If there is a X86 ROM
* style signature (pointer at 0xfffffffc) found in ROM, it will be selected as
* the only header.*/
-struct cbfs_header *cbfs_find_header(char *data, size_t size);
+struct cbfs_header *cbfs_find_header(char *data, size_t size,
+ uint32_t forced_offset);
/* Returns the first cbfs_file entry in CBFS image by CBFS header (no matter if
* the entry has valid content or not), otherwise NULL. */