diff options
author | Patrick Georgi <pgeorgi@google.com> | 2015-11-20 23:23:44 +0100 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2016-01-06 01:12:30 +0100 |
commit | 29a04d9ed16a854f3b3a8f98476c91230ce2ba2e (patch) | |
tree | de1fe87a4b2675526f87990c83a03db14511498f /util/cbfstool | |
parent | bd0bb23838e4718f42d74b303571d0a3f73555a4 (diff) | |
download | coreboot-29a04d9ed16a854f3b3a8f98476c91230ce2ba2e.tar.xz |
cbfstool: keep cbfs master header pointer
Adding new files overwrote the header with the empty file (ie 0xff),
so carve out some space.
BUG=chromium:445938
BRANCH=none
TEST=none
Change-Id: I91c292df381c2bac41c6cb9dda74dae99defd81d
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/12789
Tested-by: build bot (Jenkins)
Diffstat (limited to 'util/cbfstool')
-rw-r--r-- | util/cbfstool/cbfs_image.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index 3820c403de..2d7a6f0367 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -523,6 +523,11 @@ static int cbfs_add_entry_at(struct cbfs_image *image, } len = addr_next - addr - min_entry_size; + /* keep space for master header pointer */ + if ((void *)entry + min_entry_size + len > buffer_get(&image->buffer) + + buffer_size(&image->buffer) - sizeof(int32_t)) { + len -= sizeof(int32_t); + } cbfs_create_empty_entry(entry, CBFS_COMPONENT_NULL, len, ""); if (verbose > 1) cbfs_print_entry_info(image, entry, stderr); return 0; |