summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2018-07-18 13:23:52 +0800
committerJulius Werner <jwerner@chromium.org>2018-07-24 20:42:37 +0000
commit72d77a9a0c1030c872f0245ae7ed6e74b54abac0 (patch)
tree17aadeb6293b76c18b7b76ce2617d826bfbe3c4d
parent770b0346ff9428f13fda5fe8d42b718b0074f060 (diff)
downloadcoreboot-72d77a9a0c1030c872f0245ae7ed6e74b54abac0.tar.xz
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=https://ticket.coreboot.org/issues/170 TEST=cbfstool tianocore.cbfs extract -m x86 -n payload -f /tmp/payload -v -v Change-Id: I8c5c40205d648799ea577ad0c5bee6ec2dd7d05f Signed-off-by: kitching@google.com Reviewed-on: https://review.coreboot.org/27520 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--util/cbfstool/cbfs_image.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index e5334831fd..4b6bda929a 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -925,14 +925,6 @@ static int cbfs_payload_decompress(struct cbfs_payload_segment *segments,
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 @@ static int cbfs_payload_decompress(struct cbfs_payload_segment *segments,
continue;
}
+ /* The payload uses an unknown compression algorithm. */
+ decompress = decompression_function(segments[i].compression);
+ if (decompress == NULL) {
+ ERROR("Unknown decompression algorithm: %u\n",
+ segments[i].compression);
+ return -1;
+ }
+
if (buffer_create(&tbuff, segments[i].mem_len, "segment")) {
buffer_delete(&new_buffer);
return -1;