Yu-Ping Wu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/74317 )
Change subject: util/cbfstool: Add "Comp" column for "print -k" ......................................................................
util/cbfstool: Add "Comp" column for "print -k"
The compression type of each file will be shown in column "Comp" with "cbfstool ${IMAGE} print". However, the compression information is missing when "-k" is passed without "-v". Fix the inconsistency by always printing the compression type and decompressed size.
This change would make parsing the compression type easier. To the best of my knowledge there is no existing script parsing the compression type from the list of file attributes printed by "print -k -v", so hopefully this wouldn't break anything.
BUG=none TEST=sudo emerge coreboot-utils TEST=cbfstool image-steelix.bin print -r FW_MAIN_A TEST=cbfstool image-steelix.bin print -r FW_MAIN_A -k BRANCH=none
Change-Id: Ibe3e23c58662fb7b9c5d704de93e2df28957528d Signed-off-by: Yu-Ping Wu yupingso@chromium.org --- M util/cbfstool/cbfs_image.c 1 file changed, 33 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/17/74317/1
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index 683a96c..8ff0778 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -1529,15 +1529,14 @@ fprintf(fp, "0x%zx%s", data_size, sep); fprintf(fp, "0x%zx", metadata_size + data_size);
- if (verbose) { - unsigned int decompressed_size = 0; - unsigned int compression = cbfs_file_get_compression_info(entry, + unsigned int decompressed_size = 0; + unsigned int compression = cbfs_file_get_compression_info(entry, &decompressed_size); - if (compression != CBFS_COMPRESS_NONE) - fprintf(fp, "%scomp:%s:0x%x", sep, lookup_name_by_type( - types_cbfs_compression, compression, "????"), - decompressed_size); + const char *compression_name = lookup_name_by_type( + types_cbfs_compression, compression, "????"); + fprintf(fp, "%s%s:0x%x", sep, compression_name, decompressed_size);
+ if (verbose) { struct cbfs_file_attr_hash *attr = NULL; while ((attr = cbfs_file_get_next_hash(entry, attr)) != NULL) { size_t hash_len = vb2_digest_size(attr->hash.algo); @@ -1575,6 +1574,7 @@ "Metadata Size", "Data Size", "Total Size", + "Comp", }; const char *sep = "\t";