summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2015-08-11 15:55:16 +0200
committerPatrick Georgi <pgeorgi@google.com>2015-08-13 16:09:17 +0200
commit7fd14184fb7cf2a4a713d47b8028155f77a090fc (patch)
treebc970dd870c083a9f2663d76f5a206dbeacdaf0e
parentf82049793890cf615e7f7604720f3f8603aced87 (diff)
cbfstool: honor larger-than-usual header sizes in cbfs_add_entry_at()
If an earlier stage built a larger header, cbfs_add_entry_at() shouldn't decide to go with the most boring, least featureful header type (and its size) instead. Change-Id: Icc5dcd9a797a0f3c42f91cddd21b3b3916095b63 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: http://review.coreboot.org/11217 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--util/cbfstool/cbfs_image.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index ed065b0a93..b45969cf9c 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -457,13 +457,13 @@ static int cbfs_add_entry_at(struct cbfs_image *image,
const char *name,
uint32_t type,
const void *data,
- uint32_t content_offset)
+ uint32_t content_offset,
+ uint32_t header_size)
{
struct cbfs_file *next = cbfs_find_next_entry(image, entry);
uint32_t addr = cbfs_get_entry_addr(image, entry),
addr_next = cbfs_get_entry_addr(image, next);
- uint32_t header_size = cbfs_calculate_file_header_size(name),
- min_entry_size = cbfs_calculate_file_header_size("");
+ uint32_t min_entry_size = cbfs_calculate_file_header_size("");
uint32_t len, target;
uint32_t align = image->has_header ? image->header.align :
CBFS_ENTRY_ALIGNMENT;
@@ -635,7 +635,8 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
addr, addr_next - addr, content_offset);
if (cbfs_add_entry_at(image, entry, buffer->size, name, type,
- buffer->data, content_offset) == 0) {
+ buffer->data, content_offset,
+ header_size) == 0) {
return 0;
}
break;