Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11327
-gerrit
commit f6ffc297d822c34eb2976d4e5cb38a199011fa21 Author: Patrick Georgi patrick@georgi-clan.de Date: Tue Aug 25 13:53:42 2015 +0200
cbfstool: cbfs_add_entry() doesn't need to know filename or type
They're passed as part of the header now.
Change-Id: I7cd6296adac1fa72e0708b89c7009552e272f656 Signed-off-by: Patrick Georgi patrick@georgi-clan.de --- util/cbfstool/cbfs_image.c | 9 +++------ util/cbfstool/cbfs_image.h | 2 +- util/cbfstool/cbfstool.c | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index 8297cf1..7066b99 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -532,24 +532,21 @@ static int cbfs_add_entry_at(struct cbfs_image *image, }
int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer, - const char *name, uint32_t type, uint32_t content_offset, + uint32_t content_offset, void *header, uint32_t header_size) { assert(image); assert(buffer); assert(buffer->data); - assert(name); - type = type; assert(!IS_TOP_ALIGNED_ADDRESS(content_offset));
+ const char *name = ((struct cbfs_file *)header)->filename; + uint32_t entry_type; uint32_t addr, addr_next; struct cbfs_file *entry, *next; uint32_t need_size;
- if (header_size == 0) - header_size = cbfs_calculate_file_header_size(name); - need_size = header_size + buffer->size; DEBUG("cbfs_add_entry('%s'@0x%x) => need_size = %u+%zu=%u\n", name, content_offset, header_size, buffer->size, need_size); diff --git a/util/cbfstool/cbfs_image.h b/util/cbfstool/cbfs_image.h index c1df911..02c4a2d 100644 --- a/util/cbfstool/cbfs_image.h +++ b/util/cbfstool/cbfs_image.h @@ -93,7 +93,7 @@ int cbfs_export_entry(struct cbfs_image *image, const char *entry_name, * Never pass this function a top-aligned address: convert it to an offset. * Returns 0 on success, otherwise non-zero. */ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer, - const char *name, uint32_t type, uint32_t content_offset, + uint32_t content_offset, void *header, uint32_t header_size);
/* Removes an entry from CBFS image. Returns 0 on success, otherwise non-zero. */ diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index abb812a..465580c 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -155,7 +155,7 @@ static int cbfs_add_integer_component(const char *name, header = cbfs_create_file_header(CBFS_COMPONENT_RAW, buffer.size, name); uint32_t header_size = cbfs_calculate_file_header_size(name); - if (cbfs_add_entry(&image, &buffer, name, CBFS_COMPONENT_RAW, + if (cbfs_add_entry(&image, &buffer, offset, header, header_size) != 0) { ERROR("Failed to add %llu into ROM image as '%s'.\n", (long long unsigned)u64val, name); @@ -221,7 +221,7 @@ static int cbfs_add_component(const char *filename, offset = convert_to_from_top_aligned(param.image_region, -offset);
- if (cbfs_add_entry(&image, &buffer, name, type, offset, + if (cbfs_add_entry(&image, &buffer, offset, header, header_size) != 0) { ERROR("Failed to add '%s' into ROM image.\n", filename);