diff options
Diffstat (limited to 'util/cbfstool')
-rw-r--r-- | util/cbfstool/cbfs_image.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index 740a3b2a1e..e9353570cb 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -743,6 +743,8 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer, uint32_t entry_type; uint32_t addr, addr_next; + uint32_t entry_size; + uint32_t max_null_entry_size = 0; struct cbfs_file *entry, *next; uint32_t need_size; uint32_t header_size = be32toh(header->offset); @@ -766,9 +768,11 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer, addr = cbfs_get_entry_addr(image, entry); next = cbfs_find_next_entry(image, entry); addr_next = cbfs_get_entry_addr(image, next); + entry_size = addr_next - addr; + max_null_entry_size = MAX(max_null_entry_size, entry_size); DEBUG("cbfs_add_entry: space at 0x%x+0x%x(%d) bytes\n", - addr, addr_next - addr, addr_next - addr); + addr, entry_size, entry_size); /* Will the file fit? Don't yet worry if we have space for a new * "empty" entry. We take care of that later. @@ -803,7 +807,7 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer, } DEBUG("section 0x%x+0x%x for content_offset 0x%x.\n", - addr, addr_next - addr, content_offset); + addr, entry_size, content_offset); if (cbfs_add_entry_at(image, entry, buffer->data, content_offset, header, len_align) == 0) { @@ -812,8 +816,10 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer, break; } - ERROR("Could not add [%s, %zd bytes (%zd KB)@0x%x]; too big?\n", - buffer->name, buffer->size, buffer->size / 1024, content_offset); + ERROR("Could not add %s [header %d + content %zd bytes (%zd KB)] @0x%x; " + "Largest empty slot: %d bytes\n", + buffer->name, header_size, buffer->size, buffer->size / 1024, content_offset, + max_null_entry_size); return -1; } |