Maximilian Brune has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/83615?usp=email )
Change subject: util/cbfstool/cbfs-payload-linux: Do not compress bzImage ......................................................................
util/cbfstool/cbfs-payload-linux: Do not compress bzImage
Compressing the already compressed bzImage does not yield any fruit. If you are lucky it actually makes the image a little bit smaller. If you are unlucky the image actually gets bigger and since the compressing function is not checked for any erros, coreboot just builds successfully even though the payload is broken through compression.
Before this patch you could possibly get this error during compilation: ``` E: LZMA: LzmaEnc_Encode failed 9. ``` and your linux payload would end up something like this in CBFS: ``` FMAP REGION: COREBOOT Name Offset Type Size Comp .... fallback/payload 0x1c9c0 simple elf 511 none .... ```
That doesn't stop coreboot from finishing the build though, since we currently don't check for errors from the compression. That is an issue for another patch though.
Change-Id: I022982667515ce721d98af534414d9e336b5f35a Signed-off-by: Maximilian Brune maximilian.brune@9elements.com --- M util/cbfstool/cbfs-payload-linux.c 1 file changed, 11 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/83615/1
diff --git a/util/cbfstool/cbfs-payload-linux.c b/util/cbfstool/cbfs-payload-linux.c index 53d455c..6b4ed2b 100644 --- a/util/cbfstool/cbfs-payload-linux.c +++ b/util/cbfstool/cbfs-payload-linux.c @@ -139,7 +139,8 @@ }
static void bzp_output_segment(struct bzpayload *bzp, struct buffer *b, - uint32_t type, uint64_t load_addr) + uint32_t type, uint64_t load_addr, + comp_func_ptr compress_func) { struct buffer out; struct cbfs_payload_segment *seg; @@ -163,7 +164,7 @@
seg->mem_len = buffer_size(b); seg->offset = bzp->offset; - bzp->compress(buffer_get(b), buffer_size(b), buffer_get(&out), &len); + compress_func(buffer_get(b), buffer_size(b), buffer_get(&out), &len); seg->compression = bzp->algo; seg->len = len;
@@ -293,26 +294,28 @@
/* parameter block */ bzp_output_segment(&bzp, &bzp.parameters, - PAYLOAD_SEGMENT_DATA, LINUX_PARAM_LOC); + PAYLOAD_SEGMENT_DATA, LINUX_PARAM_LOC, bzp.compress);
/* code block */ + // There is no point in compressing the bzImage (it is already compressed) bzp_output_segment(&bzp, &bzp.kernel, - PAYLOAD_SEGMENT_CODE, kernel_base); + PAYLOAD_SEGMENT_CODE, kernel_base, + compression_function(CBFS_COMPRESS_NONE));
/* trampoline */ bzp_output_segment(&bzp, &bzp.trampoline, - PAYLOAD_SEGMENT_CODE, TRAMPOLINE_ENTRY_LOC); + PAYLOAD_SEGMENT_CODE, TRAMPOLINE_ENTRY_LOC, bzp.compress);
/* cmdline */ bzp_output_segment(&bzp, &bzp.cmdline, - PAYLOAD_SEGMENT_DATA, COMMAND_LINE_LOC); + PAYLOAD_SEGMENT_DATA, COMMAND_LINE_LOC, bzp.compress);
/* initrd */ bzp_output_segment(&bzp, &bzp.initrd, - PAYLOAD_SEGMENT_DATA, initrd_base); + PAYLOAD_SEGMENT_DATA, initrd_base, bzp.compress);
/* Terminating entry segment. */ - bzp_output_segment(&bzp, NULL, PAYLOAD_SEGMENT_ENTRY, TRAMPOLINE_ENTRY_LOC); + bzp_output_segment(&bzp, NULL, PAYLOAD_SEGMENT_ENTRY, TRAMPOLINE_ENTRY_LOC, bzp.compress);
/* Set size of buffer taking into account potential compression. */ buffer_set_size(&bzp.output, bzp.offset);