* [PATCH] binman: Support templating with multiple images
@ 2023-07-07 12:40 Simon Glass
2023-07-07 14:04 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Simon Glass @ 2023-07-07 12:40 UTC (permalink / raw
To: U-Boot Mailing List
Cc: Jan Kiszka, Simon Glass, Alper Nebi Yasak, Neha Malcom Francis,
Peng Fan, Philippe Reynes, Stefan Herbrechtsmeier
Allow a template to appear in the top level description when using
multiple images.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
tools/binman/control.py | 5 ++--
tools/binman/ftest.py | 12 ++++++++++
tools/binman/test/287_template_multi.dts | 29 ++++++++++++++++++++++++
3 files changed, 44 insertions(+), 2 deletions(-)
create mode 100644 tools/binman/test/287_template_multi.dts
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 0f98e9904fb1..b334fbc8ac8f 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -57,8 +57,9 @@ def _ReadImageDesc(binman_node, use_expanded):
images = OrderedDict()
if 'multiple-images' in binman_node.props:
for node in binman_node.subnodes:
- images[node.name] = Image(node.name, node,
- use_expanded=use_expanded)
+ if 'template' not in node.name:
+ images[node.name] = Image(node.name, node,
+ use_expanded=use_expanded)
else:
images['image'] = Image('image', binman_node, use_expanded=use_expanded)
return images
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 389d3906371a..c783424c91da 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -6771,6 +6771,18 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
second = U_BOOT_DATA + b'#' + VGA_DATA + U_BOOT_DTB_DATA
self.assertEqual(U_BOOT_IMG_DATA + first + second, data)
+ def testEntryTemplateBlobMulti(self):
+ """Test using a template with 'multiple-images' enabled"""
+ TestFunctional._MakeInputFile('my-blob.bin', b'blob')
+ TestFunctional._MakeInputFile('my-blob2.bin', b'other')
+ retcode = self._DoTestFile('287_template_multi.dts')
+
+ self.assertEqual(0, retcode)
+ image = control.images['image']
+ image_fname = tools.get_output_filename('my-image.bin')
+ data = tools.read_file(image_fname)
+ self.assertEqual(b'blob@@@@other', data)
+
if __name__ == "__main__":
unittest.main()
diff --git a/tools/binman/test/287_template_multi.dts b/tools/binman/test/287_template_multi.dts
new file mode 100644
index 000000000000..15bd8701c671
--- /dev/null
+++ b/tools/binman/test/287_template_multi.dts
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/dts-v1/;
+/ {
+ binman: binman {
+ multiple-images;
+
+ my_template: template {
+ blob-ext@0 {
+ filename = "my-blob.bin";
+ offset = <0>;
+ };
+ blob-ext@8 {
+ offset = <8>;
+ };
+ };
+
+ image {
+ pad-byte = <0x40>;
+ filename = "my-image.bin";
+ insert-template = <&my_template>;
+ blob-ext@8 {
+ filename = "my-blob2.bin";
+ };
+ };
+ };
+};
--
2.41.0.390.g38632f3daf-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] binman: Support templating with multiple images
2023-07-07 12:40 [PATCH] binman: Support templating with multiple images Simon Glass
@ 2023-07-07 14:04 ` Jan Kiszka
2023-07-07 15:33 ` Simon Glass
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2023-07-07 14:04 UTC (permalink / raw
To: Simon Glass, U-Boot Mailing List
Cc: Alper Nebi Yasak, Neha Malcom Francis, Peng Fan, Philippe Reynes,
Stefan Herbrechtsmeier
On 07.07.23 14:40, Simon Glass wrote:
> Allow a template to appear in the top level description when using
> multiple images.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> tools/binman/control.py | 5 ++--
> tools/binman/ftest.py | 12 ++++++++++
> tools/binman/test/287_template_multi.dts | 29 ++++++++++++++++++++++++
> 3 files changed, 44 insertions(+), 2 deletions(-)
> create mode 100644 tools/binman/test/287_template_multi.dts
>
> diff --git a/tools/binman/control.py b/tools/binman/control.py
> index 0f98e9904fb1..b334fbc8ac8f 100644
> --- a/tools/binman/control.py
> +++ b/tools/binman/control.py
> @@ -57,8 +57,9 @@ def _ReadImageDesc(binman_node, use_expanded):
> images = OrderedDict()
> if 'multiple-images' in binman_node.props:
> for node in binman_node.subnodes:
> - images[node.name] = Image(node.name, node,
> - use_expanded=use_expanded)
> + if 'template' not in node.name:
> + images[node.name] = Image(node.name, node,
> + use_expanded=use_expanded)
> else:
> images['image'] = Image('image', binman_node, use_expanded=use_expanded)
> return images
> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> index 389d3906371a..c783424c91da 100644
> --- a/tools/binman/ftest.py
> +++ b/tools/binman/ftest.py
> @@ -6771,6 +6771,18 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
> second = U_BOOT_DATA + b'#' + VGA_DATA + U_BOOT_DTB_DATA
> self.assertEqual(U_BOOT_IMG_DATA + first + second, data)
>
> + def testEntryTemplateBlobMulti(self):
> + """Test using a template with 'multiple-images' enabled"""
> + TestFunctional._MakeInputFile('my-blob.bin', b'blob')
> + TestFunctional._MakeInputFile('my-blob2.bin', b'other')
> + retcode = self._DoTestFile('287_template_multi.dts')
> +
> + self.assertEqual(0, retcode)
> + image = control.images['image']
> + image_fname = tools.get_output_filename('my-image.bin')
> + data = tools.read_file(image_fname)
> + self.assertEqual(b'blob@@@@other', data)
> +
>
> if __name__ == "__main__":
> unittest.main()
> diff --git a/tools/binman/test/287_template_multi.dts b/tools/binman/test/287_template_multi.dts
> new file mode 100644
> index 000000000000..15bd8701c671
> --- /dev/null
> +++ b/tools/binman/test/287_template_multi.dts
> @@ -0,0 +1,29 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +/dts-v1/;
> +
> +/dts-v1/;
Duplicate.
> +/ {
> + binman: binman {
> + multiple-images;
> +
> + my_template: template {
> + blob-ext@0 {
> + filename = "my-blob.bin";
> + offset = <0>;
> + };
> + blob-ext@8 {
> + offset = <8>;
> + };
> + };
> +
> + image {
> + pad-byte = <0x40>;
> + filename = "my-image.bin";
> + insert-template = <&my_template>;
> + blob-ext@8 {
> + filename = "my-blob2.bin";
> + };
> + };
> + };
> +};
For the sake of context:
echo 1234 > my-blob.bin
echo 5678 > my-blob2.bin
dtc tools/binman/test/287_template_multi.dts -o binman-test.dtb
tools/binman/binman build -d binman-test.dtb -O .
binman: Node '/binman/image/blob-ext@0': Offset 0x0 (0) overlaps with previous entry '/binman/image/blob-ext@8' ending at 0xd (13)
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] binman: Support templating with multiple images
2023-07-07 14:04 ` Jan Kiszka
@ 2023-07-07 15:33 ` Simon Glass
0 siblings, 0 replies; 3+ messages in thread
From: Simon Glass @ 2023-07-07 15:33 UTC (permalink / raw
To: Jan Kiszka
Cc: U-Boot Mailing List, Alper Nebi Yasak, Neha Malcom Francis,
Peng Fan, Philippe Reynes, Stefan Herbrechtsmeier
Hi Jan,
On Fri, 7 Jul 2023 at 15:04, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>
> On 07.07.23 14:40, Simon Glass wrote:
> > Allow a template to appear in the top level description when using
> > multiple images.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> > tools/binman/control.py | 5 ++--
> > tools/binman/ftest.py | 12 ++++++++++
> > tools/binman/test/287_template_multi.dts | 29 ++++++++++++++++++++++++
> > 3 files changed, 44 insertions(+), 2 deletions(-)
> > create mode 100644 tools/binman/test/287_template_multi.dts
> >
> > diff --git a/tools/binman/control.py b/tools/binman/control.py
> > index 0f98e9904fb1..b334fbc8ac8f 100644
> > --- a/tools/binman/control.py
> > +++ b/tools/binman/control.py
> > @@ -57,8 +57,9 @@ def _ReadImageDesc(binman_node, use_expanded):
> > images = OrderedDict()
> > if 'multiple-images' in binman_node.props:
> > for node in binman_node.subnodes:
> > - images[node.name] = Image(node.name, node,
> > - use_expanded=use_expanded)
> > + if 'template' not in node.name:
> > + images[node.name] = Image(node.name, node,
> > + use_expanded=use_expanded)
> > else:
> > images['image'] = Image('image', binman_node, use_expanded=use_expanded)
> > return images
> > diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> > index 389d3906371a..c783424c91da 100644
> > --- a/tools/binman/ftest.py
> > +++ b/tools/binman/ftest.py
> > @@ -6771,6 +6771,18 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
> > second = U_BOOT_DATA + b'#' + VGA_DATA + U_BOOT_DTB_DATA
> > self.assertEqual(U_BOOT_IMG_DATA + first + second, data)
> >
> > + def testEntryTemplateBlobMulti(self):
> > + """Test using a template with 'multiple-images' enabled"""
> > + TestFunctional._MakeInputFile('my-blob.bin', b'blob')
> > + TestFunctional._MakeInputFile('my-blob2.bin', b'other')
> > + retcode = self._DoTestFile('287_template_multi.dts')
> > +
> > + self.assertEqual(0, retcode)
> > + image = control.images['image']
> > + image_fname = tools.get_output_filename('my-image.bin')
> > + data = tools.read_file(image_fname)
> > + self.assertEqual(b'blob@@@@other', data)
> > +
> >
> > if __name__ == "__main__":
> > unittest.main()
> > diff --git a/tools/binman/test/287_template_multi.dts b/tools/binman/test/287_template_multi.dts
> > new file mode 100644
> > index 000000000000..15bd8701c671
> > --- /dev/null
> > +++ b/tools/binman/test/287_template_multi.dts
> > @@ -0,0 +1,29 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +
> > +/dts-v1/;
> > +
> > +/dts-v1/;
>
> Duplicate.
>
> > +/ {
> > + binman: binman {
> > + multiple-images;
> > +
> > + my_template: template {
> > + blob-ext@0 {
> > + filename = "my-blob.bin";
> > + offset = <0>;
> > + };
> > + blob-ext@8 {
> > + offset = <8>;
> > + };
> > + };
> > +
> > + image {
> > + pad-byte = <0x40>;
> > + filename = "my-image.bin";
> > + insert-template = <&my_template>;
> > + blob-ext@8 {
> > + filename = "my-blob2.bin";
> > + };
> > + };
> > + };
> > +};
>
> For the sake of context:
>
> echo 1234 > my-blob.bin
> echo 5678 > my-blob2.bin
> dtc tools/binman/test/287_template_multi.dts -o binman-test.dtb
> tools/binman/binman build -d binman-test.dtb -O .
>
> binman: Node '/binman/image/blob-ext@0': Offset 0x0 (0) overlaps with previous entry '/binman/image/blob-ext@8' ending at 0xd (13)
Hi Jan,
I don't get that error when I try these exact commands:
(=88a31 moveconfig.failed) sglass@ELLESMERE ~/u> echo 1234 > my-blob.bin
(=88a31 moveconfig.failed) sglass@ELLESMERE ~/u> echo 5678 > my-blob2.bin
(=88a31 moveconfig.failed) sglass@ELLESMERE ~/u> dtc
tools/binman/test/287_template_multi.dts -o binman-test.dtb
tools/binman/test/287_template_multi.dts:11.15-14.6: Warning
(unit_address_vs_reg): /binman/template/blob-ext@0: node has a unit
name, but no reg or ranges property
tools/binman/test/287_template_multi.dts:15.15-17.6: Warning
(unit_address_vs_reg): /binman/template/blob-ext@8: node has a unit
name, but no reg or ranges property
tools/binman/test/287_template_multi.dts:24.15-26.6: Warning
(unit_address_vs_reg): /binman/image/blob-ext@8: node has a unit name,
but no reg or ranges property
(=88a31 moveconfig.failed) sglass@ELLESMERE ~/u> tools/binman/binman
build -d binman-test.dtb -O .
(=88a31 moveconfig.failed) sglass@ELLESMERE ~/u> hd my-image.bin
00000000 31 32 33 34 0a 40 40 40 35 36 37 38 0a |1234.@@@5678.|
0000000d
(=88a31 moveconfig.failed) sglass@ELLESMERE ~/u>
Are you sure you are using all the patches? You can use
u-boot-dm/mkim-working as the tree if you are unsure.
Regards,
Simon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-07 15:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-07 12:40 [PATCH] binman: Support templating with multiple images Simon Glass
2023-07-07 14:04 ` Jan Kiszka
2023-07-07 15:33 ` Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).