Skip to contentSkip to conversation

tools: binman: fit: support engine override via argument

PATCH In review [email protected] 2 participants 4 messages May 4 – May 7

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 tools: binman: fit: support engine override via argument

From: Julian Haller <[email protected]>

Allow overriding fit,engine and fit,engine-keydir via arguments, enabling engine selection at build time without modifying the device tree.

---
 Makefile                  |  2 ++
 tools/binman/etype/fit.py | 13 +++----------
 2 files changed, 5 insertions(+), 10 deletions(-)
Makefile +2 -0
index 49d9740327e..ffcc639382b 100644
@@ -1701,6 +1701,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
 		-a vpl-dtb=$(CONFIG_VPL_OF_REAL) \
 		-a pre-load-key-path=${PRE_LOAD_KEY_PATH} \
 		-a of-spl-remove-props=$(CONFIG_OF_SPL_REMOVE_PROPS) \
+		$(if $(FIT_ENGINE),-a fit$(comma)engine=$(FIT_ENGINE)) \
+		$(if $(FIT_ENGINE_KEYDIR),-a fit$(comma)engine-keydir=$(FIT_ENGINE_KEYDIR)) \
 		$(BINMAN_$(@F))
 
 OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex
tools/binman/etype/fit.py +3 -10
index f28b1e6b4cb..4f429261ccf 100644
@@ -646,17 +646,10 @@ class Entry_fit(Entry_section):
                              OpenSSL API, as second element of the Tuple. None
                              if no keydir to pass.
         """
-        engine = None
+        engine = self.GetArg('fit,engine', str)
         engine_keydir = None
-
-        prop = self._fit_props.get('fit,engine')
-        if prop is not None:
-            engine = prop.value
-
-            prop = self._fit_props.get('fit,engine-keydir')
-            if prop is not None:
-                engine_keydir = prop.value
-
+        if engine is not None:
+            engine_keydir = self.GetArg('fit,engine-keydir', str)
         return engine, engine_keydir
 
     def BuildSectionData(self, required):
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 binman: nxp_imx8mcst: disable configparser interpolation

From: Julian Haller <[email protected]>

ConfigParser uses %-based interpolation by default, which causes PKCS#11 URIs containing percent-encoded characters (e.g. %20) to fail with "invalid interpolation syntax". Disable interpolation since the CST config format does not use this feature.

---
 tools/binman/etype/nxp_imx8mcst.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/binman/etype/nxp_imx8mcst.py +1 -1
index dd9f226b751..4fa26de51a0 100644
@@ -137,7 +137,7 @@ class Entry_nxp_imx8mcst(Entry_mkimage):
 
         # Generate CST configuration file used to sign payload
         cfg_fname = tools.get_output_filename(f'nxp.csf-config-txt.{uniq}')
-        config = configparser.ConfigParser()
+        config = configparser.ConfigParser(interpolation=None)
         # Do not make key names lowercase
         config.optionxform = str
         # Load configuration template and modify keys of interest
Signature · 1 line
2.43.0
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] binman: nxp_imx8mcst: disable configparser interpolation

Quoted 11 lines · None

binman: nxp_imx8mcst: disable configparser interpolation

ConfigParser uses %-based interpolation by default, which causes PKCS#11 URIs containing percent-encoded characters (e.g. %20) to fail with "invalid interpolation syntax". Disable interpolation since the CST config format does not use this feature.

tools/binman/etype/nxp_imx8mcst.py | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
#3 lore raw
In reply to [email protected]

Hi Julian,

Quoted 14 lines · None

tools: binman: fit: support engine override via argument

Allow overriding fit,engine and fit,engine-keydir via arguments, enabling engine selection at build time without modifying the device tree.

Makefile | 2 ++

 tools/binman/etype/fit.py | 13 +++----------
 2 files changed, 5 insertions(+), 10 deletions(-)

Makefile cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ · line 1705

Quoted 5 lines
Makefile +2 -0
@@ -1701,6 +1701,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
              -a vpl-dtb=$(CONFIG_VPL_OF_REAL) \
              -a pre-load-key-path=${PRE_LOAD_KEY_PATH} \
              -a of-spl-remove-props=$(CONFIG_OF_SPL_REMOVE_PROPS) \
+             $(if $(FIT_ENGINE),-a fit$(comma)engine=$(FIT_ENGINE)) \
+             $(if $(FIT_ENGINE_KEYDIR),-a fit$(comma)engine-keydir=$(FIT_ENGINE_KEYDIR)) \

Please mention these new make variables in the docs (e.g. doc/usage/fit/signature.rst) so users can discover them - also how about an example invocation in the commit message?

Quoted 10 lines
tools/binman/etype/fit.py +1 -3
@@ -646,17 +646,10 @@ class Entry_fit(Entry_section):
                              OpenSSL API, as second element of the Tuple. None
                              if no keydir to pass.
         """
-        engine = None
+        engine = self.GetArg('fit,engine', str)
         engine_keydir = None
-
-        prop = self._fit_props.get('fit,engine')

tools/binman/etype/fit.py class Entry_fit(Entry_section): · line 653

Quoted 10 lines
tools/binman/etype/fit.py +2 -7
-        if prop is not None:
-            engine = prop.value
-
-            prop = self._fit_props.get('fit,engine-keydir')
-            if prop is not None:
-                engine_keydir = prop.value
-
+        if engine is not None:
+            engine_keydir = self.GetArg('fit,engine-keydir', str)
         return engine, engine_keydir

The fit,engine and fit,engine-keydir blocks in the class docstring describe these only as devicetree properties, but these can also be entry args.

tools/binman/etype/fit.py class Entry_fit(Entry_section): · line 646

Quoted 3 lines
tools/binman/etype/fit.py +1 -0
@@ -646,17 +646,10 @@ class Entry_fit(Entry_section):
+        engine = self.GetArg('fit,engine', str)

Can you check 'binman test -T' and confirm that you have coverage for the new code?

Regards,
Simon