binman: Support templates containing phandles
This provides support for phandles to be copied over from templates. This
is not quite safe, since if the template is instantiated twice (i.e. in
two different nodes), then duplicate phandles will be found. This will
result in an error.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/binman/test/292_template_phandle_dup.dts b/tools/binman/test/292_template_phandle_dup.dts
new file mode 100644
index 0000000..dc86f06
--- /dev/null
+++ b/tools/binman/test/292_template_phandle_dup.dts
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ multiple-images;
+
+ ti_spl_template: template-1 {
+ fit {
+ description = "test-desc";
+ #address-cells = <1>;
+ images {
+ atf {
+ description = "atf";
+ ti-secure {
+ type = "collection";
+ content = <&atf>;
+ keyfile = "key.pem";
+ };
+ atf: atf-bl31 {
+ description = "atf";
+ };
+ };
+ };
+ };
+ };
+
+ image {
+ insert-template = <&ti_spl_template>;
+ fit {
+ images {
+ fdt-0 {
+ description = "fdt";
+ ti-secure {
+ type = "collection";
+ content = <&foo_dtb>;
+ keyfile = "key.pem";
+ };
+ foo_dtb: blob-ext {
+ filename = "vga.bin";
+ };
+ };
+ };
+ };
+ };
+
+ image-2 {
+ insert-template = <&ti_spl_template>;
+ fit {
+ images {
+ fdt-0 {
+ description = "fdt";
+ blob-ext {
+ filename = "vga.bin";
+ };
+ };
+ };
+ };
+ };
+ };
+};