Skip to contentSkip to conversation

binman: Include also subnodes in generator nodes

PATCH In review Jan Kiszka 2 participants 2 messages Feb 28, 2022 – Mar 1, 2022

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH v3 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.

---

Rebased over "binman: rockchip: Migrate from rockchip SPL_FIT_GENERATOR script"

 tools/binman/etype/fit.py         | 4 ++++
 tools/binman/ftest.py             | 1 +
 tools/binman/test/170_fit_fdt.dts | 3 +++
 3 files changed, 8 insertions(+)
tools/binman/etype/fit.py +4 -0
index 63d552ed192..a31498d5847 100644
@@ -532,6 +532,10 @@ class Entry_fit(Entry_section):
                         # Add data for 'images' nodes (but not 'config')
                         if depth == 1 and in_images:
                             fsw.property('data', tools.read_file(fname))
+
+                        for subnode in node.subnodes:
+                            with fsw.add_node(subnode.name):
+                                _add_node(node, depth + 1, subnode)
             else:
                 if self._fdts is None:
                     if self._fit_list_prop:
tools/binman/ftest.py +1 -0
index ec8e3d4d91b..d296bf1a137 100644
@@ -4037,6 +4037,7 @@ class TestFunctional(unittest.TestCase):
             self.assertEqual(expected_data, fnode.props['data'].bytes)
             self.assertEqual('fdt-test-fdt%d.dtb' % seq,
                              fnode.props['description'].value)
+            self.assertEqual(fnode.subnodes[0].name, 'hash')
 
         def _CheckConfig(seq, expected_data):
             """Check the configuration nodes
tools/binman/test/170_fit_fdt.dts +3 -0
index 99d710c57e9..0197ffd1597 100644
@@ -36,6 +36,9 @@
 					description = "fdt-NAME.dtb";
 					type = "flat_dt";
 					compression = "none";
+					hash {
+						algo = "sha256";
+					};
 				};
 			};
 
Signature · 1 line
2.34.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 10 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.

---

Quoted 8 lines

Rebased over "binman: rockchip: Migrate from rockchip SPL_FIT_GENERATOR script"

 tools/binman/etype/fit.py         | 4 ++++
 tools/binman/ftest.py             | 1 +
 tools/binman/test/170_fit_fdt.dts | 3 +++
 3 files changed, 8 insertions(+)