binman: Remove obsolete compressed data header handling

Remove the obsolete compressed data header handling from the utilities
to compress and decompress data. The header is uncommon, not supported
by U-Boot and incompatible with external compressed artifacts.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Stefan Herbrechtsmeier
2022-08-19 16:25:27 +02:00
committed by Simon Glass
parent 9f74395ee5
commit 4f463e3dee
4 changed files with 15 additions and 24 deletions

View File

@@ -3,7 +3,6 @@
#
"""Utilities to compress and decompress data"""
import struct
import tempfile
from binman import bintool
@@ -16,7 +15,7 @@ LZMA_ALONE = bintool.Bintool.create('lzma_alone')
HAVE_LZMA_ALONE = LZMA_ALONE.is_present()
def compress(indata, algo, with_header=True):
def compress(indata, algo):
"""Compress some data using a given algorithm
Note that for lzma this uses an old version of the algorithm, not that
@@ -41,12 +40,9 @@ def compress(indata, algo, with_header=True):
data = LZMA_ALONE.compress(indata)
else:
raise ValueError("Unknown algorithm '%s'" % algo)
if with_header:
hdr = struct.pack('<I', len(data))
data = hdr + data
return data
def decompress(indata, algo, with_header=True):
def decompress(indata, algo):
"""Decompress some data using a given algorithm
Note that for lzma this uses an old version of the algorithm, not that
@@ -64,9 +60,6 @@ def decompress(indata, algo, with_header=True):
"""
if algo == 'none':
return indata
if with_header:
data_len = struct.unpack('<I', indata[:4])[0]
indata = indata[4:4 + data_len]
if algo == 'lz4':
data = LZ4.decompress(indata)
elif algo == 'lzma':