cbfstool: allow compression at file header level

Hardware / Coreboot - Daisuke Nojiri [chromium.org] - 1 September 2015 09:51 UTC

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

8984a63 cbfstool: allow compression at file header level
util/cbfstool/cbfs.h | 9 +++++++++
util/cbfstool/cbfstool.c | 40 +++++++++++++++++++++++++++++++++++++---
2 files changed, 46 insertions(+), 3 deletions(-)

Upstream: review.coreboot.org


  • Share