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

Heiko Thiery heiko.thiery at gmail.com
Fri Nov 5 08:49:59 CET 2021


Hi Simon,

Am Fr., 5. Nov. 2021 um 03:02 Uhr schrieb Simon Glass <sjg at chromium.org>:
>
> 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.

By record do you mean that it should not only be output as an error
message (as already done), but should be remembered like e.g. the
missing external blobs?

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

-- 
Heiko


More information about the U-Boot mailing list