summaryrefslogtreecommitdiff
path: root/tools/binman/btool/cst.py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-07-01 13:17:56 -0600
committerTom Rini <trini@konsulko.com>2024-07-01 15:00:56 -0600
commit65fbdab27224ee3943a89496b21862db83c34da2 (patch)
tree775a0a54066c2e9a6bbba201676e3d896b5cb0e2 /tools/binman/btool/cst.py
parent3f772959501c99fbe5aa0b22a36efe3478d1ae1c (diff)
parentb4cbd1a257d4027038b4f997d73bdb0a066db045 (diff)
Merge branch 'next'
Diffstat (limited to 'tools/binman/btool/cst.py')
-rw-r--r--tools/binman/btool/cst.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/binman/btool/cst.py b/tools/binman/btool/cst.py
new file mode 100644
index 00000000000..30e78bdbbd9
--- /dev/null
+++ b/tools/binman/btool/cst.py
@@ -0,0 +1,48 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2024 Marek Vasut <marex@denx.de>
+#
+"""Bintool implementation for cst"""
+
+import re
+
+from binman import bintool
+
+class Bintoolcst(bintool.Bintool):
+ """Image generation for U-Boot
+
+ This bintool supports running `cst` with some basic parameters as
+ needed by binman.
+ """
+ def __init__(self, name):
+ super().__init__(name, 'Sign NXP i.MX image')
+
+ # pylint: disable=R0913
+ def run(self, output_fname=None):
+ """Run cst
+
+ Args:
+ output_fname: Output filename to write to
+ """
+ args = []
+ if output_fname:
+ args += ['-o', output_fname]
+ return self.run_cmd(*args)
+
+ def fetch(self, method):
+ """Fetch handler for cst
+
+ This installs cst using the apt utility.
+
+ Args:
+ method (FETCH_...): Method to use
+
+ Returns:
+ True if the file was fetched and now installed, None if a method
+ other than FETCH_BIN was requested
+
+ Raises:
+ Valuerror: Fetching could not be completed
+ """
+ if method != bintool.FETCH_BIN:
+ return None
+ return self.apt_install('imx-code-signing-tool')