summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2019-05-14 15:53:45 -0600
committerSimon Glass <[email protected]>2019-07-10 16:52:58 -0600
commitb8f0876f1eccc17a1275401ff7bc846235fd3edd (patch)
treeb1d5769698ce3d303f018b204237d38c17b30349 /tools
parenta92939a4aa65700c3cdfa230fa986d40c508c5e6 (diff)
binman: Use binary mode when compressing data
The lz4 utility inserts binary data in its output which cannot always be converted to unicode (nor should it be). Fix this by using the new binary mode for program output. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'tools')
-rw-r--r--tools/binman/etype/blob.py2
-rw-r--r--tools/binman/ftest.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index ae80bbee530..f56a1f87688 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -60,7 +60,7 @@ class Entry_blob(Entry):
except AttributeError:
data = lz4.compress(data)
'''
- data = tools.Run('lz4', '-c', self._pathname)
+ data = tools.Run('lz4', '-c', self._pathname, binary=True)
self.SetContents(data)
return True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 1111852a406..4d96933cb4d 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1557,7 +1557,7 @@ class TestFunctional(unittest.TestCase):
out = os.path.join(self._indir, 'lz4.tmp')
with open(out, 'wb') as fd:
fd.write(data)
- return tools.Run('lz4', '-dc', out)
+ return tools.Run('lz4', '-dc', out, binary=True)
'''
try:
orig = lz4.frame.decompress(data)