summaryrefslogtreecommitdiff
path: root/tools/binman/btool/mkimage.py
diff options
context:
space:
mode:
authorAlexander Kochetkov <al.kochet@gmail.com>2024-09-16 11:24:46 +0300
committerSimon Glass <sjg@chromium.org>2024-10-18 14:10:22 -0600
commit133c000ca334743fda3a4d77f7638da1a807e40e (patch)
tree421e5612771978ab87616823a47eae57b6c3a8b0 /tools/binman/btool/mkimage.py
parent9e81f13dbb41843abb25e6c4b20961f092630f13 (diff)
binman: implement signing FIT images during image build
The patch implement new property 'fit,sign' that can be declared at the top-level 'fit' node. If that option is declared, fit tryies to detect private keys directory among binman include directories. That directory than passed to mkimage using '-k' flag and that enable signing of FIT. Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Renumbered files, moved new tests to end: Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/btool/mkimage.py')
-rw-r--r--tools/binman/btool/mkimage.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/binman/btool/mkimage.py b/tools/binman/btool/mkimage.py
index 39a4c8c1432..78d3301bc10 100644
--- a/tools/binman/btool/mkimage.py
+++ b/tools/binman/btool/mkimage.py
@@ -22,7 +22,7 @@ class Bintoolmkimage(bintool.Bintool):
# pylint: disable=R0913
def run(self, reset_timestamp=False, output_fname=None, external=False,
- pad=None, align=None):
+ pad=None, align=None, priv_keys_dir=None):
"""Run mkimage
Args:
@@ -34,6 +34,7 @@ class Bintoolmkimage(bintool.Bintool):
other things to be easily added later, if required, such as
signatures
align: Bytes to use for alignment of the FIT and its external data
+ priv_keys_dir: Path to directory containing private keys
version: True to get the mkimage version
"""
args = []
@@ -45,6 +46,8 @@ class Bintoolmkimage(bintool.Bintool):
args += ['-B', f'{align:x}']
if reset_timestamp:
args.append('-t')
+ if priv_keys_dir:
+ args += ['-k', f'{priv_keys_dir}']
if output_fname:
args += ['-F', output_fname]
return self.run_cmd(*args)