[PATCH v4] binman: add support for creating dummy files for external blobs

Simon Glass sjg at chromium.org
Thu Jan 6 13:06:12 CET 2022


On Thu, 6 Jan 2022 at 03:50, Heiko Thiery <heiko.thiery at gmail.com> wrote:
>
> While converting to binman for an imx8mq board, it has been found that
> building in the u-boot CI fails. This is because an imx8mq requires an
> external binary (signed_hdmi_imx8m.bin). If this file cannot be found
> mkimage fails.
> To be able to build this board in the u-boot CI a binman option
> (--fake-ext-blobs) is introduced that can be switched on via the u-boot
> makefile option BINMAN_FAKE_EXT_BLOBS. With that the needed dummy files are
> created.
>
> Signed-off-by: Heiko Thiery <heiko.thiery at gmail.com>
> ---
> v4:
>  - removed RFC from subject
>  - fix to keep 80 cols limit
>  - change CheckFakedBlobs() in entry.py
>  - remove faked test blob when test is finished
>
> v3:
>  - add CheckFakedBlobs() and print a list of faked files at the end
>  - add unittest
>
> v2:
>  - pass allow_fake_blobs to ProcessImage()
>  - set AllowAllowFakeBlob() to images/entries
>  - create fake blob in Entry_blot.ObtainContents() when file is missing and
>    creation is allowed
>
>  still missing:
>   - unittest
>   - option to set BINMAN_FAKE_EXT_BLOBS in Makefile via environment
>         variable. With that we could simply set this env variable in the CI
>         (gitlab-ci.yml) with adding support to buildman.
>
>  Makefile                            |  1 +
>  tools/binman/cmdline.py             |  2 ++
>  tools/binman/control.py             | 26 +++++++++++++++++++-------
>  tools/binman/entry.py               | 23 +++++++++++++++++++++++
>  tools/binman/etype/blob.py          | 18 ++++++++++++++++++
>  tools/binman/etype/blob_ext.py      |  8 ++++++++
>  tools/binman/etype/mkimage.py       | 20 ++++++++++++++++++++
>  tools/binman/etype/section.py       | 20 ++++++++++++++++++++
>  tools/binman/ftest.py               | 15 ++++++++++++++-
>  tools/binman/test/203_fake_blob.dts | 14 ++++++++++++++
>  10 files changed, 139 insertions(+), 8 deletions(-)
>  create mode 100644 tools/binman/test/203_fake_blob.dts

Reviewed-by: Simon Glass <sjg at chromium.org>
[..]

> @@ -4661,6 +4664,16 @@ class TestFunctional(unittest.TestCase):
>              str(e.exception),
>              "Not enough space in '.*u_boot_binman_embed_sm' for data length.*")
>
> +    def testFakeBlob(self):
> +        """Test handling of faking an external blob"""
> +        with test_util.capture_sys_output() as (stdout, stderr):
> +            self._DoTestFile('203_fake_blob.dts', allow_missing=True,
> +                             allow_fake_blobs=True)
> +        err = stderr.getvalue()
> +        self.assertRegex(err,
> +                         "Image '.*' has faked external blobs and is non-functional: .*")

I'll just make a whitespace tweak here while applying, to reduce the
line length.

> +        os.remove('binman_faking_test_blob')
> +
>
>  if __name__ == "__main__":
>      unittest.main()

[..]

Regards,
Simon


More information about the U-Boot mailing list