[PATCH v3 10/13] binman: Add lzop bintool

Stefan Herbrechtsmeier stefan.herbrechtsmeier-oss at weidmueller.com
Tue Aug 16 08:41:48 CEST 2022


From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>

Add lzop bintool to binman to support on-the-fly compression.

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

---

Changes in v3:
- Rebase

Changes in v2:
- Added

 tools/binman/btool/lzop.py | 30 ++++++++++++++++++++++++++++++
 tools/binman/comp_util.py  |  6 ++++--
 2 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 tools/binman/btool/lzop.py

diff --git a/tools/binman/btool/lzop.py b/tools/binman/btool/lzop.py
new file mode 100644
index 0000000000..f6903b4db7
--- /dev/null
+++ b/tools/binman/btool/lzop.py
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Weidmüller Interface GmbH & Co. KG
+# Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>
+#
+"""Bintool implementation for lzop
+
+lzop allows compression and decompression of files.
+
+Documentation is available via::
+
+   man lzop
+"""
+
+from binman import bintool
+
+# pylint: disable=C0103
+class Bintoollzop(bintool.BintoolPacker):
+    """Compression/decompression using the lzop algorithm
+
+    This bintool supports running `lzop` to compress and decompress data, as
+    used by binman.
+
+    It is also possible to fetch the tool, which uses `apt` to install it.
+
+    Documentation is available via::
+
+        man lzop
+    """
+    def __init__(self, name):
+        super().__init__(name, 'lzo', compress_args=[])
diff --git a/tools/binman/comp_util.py b/tools/binman/comp_util.py
index 19627e490c..d8fdd5c7a2 100644
--- a/tools/binman/comp_util.py
+++ b/tools/binman/comp_util.py
@@ -11,6 +11,7 @@ This supports the following compression algorithm:
   gzip
   lz4
   lzma
+  lzo
 
 Note that for lzma this uses an old version of the algorithm, not that
 provided by xz.
@@ -20,6 +21,7 @@ This requires the following tools:
   gzip
   lz4
   lzma_alone
+  lzop
 
 It also requires an output directory to be previously set up, by calling
 PrepareOutputDir().
@@ -31,7 +33,7 @@ from binman import bintool
 from patman import tools
 
 # Supported compression algorithms
-ALGORITHMS = ['bzip2', 'gzip', 'lz4', 'lzma']
+ALGORITHMS = ['bzip2', 'gzip', 'lz4', 'lzma', 'lzo']
 
 bintools = {}
 
@@ -44,7 +46,7 @@ def _get_tool_name(algo):
     Returns:
         str: Tool name
     """
-    names = {'lzma': 'lzma_alone'}
+    names = {'lzma': 'lzma_alone', 'lzo': 'lzop'}
     return names.get(algo, algo)
 
 def _get_tool(algo):
-- 
2.30.2



More information about the U-Boot mailing list