[PATCH 3/4] binman: Add subnodes to the nodes generated by split-elf

Simon Glass sjg at chromium.org
Wed Jan 18 20:42:22 CET 2023


Hi Jonas,

On Tue, 17 Jan 2023 at 15:55, Jonas Karlman <jonas at kwiboo.se> wrote:
>
> Add hash and signature nodes to generated nodes by split-elf operation.
>
> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
> ---
>  tools/binman/etype/fit.py | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
> index deec27bee3..fb27c8877e 100644
> --- a/tools/binman/etype/fit.py
> +++ b/tools/binman/etype/fit.py
> @@ -548,12 +548,13 @@ class Entry_fit(Entry_section):
>                      else:
>                          self.Raise("Generator node requires 'fit,fdt-list' property")
>
> -        def _gen_split_elf(base_node, node, segments, entry_addr):
> +        def _gen_split_elf(base_node, node, depth, segments, entry_addr):
>              """Add nodes for the ELF file, one per group of contiguous segments
>
>              Args:
>                  base_node (Node): Template node from the binman definition
>                  node (Node): Node to replace (in the FIT being built)
> +                depth: Current node depth (0 is the base 'fit' node)
>                  segments (list): list of segments, each:
>                      int: Segment number (0 = first)
>                      int: Start address of segment in memory
> @@ -578,6 +579,10 @@ class Entry_fit(Entry_section):
>                              self._raise_subnode(
>                                  node, f"Unknown directive '{pname}'")
>
> +                    for subnode in node.subnodes:
> +                        with fsw.add_node(subnode.name):
> +                            _add_node(node, depth + 1, subnode)
> +
>          def _gen_node(base_node, node, depth, in_images, entry):
>              """Generate nodes from a template
>
> @@ -631,7 +636,7 @@ class Entry_fit(Entry_section):
>                              self._raise_subnode(
>                                  node, f'Failed to read ELF file: {str(exc)}')
>
> -                    _gen_split_elf(base_node, node, segments, entry_addr)
> +                    _gen_split_elf(base_node, node, depth, segments, entry_addr)
>
>          def _add_node(base_node, depth, node):
>              """Add nodes to the output FIT
> --
> 2.39.0
>

Please can you also update the docs at the top of the file to indicate
what happened (and regen entries.rst).

Also, can you update an existing test to check that at least one
subnode is created? Perhaps testFitSplitElf() ?

Regards,
Simon


More information about the U-Boot mailing list