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>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user