Joel Kitching has uploaded this change for review. ( https://review.coreboot.org/27520
Change subject: cbfstool/extract: ignore compression field for some payload segments ......................................................................
cbfstool/extract: ignore compression field for some payload segments
When extracting a payload from CBFS, ignore compression fields for these types of payload segments: - PAYLOAD_SEGMENT_ENTRY - PAYLOAD_SEGMENT_BSS - PAYLOAD_SEGMENT_PARAMS
These types of payload segments cannot be compressed, and in certain cases are being erroneously labeled as compressed, causing errors when extracting the payload.
For an example of this problem, see creation of PAYLOAD_SEGMENT_ENTRY segments in cbfs-mkpayload.c, where the only field that is written to is |load_addr|.
Also, add a linebreak to an ERROR line.
BUG=b:111576981 TEST=cbfstool tianocore.cbfs extract -m x86 -n payload -f /tmp/payload -v -v
Change-Id: I8c5c40205d648799ea577ad0c5bee6ec2dd7d05f Signed-off-by: kitching@google.com --- M util/cbfstool/cbfs_image.c 1 file changed, 8 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/20/27520/1
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index e533483..a0b7e7b 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -925,14 +925,6 @@ struct buffer tbuff; size_t decomp_size;
- /* The payload uses an unknown compression algorithm. */ - decompress = decompression_function(segments[i].compression); - if (decompress == NULL) { - ERROR("Unknown decompression algorithm: %u", - segments[i].compression); - return -1; - } - /* Segments BSS and ENTRY do not have binary data. */ if (segments[i].type == PAYLOAD_SEGMENT_BSS || segments[i].type == PAYLOAD_SEGMENT_ENTRY) { @@ -947,6 +939,14 @@ continue; }
+ /* The payload uses an unknown compression algorithm. */ + decompress = decompression_function(segments[i].compression); + if (decompress == NULL) { + ERROR("Unknown decompression algorithm: %u", + segments[i].compression); + return -1; + } + if (buffer_create(&tbuff, segments[i].mem_len, "segment")) { buffer_delete(&new_buffer); return -1;