summaryrefslogtreecommitdiff
path: root/util/cbfstool
diff options
context:
space:
mode:
Diffstat (limited to 'util/cbfstool')
-rw-r--r--util/cbfstool/cbfstool.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index bf51956578..8672362cfb 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -116,7 +116,7 @@ static unsigned convert_to_from_top_aligned(const struct buffer *region,
}
typedef int (*convert_buffer_t)(struct buffer *buffer, uint32_t *offset,
- uint32_t *header_size);
+ struct cbfs_file *header);
static int cbfs_add_integer_component(const char *name,
uint64_t u64val,
@@ -204,7 +204,7 @@ static int cbfs_add_component(const char *filename,
uint32_t header_size = cbfs_calculate_file_header_size(name);
- if (convert && convert(&buffer, &offset, &header_size) != 0) {
+ if (convert && convert(&buffer, &offset, NULL) != 0) {
ERROR("Failed to parse file '%s'.\n", filename);
buffer_delete(&buffer);
return 1;
@@ -226,7 +226,7 @@ static int cbfs_add_component(const char *filename,
}
static int cbfstool_convert_mkstage(struct buffer *buffer, uint32_t *offset,
- unused uint32_t *header_size)
+ struct cbfs_file *header)
{
struct buffer output;
int ret;
@@ -237,11 +237,13 @@ static int cbfstool_convert_mkstage(struct buffer *buffer, uint32_t *offset,
buffer_delete(buffer);
// direct assign, no dupe.
memcpy(buffer, &output, sizeof(*buffer));
+ if (header)
+ header->len = htonl(output.size);
return 0;
}
static int cbfstool_convert_mkpayload(struct buffer *buffer,
- unused uint32_t *offset, unused uint32_t *header_size)
+ unused uint32_t *offset, struct cbfs_file *header)
{
struct buffer output;
int ret;
@@ -267,11 +269,13 @@ static int cbfstool_convert_mkpayload(struct buffer *buffer,
buffer_delete(buffer);
// direct assign, no dupe.
memcpy(buffer, &output, sizeof(*buffer));
+ if (header)
+ header->len = htonl(output.size);
return 0;
}
static int cbfstool_convert_mkflatpayload(struct buffer *buffer,
- unused uint32_t *offset, unused uint32_t *header_size)
+ unused uint32_t *offset, struct cbfs_file *header)
{
struct buffer output;
if (parse_flat_binary_to_payload(buffer, &output,
@@ -283,6 +287,8 @@ static int cbfstool_convert_mkflatpayload(struct buffer *buffer,
buffer_delete(buffer);
// direct assign, no dupe.
memcpy(buffer, &output, sizeof(*buffer));
+ if (header)
+ header->len = htonl(output.size);
return 0;
}