summaryrefslogtreecommitdiff
path: root/util/cbfstool
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2017-10-26 17:40:41 -0700
committerPatrick Georgi <pgeorgi@google.com>2017-10-28 09:39:59 +0000
commit0c2f0c1d31ff9646713718a6cc69ed03c3b81410 (patch)
tree6e44ea8f6a271665ee0276f5d690adb0e9057c57 /util/cbfstool
parent8aba24d3e12e5e65368c7c9c4bb6a37f6e7ec3c0 (diff)
downloadcoreboot-0c2f0c1d31ff9646713718a6cc69ed03c3b81410.tar.xz
cbfstool: Print compression algorithm
This patch adds a column to the print command to show the compression algorithm used for the file. Name Offset Type Size Comp fallback/romstage 0x0 stage 56236 none ecrw 0xf2380 raw 62162 LZMA (131072 decompressed) BUG=b:66956286 BRANCH=none TEST=Run 'cbfstool image.bin print' Change-Id: I4bbb60ab467adac4ae5486ddafec86ad9682a40e Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://review.coreboot.org/22196 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util/cbfstool')
-rw-r--r--util/cbfstool/cbfs_image.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index 780ab6db84..306fc291bd 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -1460,24 +1460,26 @@ int cbfs_print_entry_info(struct cbfs_image *image, struct cbfs_file *entry,
unsigned int decompressed_size = 0;
unsigned int compression = cbfs_file_get_compression_info(entry,
&decompressed_size);
+ const char *compression_name = lookup_name_by_type(
+ types_cbfs_compression, compression, "????");
- if (compression == CBFS_COMPRESS_NONE) {
- fprintf(fp, "%-30s 0x%-8x %-12s %d\n",
+ if (compression == CBFS_COMPRESS_NONE)
+ fprintf(fp, "%-30s 0x%-8x %-12s %8d %-4s\n",
*name ? name : "(empty)",
cbfs_get_entry_addr(image, entry),
get_cbfs_entry_type_name(ntohl(entry->type)),
- ntohl(entry->len));
- } else {
- fprintf(fp, "%-30s 0x%-8x %-12s %d (%d after %s decompression)\n",
+ ntohl(entry->len),
+ compression_name
+ );
+ else
+ fprintf(fp, "%-30s 0x%-8x %-12s %8d %-4s (%d decompressed)\n",
*name ? name : "(empty)",
cbfs_get_entry_addr(image, entry),
get_cbfs_entry_type_name(ntohl(entry->type)),
ntohl(entry->len),
- decompressed_size,
- lookup_name_by_type(types_cbfs_compression,
- compression, "(unknown)")
+ compression_name,
+ decompressed_size
);
- }
struct cbfs_file_attr_hash *hash = NULL;
while ((hash = cbfs_file_get_next_hash(entry, hash)) != NULL) {
@@ -1579,7 +1581,7 @@ int cbfs_print_directory(struct cbfs_image *image)
{
if (cbfs_is_legacy_cbfs(image))
cbfs_print_header_info(image);
- printf("%-30s %-10s %-12s Size\n", "Name", "Offset", "Type");
+ printf("%-30s %-10s %-12s Size Comp\n", "Name", "Offset", "Type");
cbfs_walk(image, cbfs_print_entry_info, NULL);
return 0;
}