[PATCH v2 14/25] binman: Allow mkimage to use a non-zero fake-blob size

Alper Nebi Yasak alpernebiyasak at gmail.com
Thu Mar 3 22:09:52 CET 2022


On 24/02/2022 02:00, Simon Glass wrote:
> Unfortunately mkimage gets upset with zero-sized files. Update the
> ObtainContents() method to support specifying the size, if a fake blob is
> created.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
> Changes in v2:
> - Add a patch to allow mkimage to use a non-zero fake-blob size
> 
>  tools/binman/entry.py                     | 11 ++++++++---
>  tools/binman/etype/_testing.py            |  2 +-
>  tools/binman/etype/blob.py                |  5 +++--
>  tools/binman/etype/mkimage.py             | 13 ++++++++++++-
>  tools/binman/etype/section.py             |  2 +-
>  tools/binman/ftest.py                     | 10 ++++++++++
>  tools/binman/test/229_mkimage_missing.dts | 18 ++++++++++++++++++
>  7 files changed, 53 insertions(+), 8 deletions(-)
>  create mode 100644 tools/binman/test/229_mkimage_missing.dts

I don't exactly like this, but can't think of a nice alternative either.

Reviewed-by: Alper Nebi Yasak <alpernebiyasak at gmail.com>

> [...]
> 
> diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
> index 9f4717e4ea..5f6def2287 100644
> --- a/tools/binman/etype/mkimage.py
> +++ b/tools/binman/etype/mkimage.py
> @@ -51,8 +51,9 @@ class Entry_mkimage(Entry):
>          self.ReadEntries()
>  
>      def ObtainContents(self):
> +        # Use a non-zero size for any fake files to keep mkimage happy
>          data, input_fname, uniq = self.collect_contents_to_file(
> -            self._mkimage_entries.values(), 'mkimage')
> +            self._mkimage_entries.values(), 'mkimage', 1024)

I kind of want to say that mkimage-the-etype should be able to handle
here whatever it gets from subentries (maybe by writing a single-byte
file itself), and mkimage-the-executable should be able to handle
zero-size files, but I'm not confident in those opinions.

>          if data is None:
>              return False
>          output_fname = tools.get_output_filename('mkimage-out.%s' % uniq)
> [...]


More information about the U-Boot mailing list