aboutsummaryrefslogtreecommitdiff
path: root/util/cbfstool/cbfs.h
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2015-07-09 15:07:45 -0700
committerPatrick Georgi <pgeorgi@google.com>2015-09-01 14:51:19 +0000
commit8984a637c121d06a408a5f2b3b9d5233a7aa0e6e (patch)
treef10700775087674ea26a04136a725369a4b7bbf5 /util/cbfstool/cbfs.h
parent2c61506630b8e76bed93b3a5ac0ab2089376f548 (diff)
cbfstool: allow compression at file header level
Currently, compression is only allowed at subheader level (e.g. cbfs_stage, cbfs_payload_segment). This change adds compression field to each file's header so that any cbfs file can be compressed. With the necessary additions in coreboot and libpayload, the following sample code can load a compressed file: const char *name = "foo.bmp"; struct cbfs_file *file = cbfs_get_file(media, name); void *dst = malloc(ntohl(file->uncompressed_size)); dst = cbfs_get_file_content(media, name, type, file, dst); cbfs_stage and cbfs_payload_segment continue to support compression at subheader level because stages and payloads have to be decompressed to the load address, which is stored in the subheader. For these, file level compression should be turned off. Change-Id: I9a00ec99dfc68ffb2771bb4a3cc5ba6ba8a326f4 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: http://review.coreboot.org/10935 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util/cbfstool/cbfs.h')
-rw-r--r--util/cbfstool/cbfs.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/util/cbfstool/cbfs.h b/util/cbfstool/cbfs.h
index 185bddebf6..44e3dcde6d 100644
--- a/util/cbfstool/cbfs.h
+++ b/util/cbfstool/cbfs.h
@@ -104,6 +104,15 @@ struct cbfs_file_attribute {
* 0xff. Support both. */
#define CBFS_FILE_ATTR_TAG_UNUSED 0
#define CBFS_FILE_ATTR_TAG_UNUSED2 0xffffffff
+#define CBFS_FILE_ATTR_TAG_COMPRESSION 0x42435a4c
+
+struct cbfs_file_attr_compression {
+ uint32_t tag;
+ uint32_t len;
+ /* whole file compression format. 0 if no compression. */
+ uint32_t compression;
+ uint32_t decompressed_size;
+} __PACKED;
struct cbfs_stage {
uint32_t compression;