From 7fd14184fb7cf2a4a713d47b8028155f77a090fc Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Tue, 11 Aug 2015 15:55:16 +0200 Subject: 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 Reviewed-on: http://review.coreboot.org/11217 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- util/cbfstool/cbfs_image.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'util') 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; -- cgit v1.2.3