<p>Daisuke Nojiri has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/22196">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cbfstool: Print compression algorithm<br><br>This patch adds a column to the print command to show the compression<br>algorithm used for the file.<br><br>Name                           Offset     Type           Size   Comp<br>fallback/romstage              0x0        stage           56236 none<br>ecrw                           0xf2380    raw             62162 LZMA (131072 decompressed)<br><br>BUG=b:66956286<br>BRANCH=none<br>TEST=Run 'cbfstool image.bin print'<br><br>Change-Id: I4bbb60ab467adac4ae5486ddafec86ad9682a40e<br>Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org><br>---<br>M util/cbfstool/cbfs_image.c<br>1 file changed, 15 insertions(+), 13 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/96/22196/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c<br>index 780ab6d..306fc29 100644<br>--- a/util/cbfstool/cbfs_image.c<br>+++ b/util/cbfstool/cbfs_image.c<br>@@ -1460,24 +1460,26 @@<br>    unsigned int decompressed_size = 0;<br>   unsigned int compression = cbfs_file_get_compression_info(entry,<br>              &decompressed_size);<br>+     const char *compression_name = lookup_name_by_type(<br>+                  types_cbfs_compression, compression, "????");<br> <br>-   if (compression == CBFS_COMPRESS_NONE) {<br>-             fprintf(fp, "%-30s 0x%-8x %-12s %d\n",<br>-                     *name ? name : "(empty)",<br>-                  cbfs_get_entry_addr(image, entry),<br>-                   get_cbfs_entry_type_name(ntohl(entry->type)),<br>-                     ntohl(entry->len));<br>-       } else {<br>-             fprintf(fp, "%-30s 0x%-8x %-12s %d (%d after %s decompression)\n",<br>+ if (compression == CBFS_COMPRESS_NONE)<br>+               fprintf(fp, "%-30s 0x%-8x %-12s %8d %-4s\n",<br>                        *name ? name : "(empty)",<br>                   cbfs_get_entry_addr(image, entry),<br>                    get_cbfs_entry_type_name(ntohl(entry->type)),<br>                      ntohl(entry->len),<br>-                        decompressed_size,<br>-                   lookup_name_by_type(types_cbfs_compression,<br>-                          compression, "(unknown)")<br>+                  compression_name<br>                      );<br>-   }<br>+    else<br>+         fprintf(fp, "%-30s 0x%-8x %-12s %8d %-4s (%d decompressed)\n",<br>+                     *name ? name : "(empty)",<br>+                  cbfs_get_entry_addr(image, entry),<br>+                   get_cbfs_entry_type_name(ntohl(entry->type)),<br>+                     ntohl(entry->len),<br>+                        compression_name,<br>+                    decompressed_size<br>+                    );<br> <br>         struct cbfs_file_attr_hash *hash = NULL;<br>      while ((hash = cbfs_file_get_next_hash(entry, hash)) != NULL) {<br>@@ -1579,7 +1581,7 @@<br> {<br>    if (cbfs_is_legacy_cbfs(image))<br>               cbfs_print_header_info(image);<br>-       printf("%-30s %-10s %-12s Size\n", "Name", "Offset", "Type");<br>+        printf("%-30s %-10s %-12s   Size   Comp\n", "Name", "Offset", "Type");<br>        cbfs_walk(image, cbfs_print_entry_info, NULL);<br>        return 0;<br> }<br></pre><p>To view, visit <a href="https://review.coreboot.org/22196">change 22196</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/22196"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I4bbb60ab467adac4ae5486ddafec86ad9682a40e </div>
<div style="display:none"> Gerrit-Change-Number: 22196 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Daisuke Nojiri <dnojiri@chromium.org> </div>