blob: 30e78bdbbd9d5f94bd58e29864a99729d389bd72 [file] [log] [blame]
Marek Vasut96e614e2024-05-21 12:48:23 +02001# SPDX-License-Identifier: GPL-2.0+
2# Copyright 2024 Marek Vasut <marex@denx.de>
3#
4"""Bintool implementation for cst"""
5
6import re
7
8from binman import bintool
9
10class Bintoolcst(bintool.Bintool):
11 """Image generation for U-Boot
12
13 This bintool supports running `cst` with some basic parameters as
14 needed by binman.
15 """
16 def __init__(self, name):
17 super().__init__(name, 'Sign NXP i.MX image')
18
19 # pylint: disable=R0913
20 def run(self, output_fname=None):
21 """Run cst
22
23 Args:
24 output_fname: Output filename to write to
25 """
26 args = []
27 if output_fname:
28 args += ['-o', output_fname]
29 return self.run_cmd(*args)
30
31 def fetch(self, method):
32 """Fetch handler for cst
33
34 This installs cst using the apt utility.
35
36 Args:
37 method (FETCH_...): Method to use
38
39 Returns:
40 True if the file was fetched and now installed, None if a method
41 other than FETCH_BIN was requested
42
43 Raises:
44 Valuerror: Fetching could not be completed
45 """
46 if method != bintool.FETCH_BIN:
47 return None
48 return self.apt_install('imx-code-signing-tool')