On 29/06/26 16:19, Anshul Dalal wrote:
The phandles used inside a template were not being copied to the node
inserting the template, leading to a missing phandle error.

The following example can be used to reproduce the issue:

&binman {
   some_template: template-0 {
     ti-secure-rom {
       content = <&some_data>;
       keyfile = "some_key";
     };
     some_data: blob-ext {
       optional;
     };
   };
   output-bin {
     insert-template = <&some_template>;
   };
};

With the error 'binman: Node '/binman/output-bin/ti-secure-rom': Cannot
find node for phandle 103' observed.

Signed-off-by: Anshul Dalal <[email protected]>
---
  tools/dtoc/fdt.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 991a36b98796..6c3449095194 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -780,7 +780,7 @@ class Node:
              parent = self.GetFdt().LookupPhandle(phandle)
              tout.debug(f'adding template {parent.path} to node {self.path}')
              for node in parent.subnodes.__reversed__():
-                dst = self.copy_node(node)
+                dst = self.copy_node(node, True)
tout.debug(f'merge props from {parent.path} to {self.path}')
              self.merge_props(parent, False)

---
base-commit: 63f6cc8ba618396cb9c0161bb5c6d217604ae1d0
change-id: 20260629-binman_template_phandle_copy_fix-956bc3ce48d6

Best regards,
--
Anshul Dalal <[email protected]>
Reviewed-by: Moteen Shah <[email protected]>

Reply via email to