summaryrefslogtreecommitdiffstats
path: root/util/cbfstool/cbfs_image.h
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2017-09-20 11:59:18 +0200
committerPatrick Georgi <pgeorgi@google.com>2017-10-10 15:16:17 +0000
commit12631a4d1d1c2e06b3a2c53b884cf6c33000b9b9 (patch)
tree2cf82ffa84db5000563c309b6a3359aa19e51d18 /util/cbfstool/cbfs_image.h
parentd6c0af6c549b9e4a6f3a6ad0e9ce6a37087c6e9a (diff)
downloadcoreboot-12631a4d1d1c2e06b3a2c53b884cf6c33000b9b9.tar.gz
coreboot-12631a4d1d1c2e06b3a2c53b884cf6c33000b9b9.tar.bz2
coreboot-12631a4d1d1c2e06b3a2c53b884cf6c33000b9b9.zip
util/cbfstool: Add "truncate" command
It does the opposite to "expand", removing a trailing empty file from CBFS. It also returns the size of the CBFS post processing on stdout. BUG=b:65853903 BRANCH=none TEST=`cbfstool test.bin truncate -r FW_MAIN_A` removes the trailing empty file in FW_MAIN_A. Without a trailing empty file, the region is left alone (tested using COREBOOT which comes with a master header pointer). Change-Id: I0c747090813898539f3428936afa9d8459adee9c Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/21608 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util/cbfstool/cbfs_image.h')
-rw-r--r--util/cbfstool/cbfs_image.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/cbfstool/cbfs_image.h b/util/cbfstool/cbfs_image.h
index 1bd74cedd141..5772b1ba1520 100644
--- a/util/cbfstool/cbfs_image.h
+++ b/util/cbfstool/cbfs_image.h
@@ -84,6 +84,11 @@ int cbfs_compact_instance(struct cbfs_image *image);
Returns 0 on success, otherwise non-zero. */
int cbfs_expand_to_region(struct buffer *region);
+/* Truncate a CBFS by removing a trailing "empty" file if it exists.
+ Returns 0 on success, otherwise non-zero and passes the CBFS' remaining
+ size in the size argument. */
+int cbfs_truncate_space(struct buffer *region, uint32_t *size);
+
/* Releases the CBFS image. Returns 0 on success, otherwise non-zero. */
int cbfs_image_delete(struct cbfs_image *image);