[RFC 2/2] binman: catch RunException for mkimage runtime failure

Heiko Thiery heiko.thiery at gmail.com
Thu Nov 4 19:52:34 CET 2021


In case mkimage exits with a return code other than zero do not stop.
Print an error message and go on.

Signed-off-by: Heiko Thiery <heiko.thiery at gmail.com>
---
 tools/binman/etype/mkimage.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index e49977522e..24fbe79172 100644
--- a/tools/binman/etype/mkimage.py
+++ b/tools/binman/etype/mkimage.py
@@ -10,6 +10,7 @@ from collections import OrderedDict
 from binman.entry import Entry
 from dtoc import fdt_util
 from patman import tools
+from patman import tout
 
 class Entry_mkimage(Entry):
     """Binary produced by mkimage
@@ -51,7 +52,12 @@ class Entry_mkimage(Entry):
         input_fname = tools.GetOutputFilename('mkimage.%s' % uniq)
         tools.WriteFile(input_fname, data)
         output_fname = tools.GetOutputFilename('mkimage-out.%s' % uniq)
-        tools.Run('mkimage', '-d', input_fname, *self._args, output_fname)
+
+        try:
+            tools.Run('mkimage', '-d', input_fname, *self._args, output_fname)
+        except Exception as e:
+            tout.Error("mkimage failed: %s" % e)
+
         self.SetContents(tools.ReadFile(output_fname))
         return True
 
-- 
2.30.2



More information about the U-Boot mailing list