summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2015-08-11 15:10:33 +0200
committerPatrick Georgi <pgeorgi@google.com>2015-08-13 16:08:45 +0200
commit4110abca7213b926b6fa08e6b0f6f613ebb7c264 (patch)
tree7c7836f82be2c1e60e6ad880008c6ad8ad4bd930 /util
parent11ee08f1f1505eca3589abefbf9484083cd05a19 (diff)
cbfstool: calculate header size in cbfs_add_component()
It will at some point create the header, and pass it with its size. We can start with the size already. Change-Id: I8f26b2335ffab99a664d1ff7bc88e33ed62cf9ca Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: http://review.coreboot.org/11215 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/cbfstool/cbfstool.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 80e3895036..57db97c6e3 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -201,6 +201,8 @@ static int cbfs_add_component(const char *filename,
return 1;
}
+ uint32_t header_size = cbfs_calculate_file_header_size(name);
+
if (convert && convert(&buffer, &offset) != 0) {
ERROR("Failed to parse file '%s'.\n", filename);
buffer_delete(&buffer);
@@ -211,7 +213,8 @@ 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, 0) != 0) {
+ if (cbfs_add_entry(&image, &buffer, name, type, offset, header_size)
+ != 0) {
ERROR("Failed to add '%s' into ROM image.\n", filename);
buffer_delete(&buffer);
return 1;