binman: Support simple templates

Collections can used to collect the contents of other entries into a
single entry, but they result in a single entry, with the original entries
'left behind' in their old place.

It is useful to be able to specific a set of entries ones and have it used
in multiple images, or parts of an image.

Implement this mechanism.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/binman/test/286_template.dts b/tools/binman/test/286_template.dts
new file mode 100644
index 0000000..6980dbf
--- /dev/null
+++ b/tools/binman/test/286_template.dts
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		u-boot-img {
+		};
+
+		common_part: template {
+			u-boot {
+			};
+
+			intel-vga {
+				filename = "vga.bin";
+			};
+		};
+
+		first {
+			type = "section";
+			insert-template = <&common_part>;
+
+			u-boot-dtb {
+			};
+		};
+
+		second {
+			type = "section";
+			insert-template = <&common_part>;
+
+			u-boot-dtb {
+			};
+
+			intel-vga {
+				filename = "vga2.bin";
+			};
+		};
+	};
+};