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

Simon Glass sjg at chromium.org
Fri Nov 5 03:02:43 CET 2021


Hi Heiko,

On Thu, 4 Nov 2021 at 12:53, Heiko Thiery <heiko.thiery at gmail.com> wrote:
>
> 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(-)

Somehow we need to record that it failed, at least.

>
> 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
>

Regards,
SImon


More information about the U-Boot mailing list