diff mbox series

[v6,09/21] binman: Disable compressed data header

Message ID 20220819142538.24847-10-stefan.herbrechtsmeier-oss@weidmueller.com
State Accepted
Commit 9f74395ee5482aaa7a03b48201773fb9bc08c72e
Delegated to: Simon Glass
Headers show
Series binman: Rework compression support | expand

Commit Message

Stefan Herbrechtsmeier Aug. 19, 2022, 2:25 p.m. UTC
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

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

The header was introduced as part of commit eb0f4a4cb402 ("binman:
Support replacing data in a cbfs") to allow device tree entries to be
larger than the compressed contents.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

---

(no changes since v5)

Changes in v5:
- Disable header in testInvalidCompress function

Changes in v3:
- Add commit to disable compressed data header

 tools/binman/entry.py |  4 ++--
 tools/binman/ftest.py | 12 +++++++-----
 2 files changed, 9 insertions(+), 7 deletions(-)

Comments

Simon Glass Aug. 20, 2022, 9:33 p.m. UTC | #1
On Fri, 19 Aug 2022 at 08:26, Stefan Herbrechtsmeier
<stefan.herbrechtsmeier-oss@weidmueller.com> wrote:
>
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>
> Disable the compressed data header of the utilities to compress and
> decompress data. The header is uncommon, not supported by U-Boot and
> incompatible with external compressed artifacts.
>
> The header was introduced as part of commit eb0f4a4cb402 ("binman:
> Support replacing data in a cbfs") to allow device tree entries to be
> larger than the compressed contents.
>
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>
> ---
>
> (no changes since v5)
>
> Changes in v5:
> - Disable header in testInvalidCompress function
>
> Changes in v3:
> - Add commit to disable compressed data header
>
>  tools/binman/entry.py |  4 ++--
>  tools/binman/ftest.py | 12 +++++++-----
>  2 files changed, 9 insertions(+), 7 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass Aug. 21, 2022, 12:10 a.m. UTC | #2
On Fri, 19 Aug 2022 at 08:26, Stefan Herbrechtsmeier
<stefan.herbrechtsmeier-oss@weidmueller.com> wrote:
>
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>
> Disable the compressed data header of the utilities to compress and
> decompress data. The header is uncommon, not supported by U-Boot and
> incompatible with external compressed artifacts.
>
> The header was introduced as part of commit eb0f4a4cb402 ("binman:
> Support replacing data in a cbfs") to allow device tree entries to be
> larger than the compressed contents.
>
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>
> ---
>
> (no changes since v5)
>
> Changes in v5:
> - Disable header in testInvalidCompress function
>
> Changes in v3:
> - Add commit to disable compressed data header
>
>  tools/binman/entry.py |  4 ++--
>  tools/binman/ftest.py | 12 +++++++-----
>  2 files changed, 9 insertions(+), 7 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 6d58410e91..ecce721ac6 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -1083,7 +1083,7 @@  features to produce new behaviours.
         self.uncomp_data = indata
         if self.compress != 'none':
             self.uncomp_size = len(indata)
-        data = comp_util.compress(indata, self.compress)
+        data = comp_util.compress(indata, self.compress, with_header=False)
         return data
 
     def DecompressData(self, indata):
@@ -1095,7 +1095,7 @@  features to produce new behaviours.
         Returns:
             Decompressed data
         """
-        data = comp_util.decompress(indata, self.compress)
+        data = comp_util.decompress(indata, self.compress, with_header=False)
         if self.compress != 'none':
             self.uncomp_size = len(data)
         self.uncomp_data = data
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 6e63b7c27a..edee1f3984 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1967,7 +1967,7 @@  class TestFunctional(unittest.TestCase):
             self._ResetDtbs()
 
     def _decompress(self, data):
-        return comp_util.decompress(data, 'lz4')
+        return comp_util.decompress(data, 'lz4', with_header=False)
 
     def testCompress(self):
         """Test compression of blobs"""
@@ -4427,14 +4427,16 @@  class TestFunctional(unittest.TestCase):
         rest = base[len(U_BOOT_DATA):]
 
         # Check compressed data
-        expect1 = comp_util.compress(COMPRESS_DATA + U_BOOT_DATA, 'lz4')
+        expect1 = comp_util.compress(COMPRESS_DATA + U_BOOT_DATA, 'lz4',
+                                     with_header=False)
         data1 = rest[:len(expect1)]
         section1 = self._decompress(data1)
         self.assertEquals(expect1, data1)
         self.assertEquals(COMPRESS_DATA + U_BOOT_DATA, section1)
         rest1 = rest[len(expect1):]
 
-        expect2 = comp_util.compress(COMPRESS_DATA + COMPRESS_DATA, 'lz4')
+        expect2 = comp_util.compress(COMPRESS_DATA + COMPRESS_DATA, 'lz4',
+                                     with_header=False)
         data2 = rest1[:len(expect2)]
         section2 = self._decompress(data2)
         self.assertEquals(expect2, data2)
@@ -5219,11 +5221,11 @@  fdt         fdtmap                Extract the devicetree blob from the fdtmap
 
     def testInvalidCompress(self):
         with self.assertRaises(ValueError) as e:
-            comp_util.compress(b'', 'invalid')
+            comp_util.compress(b'', 'invalid', with_header=False)
         self.assertIn("Unknown algorithm 'invalid'", str(e.exception))
 
         with self.assertRaises(ValueError) as e:
-            comp_util.decompress(b'1234', 'invalid')
+            comp_util.decompress(b'1234', 'invalid', with_header=False)
         self.assertIn("Unknown algorithm 'invalid'", str(e.exception))
 
     def testBintoolDocs(self):