[PATCH 1/3] binman: Add support for an external-tpl entry

Simon Glass sjg at chromium.org
Tue Feb 7 05:02:25 CET 2023


Hi Jonas,

On Sun, 5 Feb 2023 at 13:21, Jonas Karlman <jonas at kwiboo.se> wrote:
>
> The external-tpl entry can be used when an external TPL binary must be
> used instead of normal U-Boot TPL.
>
> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
> ---
>  tools/binman/entries.rst               | 12 ++++++++++++
>  tools/binman/etype/external_tpl.py     | 18 ++++++++++++++++++
>  tools/binman/ftest.py                  |  7 +++++++
>  tools/binman/test/277_external_tpl.dts | 16 ++++++++++++++++
>  4 files changed, 53 insertions(+)
>  create mode 100644 tools/binman/etype/external_tpl.py
>  create mode 100644 tools/binman/test/277_external_tpl.dts
>
> diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
> index 7a04a613992d..95317271bb74 100644
> --- a/tools/binman/entries.rst
> +++ b/tools/binman/entries.rst
> @@ -468,6 +468,18 @@ updating the EC on startup via software sync.
>
>
>
> +.. _etype_external_tpl:
> +
> +Entry: external-tpl: External TPL binary
> +----------------------------------------
> +
> +Properties / Entry arguments:
> +    - external-tpl-path: Filename of file to read into the entry.
> +
> +This entry holds an external TPL binary.

Could you make this specific to Rockchip? I think something like
rockchip_tpl would work. We try to keep things specific to a vendor.

> +
> +
> +
>  .. _etype_fdtmap:
>
>  Entry: fdtmap: An entry which contains an FDT map
> diff --git a/tools/binman/etype/external_tpl.py b/tools/binman/etype/external_tpl.py
> new file mode 100644
> index 000000000000..50562914711e
> --- /dev/null
> +++ b/tools/binman/etype/external_tpl.py
> @@ -0,0 +1,18 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Entry-type module for external TPL binary
> +#
> +
> +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
> +
> +class Entry_external_tpl(Entry_blob_named_by_arg):
> +    """External TPL binary
> +
> +    Properties / Entry arguments:
> +        - external-tpl-path: Filename of file to read into the entry.
> +
> +    This entry holds an external TPL binary.
> +    """
> +    def __init__(self, section, etype, node):
> +        super().__init__(section, etype, node, 'external-tpl')
> +        self.external = True
> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> index 6b203dfb644f..2446122eea29 100644
> --- a/tools/binman/ftest.py
> +++ b/tools/binman/ftest.py
> @@ -90,6 +90,7 @@ TEE_OS_DATA           = b'this is some tee OS data'
>  ATF_BL2U_DATA         = b'bl2u'
>  OPENSBI_DATA          = b'opensbi'
>  SCP_DATA              = b'scp'
> +EXTERNAL_TPL_DATA     = b'external-tpl'
>  TEST_FDT1_DATA        = b'fdt1'
>  TEST_FDT2_DATA        = b'test-fdt2'
>  ENV_DATA              = b'var1=1\nvar2="2"'
> @@ -205,6 +206,7 @@ class TestFunctional(unittest.TestCase):
>          TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA)
>          TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA)
>          TestFunctional._MakeInputFile('scp.bin', SCP_DATA)
> +        TestFunctional._MakeInputFile('external-tpl.bin', EXTERNAL_TPL_DATA)

rockchip-tpl

>
>          # Add a few .dtb files for testing
>          TestFunctional._MakeInputFile('%s/test-fdt1.dtb' % TEST_FDT_SUBDIR,
> @@ -4103,6 +4105,11 @@ class TestFunctional(unittest.TestCase):
>          data = self._DoReadFile('172_scp.dts')
>          self.assertEqual(SCP_DATA, data[:len(SCP_DATA)])
>
> +    def testPackExternalTpl(self):
> +        """Test that an image with an external TPL binary can be created"""
> +        data = self._DoReadFile('277_external_tpl.dts')
> +        self.assertEqual(EXTERNAL_TPL_DATA, data[:len(EXTERNAL_TPL_DATA)])
> +
>      def testFitFdt(self):
>          """Test an image with an FIT with multiple FDT images"""
>          def _CheckFdt(seq, expected_data):
> diff --git a/tools/binman/test/277_external_tpl.dts b/tools/binman/test/277_external_tpl.dts
> new file mode 100644
> index 000000000000..99899771ea7c
> --- /dev/null
> +++ b/tools/binman/test/277_external_tpl.dts
> @@ -0,0 +1,16 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +/dts-v1/;
> +
> +/ {
> +       #address-cells = <1>;
> +       #size-cells = <1>;
> +
> +       binman {
> +               size = <16>;
> +
> +               external-tpl {
> +                       filename = "external-tpl.bin";
> +               };
> +       };
> +};
> --
> 2.39.1

Regards,
SImon


More information about the U-Boot mailing list