[coreboot-gerrit] New patch to review for coreboot: cbfstool: support compressed files in cbfstool print
Patrick Georgi (pgeorgi@google.com)
gerrit at coreboot.org
Wed Aug 26 14:24:47 CEST 2015
Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11359
-gerrit
commit 4126f76cf66bf2ebaca32919ed9dda306c66c01b
Author: Patrick Georgi <patrick at georgi-clan.de>
Date: Wed Aug 26 12:13:03 2015 +0200
cbfstool: support compressed files in cbfstool print
Display compressed and decompressed sizes, as well as the compression
algorithm used, when a compressed file is encountered.
Change-Id: I13c2332702c4a5bec379e1ebda72753e06f8e135
Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
util/cbfstool/cbfs_image.c | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index 0bba33f..d701a69 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -773,11 +773,36 @@ int cbfs_print_entry_info(struct cbfs_image *image, struct cbfs_file *entry,
if (!fp)
fp = stdout;
- fprintf(fp, "%-30s 0x%-8x %-12s %d\n",
- *name ? name : "(empty)",
- cbfs_get_entry_addr(image, entry),
- get_cbfs_entry_type_name(ntohl(entry->type)),
- ntohl(entry->len));
+ unsigned int compression = ntohl(CBFS_COMPRESS_NONE);
+ unsigned int decompressed_size = 0;
+ for (struct cbfs_file_attribute *attr = CBFS_FILE_FIRST_ATTR(entry);
+ attr != NULL;
+ attr = CBFS_FILE_NEXT_ATTR(entry, attr)) {
+ if (attr->tag == CBFS_FILE_ATTR_COMPRESSION) {
+ struct cbfs_file_attr_compression *ac =
+ (struct cbfs_file_attr_compression *)attr;
+ compression = ntohl(ac->compression);
+ decompressed_size = ntohl(ac->decompressed_size);
+ }
+ }
+
+ if (compression == CBFS_COMPRESS_NONE) {
+ fprintf(fp, "%-30s 0x%-8x %-12s %d\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",
+ *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)")
+ );
+ }
if (!verbose)
return 0;
More information about the coreboot-gerrit
mailing list