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>
This commit is contained in:
Patrick Georgi 2015-08-11 15:10:33 +02:00
parent 11ee08f1f1
commit 4110abca72
1 changed files with 4 additions and 1 deletions

View File

@ -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;