diff mbox series

binman: Include also subnodes in generator nodes

Message ID 8db7bd92-58cc-afe2-21c6-a9a65116a263@siemens.com
State Changes Requested
Delegated to: Simon Glass
Headers show
Series binman: Include also subnodes in generator nodes | expand

Commit Message

Jan Kiszka Feb. 14, 2022, 12:05 p.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

This allows to prefill fdt and config nodes with hash and signature
subnodes. It's just important to place the child nodes last so that
hashes do not come before the data - would be disliked by mkimage.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 tools/binman/etype/fit.py | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Simon Glass Feb. 16, 2022, 2:21 p.m. UTC | #1
Hi Jan,

On Mon, 14 Feb 2022 at 05:05, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> This allows to prefill fdt and config nodes with hash and signature
> subnodes. It's just important to place the child nodes last so that
> hashes do not come before the data - would be disliked by mkimage.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  tools/binman/etype/fit.py | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
> index a56b0564f9a..477d0156e48 100644
> --- a/tools/binman/etype/fit.py
> +++ b/tools/binman/etype/fit.py
> @@ -214,6 +214,10 @@ class Entry_fit(Entry_section):
>                                  if depth == 1 and in_images:
>                                      fsw.property('data',
>                                                   tools.read_file(fname))
> +
> +                                for child in subnode.subnodes:
> +                                    with fsw.add_node(child.name):
> +                                        _AddNode(subnode, depth + 1, child)

We already have subnode, and child is a bit like that. The libfdt
library tries to use subnode instead of child and binman has followed
suit.

So s/child/subsubnode/ perhaps.

>                      else:
>                          if self._fdts is None:
>                              if self._fit_list_prop:
> --
> 2.34.1

Please also add or modify a test to show/check this feature.

Regards,
Simon
diff mbox series

Patch

diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index a56b0564f9a..477d0156e48 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -214,6 +214,10 @@  class Entry_fit(Entry_section):
                                 if depth == 1 and in_images:
                                     fsw.property('data',
                                                  tools.read_file(fname))
+
+                                for child in subnode.subnodes:
+                                    with fsw.add_node(child.name):
+                                        _AddNode(subnode, depth + 1, child)
                     else:
                         if self._fdts is None:
                             if self._fit_list_prop: