All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fdt: fix phandles not copying when using templates
@ 2026-06-29 10:49 Anshul Dalal
  2026-06-29 12:01 ` Moteen Shah
  2026-07-01 12:07 ` Simon Glass
  0 siblings, 2 replies; 4+ messages in thread
From: Anshul Dalal @ 2026-06-29 10:49 UTC (permalink / raw)
  To: u-boot; +Cc: Tom Rini, Simon Glass, Anshul Dalal

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 <anshuld@ti.com>
---
 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 <anshuld@ti.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] fdt: fix phandles not copying when using templates
  2026-06-29 10:49 [PATCH] fdt: fix phandles not copying when using templates Anshul Dalal
@ 2026-06-29 12:01 ` Moteen Shah
  2026-07-01 12:07 ` Simon Glass
  1 sibling, 0 replies; 4+ messages in thread
From: Moteen Shah @ 2026-06-29 12:01 UTC (permalink / raw)
  To: Anshul Dalal, u-boot; +Cc: Tom Rini, Simon Glass


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 <anshuld@ti.com>
> ---
>   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 <anshuld@ti.com>
Reviewed-by: Moteen Shah <m-shah@ti.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fdt: fix phandles not copying when using templates
  2026-06-29 10:49 [PATCH] fdt: fix phandles not copying when using templates Anshul Dalal
  2026-06-29 12:01 ` Moteen Shah
@ 2026-07-01 12:07 ` Simon Glass
  2026-07-03  9:19   ` Anshul Dalal
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Glass @ 2026-07-01 12:07 UTC (permalink / raw)
  To: Anshul Dalal; +Cc: u-boot, Tom Rini

Hi Anshul,

On Mon, 29 Jun 2026 at 11:49, Anshul Dalal <anshuld@ti.com> 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 <anshuld@ti.com>
> ---
>  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)

I believe this is the one you pinged about on irc?

Please can you add a test for this new behaviour.

>
>              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 <anshuld@ti.com>
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fdt: fix phandles not copying when using templates
  2026-07-01 12:07 ` Simon Glass
@ 2026-07-03  9:19   ` Anshul Dalal
  0 siblings, 0 replies; 4+ messages in thread
From: Anshul Dalal @ 2026-07-03  9:19 UTC (permalink / raw)
  To: Simon Glass, Anshul Dalal; +Cc: u-boot, Tom Rini

On Wed Jul 1, 2026 at 5:37 PM IST, Simon Glass wrote:
> Hi Anshul,
>
> On Mon, 29 Jun 2026 at 11:49, Anshul Dalal <anshuld@ti.com> 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 <anshuld@ti.com>
>> ---
>>  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)
>
> I believe this is the one you pinged about on irc?
>

No, the issue of bootph property only being propagated to the parent
nodes in u-boot.dtb.out and not in u-boot.dtb is a different one.

I'm still working through that issue, will CC you on a fix once ready.

> Please can you add a test for this new behaviour.

Sure, will send a v2 with a test.

Anshul

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-03  9:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 10:49 [PATCH] fdt: fix phandles not copying when using templates Anshul Dalal
2026-06-29 12:01 ` Moteen Shah
2026-07-01 12:07 ` Simon Glass
2026-07-03  9:19   ` Anshul Dalal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.