diff options
author | Patrick Georgi <pgeorgi@chromium.org> | 2015-09-11 18:34:39 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-09-28 10:13:33 +0000 |
commit | 2f953d304e02be9a2f4f6fbd86b41dd6c86ec5db (patch) | |
tree | 5653a8068aa81a15d5ef3a8b462137526a0d85e4 /util/cbfstool/cbfs_image.c | |
parent | 6dd99fcafe83fed2632a90821de6373516c14a0c (diff) | |
download | coreboot-2f953d304e02be9a2f4f6fbd86b41dd6c86ec5db.tar.xz |
cbfstool: prefer fmap data over cbfs master header if it exists
Up to now, if both fmap and a master header existed, the master header
was used. Now, use the master header only if no fmap is found.
Change-Id: Iafbf2c9dc325597e23a9780b495549b5d912e9ad
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: http://review.coreboot.org/11629
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util/cbfstool/cbfs_image.c')
-rw-r--r-- | util/cbfstool/cbfs_image.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index 55f80844db..24ab0c4977 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -343,20 +343,22 @@ int cbfs_image_from_buffer(struct cbfs_image *out, struct buffer *in, buffer_clone(&out->buffer, in); out->has_header = false; + if (cbfs_is_valid_cbfs(out)) { + return 0; + } + void *header_loc = cbfs_find_header(in->data, in->size, offset); if (header_loc) { cbfs_get_header(&out->header, header_loc); out->has_header = true; cbfs_fix_legacy_size(out, header_loc); + return 0; } else if (offset != ~0u) { ERROR("The -H switch is only valid on legacy images having CBFS master headers.\n"); return 1; - } else if (!cbfs_is_valid_cbfs(out)) { - ERROR("Selected image region is not a valid CBFS.\n"); - return 1; } - - return 0; + ERROR("Selected image region is not a valid CBFS.\n"); + return 1; } int cbfs_copy_instance(struct cbfs_image *image, size_t copy_offset, |