Skip to contentSkip to conversation

binman: Include also subnodes in generator nodes

PATCH Superseded Jan Kiszka 2 participants 2 messages Feb 14, 2022 – Feb 16, 2022

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 binman: Include also subnodes in generator nodes

From: Jan Kiszka <[email protected]>

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.

---
 tools/binman/etype/fit.py | 4 ++++
 1 file changed, 4 insertions(+)
tools/binman/etype/fit.py +4 -0
index a56b0564f9a..477d0156e48 100644
@@ -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:
Signature · 1 line
2.34.1
#1 lore raw

Hi Jan,

Quoted 17 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

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.

---
 tools/binman/etype/fit.py | 4 ++++
 1 file changed, 4 insertions(+)
tools/binman/etype/fit.py +0 -0
index a56b0564f9a..477d0156e48 100644

tools/binman/etype/fit.py class Entry_fit(Entry_section): · line 220

Quoted 7 lines
tools/binman/etype/fit.py +4 -0
@@ -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.

Quoted 5 lines
tools/binman/etype/fit.py +0 -1
                     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