All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/8] migrate u-boot-rockchip.bin to binman and generate an image for SPI
@ 2022-08-03 12:18 Quentin Schulz
  2022-08-03 12:18 ` [PATCH v4 1/8] binman: add support for skipping file concatenation for mkimage Quentin Schulz
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Quentin Schulz @ 2022-08-03 12:18 UTC (permalink / raw)
  Cc: bharat.gooty, rayagonda.kokatanur, sjg, philipp.tomsich,
	kever.yang, jagan, alpernebiyasak, xypron.glpk, heiko.thiery,
	u-boot, Quentin Schulz

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

This migrates the generation of u-boot-rockchip.bin from Makefile to binman
completely.

This also adds support for generating the same kind of image than
u-boot-rockchip.bin but for SPI flashes (specifically, a different image
type generated by mkimage is necessary, in addition to a different
offset in the storage medium).

This has been tested on Puma RK3399 with patch series from https://lore.kernel.org/u-boot/20220722160655.3904213-1-foss+uboot@0leil.net/#b (plus https://lore.kernel.org/u-boot/20220722113505.3875669-4-foss+uboot@0leil.net/).

Cheers,
Quentin

v4:
 - added binman test for mkimage filename,
 - fixed >80 chars line in patch 2/8 binman: allow user-defined filenames for
 mkimage entry,
 - fixed wrong location for endif in patch 6/8 simplify binman image
 dependencies addition to INPUTS,


v3:
 - removed
 https://lore.kernel.org/u-boot/20220722113505.3875669-4-foss+uboot@0leil.net/,
 it'll be added later on in a separate patch series,
 - added "binman: allow user-defined filenames for mkimage entry,"
 - kept idbloader.img binary creation even with binman as requested by
 community,
 - generate idbloader-spi.img binary with binman,
 - added "rockchip: remove binman temporary files when cleaning"

v2:
 - removed patch 4/8 rockchip: pad u-boot-rockchip.bin correctly because
 it would break partitions table,
 - rebased on top of master, changes to patch 3/7 rockchip: remove
 unneeded CONFIG_SPL_PAD_TO compared to the RFC 3/8 rockchip: remove
 unneeded CONFIG_SPL_PAD_TO,

Quentin Schulz (8):
  binman: add support for skipping file concatenation for mkimage
  binman: allow user-defined filenames for mkimage entry
  rockchip: remove binman temporary files when cleaning
  rockchip: generate idbloader.img content for u-boot-rockchip.bin with
    binman for ARM
  rockchip: generate u-boot-rockchip.bin with binman for ARM64 boards
  rockchip: simplify binman image dependencies addition to INPUTS
  rockchip: allow to build SPI images even without HAS_ROM option
  rockchip: add u-boot-rockchip-spi.bin image for booting from SPI-NOR
    flash

 Makefile                                   | 41 ++++--------------
 arch/arm/Kconfig                           |  2 +-
 arch/arm/dts/rk3288-u-boot.dtsi            |  2 +-
 arch/arm/dts/rk3399-u-boot.dtsi            |  2 +-
 arch/arm/dts/rockchip-u-boot.dtsi          | 46 ++++++++++++++++++++-
 arch/arm/mach-rockchip/Kconfig             |  6 +--
 tools/binman/entries.rst                   | 22 ++++++++++
 tools/binman/etype/mkimage.py              | 48 +++++++++++++++++++---
 tools/binman/ftest.py                      |  6 +++
 tools/binman/test/235_mkimage_filename.dts | 24 +++++++++++
 10 files changed, 151 insertions(+), 48 deletions(-)
 create mode 100644 tools/binman/test/235_mkimage_filename.dts

-- 
2.37.1


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

* [PATCH v4 1/8] binman: add support for skipping file concatenation for mkimage
  2022-08-03 12:18 [PATCH v4 0/8] migrate u-boot-rockchip.bin to binman and generate an image for SPI Quentin Schulz
@ 2022-08-03 12:18 ` Quentin Schulz
  2022-08-18  8:17   ` Simon Glass
  2022-08-03 12:19 ` [PATCH v4 2/8] binman: allow user-defined filenames for mkimage entry Quentin Schulz
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Quentin Schulz @ 2022-08-03 12:18 UTC (permalink / raw)
  Cc: bharat.gooty, rayagonda.kokatanur, sjg, philipp.tomsich,
	kever.yang, jagan, alpernebiyasak, xypron.glpk, heiko.thiery,
	u-boot, Quentin Schulz, Quentin Schulz

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Some image types handled by mkimage require the datafiles to be passed
independently (-d data1:data2) for specific handling of each. A
concatenation of datafiles prior to passing them to mkimage wouldn't
work.

That is the case for rkspi for example which requires page alignment
and only writing 2KB every 4KB.

This adds the ability to tell binman to pass the datafiles without
prior concatenation to mkimage, by adding the multiple-data-files
boolean property to the mkimage node.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 tools/binman/entries.rst      | 22 +++++++++++++++++++
 tools/binman/etype/mkimage.py | 41 +++++++++++++++++++++++++++++++----
 2 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index ae4305c99e..60c89aec59 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -1101,6 +1101,9 @@ Entry: mkimage: Binary produced by mkimage
 
 Properties / Entry arguments:
     - datafile: Filename for -d argument
+    - multiple-data-files: boolean to tell binman to pass all files as
+      datafiles to mkimage instead of creating a temporary file the result
+      of datafiles concatenation
     - args: Other arguments to pass
 
 The data passed to mkimage is collected from subnodes of the mkimage node,
@@ -1117,6 +1120,25 @@ This calls mkimage to create an imximage with u-boot-spl.bin as the input
 file. The output from mkimage then becomes part of the image produced by
 binman.
 
+To pass all datafiles untouched to mkimage::
+
+    mkimage {
+        args = "-n rk3399 -T rkspi";
+        multiple-data-files;
+
+        u-boot-tpl {
+        };
+
+        u-boot-spl {
+        };
+    };
+
+This calls mkimage to create a Rockchip RK3399-specific first stage
+bootloader, made of TPL+SPL. Since this first stage bootloader requires to
+align the TPL and SPL but also some weird hacks that is handled by mkimage
+directly, binman is told to not perform the concatenation of datafiles prior
+to passing the data to mkimage.
+
 To use CONFIG options in the arguments, use a string list instead, as in
 this example which also produces four arguments::
 
diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index 5f6def2287..52297c23ea 100644
--- a/tools/binman/etype/mkimage.py
+++ b/tools/binman/etype/mkimage.py
@@ -16,6 +16,9 @@ class Entry_mkimage(Entry):
 
     Properties / Entry arguments:
         - datafile: Filename for -d argument
+        - multiple-data-files: boolean to tell binman to pass all files as
+          datafiles to mkimage instead of creating a temporary file the result
+          of datafiles concatenation
         - args: Other arguments to pass
 
     The data passed to mkimage is collected from subnodes of the mkimage node,
@@ -32,6 +35,25 @@ class Entry_mkimage(Entry):
     file. The output from mkimage then becomes part of the image produced by
     binman.
 
+	To pass all datafiles untouched to mkimage::
+
+		mkimage {
+			args = "-n rk3399 -T rkspi";
+			multiple-data-files;
+
+			u-boot-tpl {
+			};
+
+			u-boot-spl {
+			};
+		};
+
+	This calls mkimage to create a Rockchip RK3399-specific first stage
+	bootloader, made of TPL+SPL. Since this first stage bootloader requires to
+	align the TPL and SPL but also some weird hacks that is handled by mkimage
+	directly, binman is told to not perform the concatenation of datafiles prior
+	to passing the data to mkimage.
+
     To use CONFIG options in the arguments, use a string list instead, as in
     this example which also produces four arguments::
 
@@ -46,16 +68,27 @@ class Entry_mkimage(Entry):
     def __init__(self, section, etype, node):
         super().__init__(section, etype, node)
         self._args = fdt_util.GetArgs(self._node, 'args')
+        self._multiple_data_files = fdt_util.GetBool(self._node, 'multiple-data-files')
         self._mkimage_entries = OrderedDict()
         self.align_default = None
         self.ReadEntries()
 
     def ObtainContents(self):
         # Use a non-zero size for any fake files to keep mkimage happy
-        data, input_fname, uniq = self.collect_contents_to_file(
-            self._mkimage_entries.values(), 'mkimage', 1024)
-        if data is None:
-            return False
+        fake_size = 1024
+        if self._multiple_data_files:
+            fnames = []
+            uniq = self.GetUniqueName()
+            for entry in self._mkimage_entries.values():
+                if not entry.ObtainContents(fake_size=fake_size):
+                    return False
+                fnames.append(entry.GetDefaultFilename())
+            input_fname = ":".join(fnames)
+        else:
+            data, input_fname, uniq = self.collect_contents_to_file(
+                self._mkimage_entries.values(), 'mkimage', fake_size)
+            if data is None:
+                return False
         output_fname = tools.get_output_filename('mkimage-out.%s' % uniq)
         if self.mkimage.run_cmd('-d', input_fname, *self._args,
                                 output_fname) is not None:
-- 
2.37.1


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

* [PATCH v4 2/8] binman: allow user-defined filenames for mkimage entry
  2022-08-03 12:18 [PATCH v4 0/8] migrate u-boot-rockchip.bin to binman and generate an image for SPI Quentin Schulz
  2022-08-03 12:18 ` [PATCH v4 1/8] binman: add support for skipping file concatenation for mkimage Quentin Schulz
@ 2022-08-03 12:19 ` Quentin Schulz
  2022-08-03 18:13   ` Simon Glass
  2022-08-03 12:19 ` [PATCH v4 3/8] rockchip: remove binman temporary files when cleaning Quentin Schulz
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Quentin Schulz @ 2022-08-03 12:19 UTC (permalink / raw)
  Cc: bharat.gooty, rayagonda.kokatanur, sjg, philipp.tomsich,
	kever.yang, jagan, alpernebiyasak, xypron.glpk, heiko.thiery,
	u-boot, Quentin Schulz, Quentin Schulz

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

mkimage entry currently creates a file whose name is derived from the
section name containing said entry.

Let's allow the user to define a filename for the mkimage-generated
binary by using the 'filename' DT property.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---

v4:
 - added binman test,
 - fixed >80 chars-long line,

added in v3

 tools/binman/etype/mkimage.py              |  9 ++++++--
 tools/binman/ftest.py                      |  6 ++++++
 tools/binman/test/235_mkimage_filename.dts | 24 ++++++++++++++++++++++
 3 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 tools/binman/test/235_mkimage_filename.dts

diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index 52297c23ea..009b26f10a 100644
--- a/tools/binman/etype/mkimage.py
+++ b/tools/binman/etype/mkimage.py
@@ -20,11 +20,13 @@ class Entry_mkimage(Entry):
           datafiles to mkimage instead of creating a temporary file the result
           of datafiles concatenation
         - args: Other arguments to pass
+        - filename: filename of output binary generated by mkimage
 
     The data passed to mkimage is collected from subnodes of the mkimage node,
     e.g.::
 
         mkimage {
+            filename = "imximage.bin";
             args = "-n test -T imximage";
 
             u-boot-spl {
@@ -33,7 +35,7 @@ class Entry_mkimage(Entry):
 
     This calls mkimage to create an imximage with u-boot-spl.bin as the input
     file. The output from mkimage then becomes part of the image produced by
-    binman.
+    binman but also is written into imximage.bin file.
 
 	To pass all datafiles untouched to mkimage::
 
@@ -70,6 +72,7 @@ class Entry_mkimage(Entry):
         self._args = fdt_util.GetArgs(self._node, 'args')
         self._multiple_data_files = fdt_util.GetBool(self._node, 'multiple-data-files')
         self._mkimage_entries = OrderedDict()
+        self._filename = fdt_util.GetString(self._node, 'filename')
         self.align_default = None
         self.ReadEntries()
 
@@ -89,7 +92,9 @@ class Entry_mkimage(Entry):
                 self._mkimage_entries.values(), 'mkimage', fake_size)
             if data is None:
                 return False
-        output_fname = tools.get_output_filename('mkimage-out.%s' % uniq)
+
+        outfile = self._filename if self._filename else 'mkimage-out.%s' % uniq
+        output_fname = tools.get_output_filename(outfile)
         if self.mkimage.run_cmd('-d', input_fname, *self._args,
                                 output_fname) is not None:
             self.SetContents(tools.read_file(output_fname))
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index fa1f421c05..9820d50c3c 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -5703,6 +5703,12 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
             dts='234_replace_section_simple.dts')
         self.assertEqual(new_data, data)
 
+    def testMkimageFilename(self):
+        """Test using mkimage to build a binary with a filename"""
+        retcode = self._DoTestFile('235_mkimage_filename.dts')
+        self.assertEqual(0, retcode)
+        fname = tools.get_output_filename('mkimage-test.bin')
+        self.assertTrue(os.path.exists(fname))
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/235_mkimage_filename.dts b/tools/binman/test/235_mkimage_filename.dts
new file mode 100644
index 0000000000..b6f28eb9ab
--- /dev/null
+++ b/tools/binman/test/235_mkimage_filename.dts
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		size = <0x80>;
+
+		mkimage {
+			filename = "mkimage-test.bin";
+			args = "-n test -T script";
+
+			u-boot-spl {
+			};
+
+			_testing {
+				return-contents-later;
+			};
+		};
+	};
+};
-- 
2.37.1


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

* [PATCH v4 3/8] rockchip: remove binman temporary files when cleaning
  2022-08-03 12:18 [PATCH v4 0/8] migrate u-boot-rockchip.bin to binman and generate an image for SPI Quentin Schulz
  2022-08-03 12:18 ` [PATCH v4 1/8] binman: add support for skipping file concatenation for mkimage Quentin Schulz
  2022-08-03 12:19 ` [PATCH v4 2/8] binman: allow user-defined filenames for mkimage entry Quentin Schulz
@ 2022-08-03 12:19 ` Quentin Schulz
  2022-08-03 18:13   ` Simon Glass
  2022-08-03 12:19 ` [PATCH v4 4/8] rockchip: generate idbloader.img content for u-boot-rockchip.bin with binman for ARM Quentin Schulz
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Quentin Schulz @ 2022-08-03 12:19 UTC (permalink / raw)
  Cc: bharat.gooty, rayagonda.kokatanur, sjg, philipp.tomsich,
	kever.yang, jagan, alpernebiyasak, xypron.glpk, heiko.thiery,
	u-boot, Quentin Schulz, Quentin Schulz, Johan Jonker

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Binman mkimage entry generates temporary files so let's remove them
when calling `make clean`.

Fixes: 9b312e26fc77 ("rockchip: Enable building a SPI ROM image on jerry")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Reported-by: Johan Jonker <jbx6244@gmail.com>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---

added in v3

 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ff25f92974..bbb2a4c088 100644
--- a/Makefile
+++ b/Makefile
@@ -2220,7 +2220,8 @@ CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \
 	       lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin* \
 	       idbloader.img flash.bin flash.log defconfig keep-syms-lto.c \
 	       mkimage-out.spl.mkimage mkimage.spl.mkimage imx-boot.map \
-	       itb.fit.fit itb.fit.itb itb.map spl.map
+	       itb.fit.fit itb.fit.itb itb.map spl.map mkimage-out.rom.mkimage \
+	       mkimage.rom.mkimage rom.map simple-bin.map
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include/generated spl tpl \
-- 
2.37.1


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

* [PATCH v4 4/8] rockchip: generate idbloader.img content for u-boot-rockchip.bin with binman for ARM
  2022-08-03 12:18 [PATCH v4 0/8] migrate u-boot-rockchip.bin to binman and generate an image for SPI Quentin Schulz
                   ` (2 preceding siblings ...)
  2022-08-03 12:19 ` [PATCH v4 3/8] rockchip: remove binman temporary files when cleaning Quentin Schulz
@ 2022-08-03 12:19 ` Quentin Schulz
  2022-08-03 12:19 ` [PATCH v4 5/8] rockchip: generate u-boot-rockchip.bin with binman for ARM64 boards Quentin Schulz
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Quentin Schulz @ 2022-08-03 12:19 UTC (permalink / raw)
  Cc: bharat.gooty, rayagonda.kokatanur, sjg, philipp.tomsich,
	kever.yang, jagan, alpernebiyasak, xypron.glpk, heiko.thiery,
	u-boot, Quentin Schulz, Quentin Schulz

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

idbloader.img content - currently created by way of Makefile - can be
created by binman directly.

So let's do that for Rockchip ARM platforms.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
v4:
 - added Reviewed-by,

v3:
 - moved spl back into mkimage section,
 - added filename property so that the idbloader.img binary is still
 generated,

 Makefile                          |  2 +-
 arch/arm/dts/rockchip-u-boot.dtsi | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index bbb2a4c088..ceb5b5e0d9 100644
--- a/Makefile
+++ b/Makefile
@@ -1005,7 +1005,7 @@ endif
 else
 ifeq ($(CONFIG_SPL),y)
 # Generate these inputs for binman which will create the output files
-INPUTS-y += idbloader.img u-boot.img
+INPUTS-y += u-boot.img
 endif
 endif
 endif
diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi
index eae3ee715d..ad72ca9700 100644
--- a/arch/arm/dts/rockchip-u-boot.dtsi
+++ b/arch/arm/dts/rockchip-u-boot.dtsi
@@ -17,8 +17,17 @@
 		filename = "u-boot-rockchip.bin";
 		pad-byte = <0xff>;
 
-		blob {
+		mkimage {
 			filename = "idbloader.img";
+			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+#ifdef CONFIG_TPL
+			multiple-data-files;
+
+			u-boot-tpl {
+			};
+#endif
+			u-boot-spl {
+			};
 		};
 
 		u-boot-img {
-- 
2.37.1


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

* [PATCH v4 5/8] rockchip: generate u-boot-rockchip.bin with binman for ARM64 boards
  2022-08-03 12:18 [PATCH v4 0/8] migrate u-boot-rockchip.bin to binman and generate an image for SPI Quentin Schulz
                   ` (3 preceding siblings ...)
  2022-08-03 12:19 ` [PATCH v4 4/8] rockchip: generate idbloader.img content for u-boot-rockchip.bin with binman for ARM Quentin Schulz
@ 2022-08-03 12:19 ` Quentin Schulz
  2022-08-03 12:19 ` [PATCH v4 6/8] rockchip: simplify binman image dependencies addition to INPUTS Quentin Schulz
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Quentin Schulz @ 2022-08-03 12:19 UTC (permalink / raw)
  Cc: bharat.gooty, rayagonda.kokatanur, sjg, philipp.tomsich,
	kever.yang, jagan, alpernebiyasak, xypron.glpk, heiko.thiery,
	u-boot, Quentin Schulz, Quentin Schulz

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

This allows to build u-boot-rockchip.bin binary with binman for Rockchip
ARM64 boards instead of the legacy Makefile way.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---

v4:
 - added Reviewed-by,

 Makefile                          | 26 +-------------------------
 arch/arm/Kconfig                  |  2 +-
 arch/arm/dts/rockchip-u-boot.dtsi |  5 +++++
 3 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/Makefile b/Makefile
index ceb5b5e0d9..f8e919e136 100644
--- a/Makefile
+++ b/Makefile
@@ -999,8 +999,7 @@ ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
 # On ARM64 this target is produced by binman so we don't need this dep
 ifeq ($(CONFIG_ARM64),y)
 ifeq ($(CONFIG_SPL),y)
-# TODO: Get binman to generate this too
-INPUTS-y += u-boot-rockchip.bin
+INPUTS-y += u-boot.itb
 endif
 else
 ifeq ($(CONFIG_SPL),y)
@@ -1493,29 +1492,6 @@ OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
 u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE
 	$(call if_changed,pad_cat)
 
-ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
-
-# TPL + SPL
-ifeq ($(CONFIG_SPL)$(CONFIG_TPL),yy)
-MKIMAGEFLAGS_u-boot-tpl-rockchip.bin = -n $(CONFIG_SYS_SOC) -T rksd
-tpl/u-boot-tpl-rockchip.bin: tpl/u-boot-tpl.bin FORCE
-	$(call if_changed,mkimage)
-idbloader.img: tpl/u-boot-tpl-rockchip.bin spl/u-boot-spl.bin FORCE
-	$(call if_changed,cat)
-else
-MKIMAGEFLAGS_idbloader.img = -n $(CONFIG_SYS_SOC) -T rksd
-idbloader.img: spl/u-boot-spl.bin FORCE
-	$(call if_changed,mkimage)
-endif
-
-ifeq ($(CONFIG_ARM64),y)
-OBJCOPYFLAGS_u-boot-rockchip.bin = -I binary -O binary \
-	--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
-u-boot-rockchip.bin: idbloader.img u-boot.itb FORCE
-	$(call if_changed,pad_cat)
-endif # CONFIG_ARM64
-
-endif # CONFIG_ARCH_ROCKCHIP
 
 ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy)
 MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 949ebb46ba..c973146f8d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1974,7 +1974,7 @@ config ARCH_STM32MP
 config ARCH_ROCKCHIP
 	bool "Support Rockchip SoCs"
 	select BLK
-	select BINMAN if SPL_OPTEE || (SPL && !ARM64)
+	select BINMAN if SPL_OPTEE || SPL
 	select DM
 	select DM_GPIO
 	select DM_I2C
diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi
index ad72ca9700..f90a8bf085 100644
--- a/arch/arm/dts/rockchip-u-boot.dtsi
+++ b/arch/arm/dts/rockchip-u-boot.dtsi
@@ -30,7 +30,12 @@
 			};
 		};
 
+#ifdef CONFIG_ARM64
+		blob {
+			filename = "u-boot.itb";
+#else
 		u-boot-img {
+#endif
 			offset = <CONFIG_SPL_PAD_TO>;
 		};
 	};
-- 
2.37.1


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

* [PATCH v4 6/8] rockchip: simplify binman image dependencies addition to INPUTS
  2022-08-03 12:18 [PATCH v4 0/8] migrate u-boot-rockchip.bin to binman and generate an image for SPI Quentin Schulz
                   ` (4 preceding siblings ...)
  2022-08-03 12:19 ` [PATCH v4 5/8] rockchip: generate u-boot-rockchip.bin with binman for ARM64 boards Quentin Schulz
@ 2022-08-03 12:19 ` Quentin Schulz
  2022-08-03 18:13   ` Simon Glass
  2022-08-03 12:19 ` [PATCH v4 7/8] rockchip: allow to build SPI images even without HAS_ROM option Quentin Schulz
  2022-08-03 12:19 ` [PATCH v4 8/8] rockchip: add u-boot-rockchip-spi.bin image for booting from SPI-NOR flash Quentin Schulz
  7 siblings, 1 reply; 17+ messages in thread
From: Quentin Schulz @ 2022-08-03 12:19 UTC (permalink / raw)
  Cc: bharat.gooty, rayagonda.kokatanur, sjg, philipp.tomsich,
	kever.yang, jagan, alpernebiyasak, xypron.glpk, heiko.thiery,
	u-boot, Quentin Schulz, Quentin Schulz

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

By factoring SPL check in the first condition, this makes the checks a
bit less convoluted and more readable.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---

v4:
 - fixed wrong place for endif for ARM32 boards,

 Makefile | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index f8e919e136..5fb470b0d8 100644
--- a/Makefile
+++ b/Makefile
@@ -995,19 +995,14 @@ ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
 INPUTS-y += u-boot-with-dtb.bin
 endif
 
-ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
-# On ARM64 this target is produced by binman so we don't need this dep
+ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy)
+# Binman image dependencies
 ifeq ($(CONFIG_ARM64),y)
-ifeq ($(CONFIG_SPL),y)
 INPUTS-y += u-boot.itb
-endif
 else
-ifeq ($(CONFIG_SPL),y)
-# Generate these inputs for binman which will create the output files
 INPUTS-y += u-boot.img
 endif
 endif
-endif
 
 INPUTS-$(CONFIG_X86) += u-boot-x86-start16.bin u-boot-x86-reset16.bin \
 	$(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \
-- 
2.37.1


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

* [PATCH v4 7/8] rockchip: allow to build SPI images even without HAS_ROM option
  2022-08-03 12:18 [PATCH v4 0/8] migrate u-boot-rockchip.bin to binman and generate an image for SPI Quentin Schulz
                   ` (5 preceding siblings ...)
  2022-08-03 12:19 ` [PATCH v4 6/8] rockchip: simplify binman image dependencies addition to INPUTS Quentin Schulz
@ 2022-08-03 12:19 ` Quentin Schulz
  2022-08-03 18:13   ` Simon Glass
  2022-08-03 12:19 ` [PATCH v4 8/8] rockchip: add u-boot-rockchip-spi.bin image for booting from SPI-NOR flash Quentin Schulz
  7 siblings, 1 reply; 17+ messages in thread
From: Quentin Schulz @ 2022-08-03 12:19 UTC (permalink / raw)
  Cc: bharat.gooty, rayagonda.kokatanur, sjg, philipp.tomsich,
	kever.yang, jagan, alpernebiyasak, xypron.glpk, heiko.thiery,
	u-boot, Quentin Schulz, Quentin Schulz

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

This prepares for the creation of a u-boot-rockchip-spi.bin image
similar to u-boot-rockchip.bin to the exception it's destined for
SPI-NOR flashes instead of MMC storage medium.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 arch/arm/dts/rk3288-u-boot.dtsi | 2 +-
 arch/arm/dts/rk3399-u-boot.dtsi | 2 +-
 arch/arm/mach-rockchip/Kconfig  | 6 ++----
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/arm/dts/rk3288-u-boot.dtsi b/arch/arm/dts/rk3288-u-boot.dtsi
index 9eb696b141..e411445ed6 100644
--- a/arch/arm/dts/rk3288-u-boot.dtsi
+++ b/arch/arm/dts/rk3288-u-boot.dtsi
@@ -56,7 +56,7 @@
 	};
 };
 
-#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
+#if defined(CONFIG_ROCKCHIP_SPI_IMAGE) && defined(CONFIG_HAS_ROM)
 &binman {
 	rom {
 		filename = "u-boot.rom";
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index 716b9a433a..3c1a15fe51 100644
--- a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -60,7 +60,7 @@
 
 };
 
-#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
+#if defined(CONFIG_ROCKCHIP_SPI_IMAGE) && defined(CONFIG_HAS_ROM)
 &binman {
 	rom {
 		filename = "u-boot.rom";
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index c561a77e6a..b46cea2f91 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -425,12 +425,10 @@ config SPL_MMC
 
 config ROCKCHIP_SPI_IMAGE
 	bool "Build a SPI image for rockchip"
-	depends on HAS_ROM
 	help
 	  Some Rockchip SoCs support booting from SPI flash. Enable this
-	  option to produce a 4MB SPI-flash image (called u-boot.rom)
-	  containing U-Boot. The image is built by binman. U-Boot sits near
-	  the start of the image.
+	  option to produce a SPI-flash image containing U-Boot. The image
+	  is built by binman. U-Boot sits near the start of the image.
 
 config LNX_KRNL_IMG_TEXT_OFFSET_BASE
 	default SYS_TEXT_BASE
-- 
2.37.1


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

* [PATCH v4 8/8] rockchip: add u-boot-rockchip-spi.bin image for booting from SPI-NOR flash
  2022-08-03 12:18 [PATCH v4 0/8] migrate u-boot-rockchip.bin to binman and generate an image for SPI Quentin Schulz
                   ` (6 preceding siblings ...)
  2022-08-03 12:19 ` [PATCH v4 7/8] rockchip: allow to build SPI images even without HAS_ROM option Quentin Schulz
@ 2022-08-03 12:19 ` Quentin Schulz
  2022-08-03 18:13   ` Simon Glass
  7 siblings, 1 reply; 17+ messages in thread
From: Quentin Schulz @ 2022-08-03 12:19 UTC (permalink / raw)
  Cc: bharat.gooty, rayagonda.kokatanur, sjg, philipp.tomsich,
	kever.yang, jagan, alpernebiyasak, xypron.glpk, heiko.thiery,
	u-boot, Quentin Schulz, Quentin Schulz

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

This new image is similar to u-boot-rockchip.bin except that it's
destined to be flashed on SPI-NOR flashes.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---

v3:
 - added filename property so that idblaoder-spi.img binary is generated
 by binman, as per community request,
 - added new temporary files to the list of files to clean up on `make
 clean`,

 Makefile                          |  3 ++-
 arch/arm/dts/rockchip-u-boot.dtsi | 30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 5fb470b0d8..eb8006ec18 100644
--- a/Makefile
+++ b/Makefile
@@ -2192,7 +2192,8 @@ CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \
 	       idbloader.img flash.bin flash.log defconfig keep-syms-lto.c \
 	       mkimage-out.spl.mkimage mkimage.spl.mkimage imx-boot.map \
 	       itb.fit.fit itb.fit.itb itb.map spl.map mkimage-out.rom.mkimage \
-	       mkimage.rom.mkimage rom.map simple-bin.map
+	       mkimage.rom.mkimage rom.map simple-bin.map simple-bin-spi.map \
+	       idbloader-spi.img
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include/generated spl tpl \
diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi
index f90a8bf085..584f21eb5b 100644
--- a/arch/arm/dts/rockchip-u-boot.dtsi
+++ b/arch/arm/dts/rockchip-u-boot.dtsi
@@ -39,5 +39,35 @@
 			offset = <CONFIG_SPL_PAD_TO>;
 		};
 	};
+
+#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
+	simple-bin-spi {
+		filename = "u-boot-rockchip-spi.bin";
+		pad-byte = <0xff>;
+
+		mkimage {
+			filename = "idbloader-spi.img";
+			args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
+#ifdef CONFIG_TPL
+			multiple-data-files;
+
+			u-boot-tpl {
+			};
+#endif
+			u-boot-spl {
+			};
+		};
+
+#ifdef CONFIG_ARM64
+		blob {
+			filename = "u-boot.itb";
+#else
+		u-boot-img {
+#endif
+			/* Sync with u-boot,spl-payload-offset if present */
+			offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>;
+		};
+	};
+#endif
 };
 #endif
-- 
2.37.1


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

* Re: [PATCH v4 2/8] binman: allow user-defined filenames for mkimage entry
  2022-08-03 12:19 ` [PATCH v4 2/8] binman: allow user-defined filenames for mkimage entry Quentin Schulz
@ 2022-08-03 18:13   ` Simon Glass
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Glass @ 2022-08-03 18:13 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: Bharat Gooty, Rayagonda Kokatanur, Philipp Tomsich, Kever Yang,
	Jagan Teki, Alper Nebi Yasak, Heinrich Schuchardt, Heiko Thiery,
	U-Boot Mailing List, Quentin Schulz

On Wed, 3 Aug 2022 at 06:19, Quentin Schulz <foss+uboot@0leil.net> wrote:
>
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> mkimage entry currently creates a file whose name is derived from the
> section name containing said entry.
>
> Let's allow the user to define a filename for the mkimage-generated
> binary by using the 'filename' DT property.
>
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>
> v4:
>  - added binman test,
>  - fixed >80 chars-long line,
>
> added in v3
>
>  tools/binman/etype/mkimage.py              |  9 ++++++--
>  tools/binman/ftest.py                      |  6 ++++++
>  tools/binman/test/235_mkimage_filename.dts | 24 ++++++++++++++++++++++
>  3 files changed, 37 insertions(+), 2 deletions(-)
>  create mode 100644 tools/binman/test/235_mkimage_filename.dts

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* Re: [PATCH v4 3/8] rockchip: remove binman temporary files when cleaning
  2022-08-03 12:19 ` [PATCH v4 3/8] rockchip: remove binman temporary files when cleaning Quentin Schulz
@ 2022-08-03 18:13   ` Simon Glass
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Glass @ 2022-08-03 18:13 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: Bharat Gooty, Rayagonda Kokatanur, Philipp Tomsich, Kever Yang,
	Jagan Teki, Alper Nebi Yasak, Heinrich Schuchardt, Heiko Thiery,
	U-Boot Mailing List, Quentin Schulz, Johan Jonker

On Wed, 3 Aug 2022 at 06:19, Quentin Schulz <foss+uboot@0leil.net> wrote:
>
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> Binman mkimage entry generates temporary files so let's remove them
> when calling `make clean`.
>
> Fixes: 9b312e26fc77 ("rockchip: Enable building a SPI ROM image on jerry")
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Reported-by: Johan Jonker <jbx6244@gmail.com>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>
> added in v3
>
>  Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

This is a stop gap. Really we need a way for binman to print out a
list of files it would generate, so we can use that for 'rm'.

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

* Re: [PATCH v4 6/8] rockchip: simplify binman image dependencies addition to INPUTS
  2022-08-03 12:19 ` [PATCH v4 6/8] rockchip: simplify binman image dependencies addition to INPUTS Quentin Schulz
@ 2022-08-03 18:13   ` Simon Glass
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Glass @ 2022-08-03 18:13 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: Bharat Gooty, Rayagonda Kokatanur, Philipp Tomsich, Kever Yang,
	Jagan Teki, Alper Nebi Yasak, Heinrich Schuchardt, Heiko Thiery,
	U-Boot Mailing List, Quentin Schulz

On Wed, 3 Aug 2022 at 06:19, Quentin Schulz <foss+uboot@0leil.net> wrote:
>
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> By factoring SPL check in the first condition, this makes the checks a
> bit less convoluted and more readable.
>
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>
> v4:
>  - fixed wrong place for endif for ARM32 boards,
>
>  Makefile | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* Re: [PATCH v4 7/8] rockchip: allow to build SPI images even without HAS_ROM option
  2022-08-03 12:19 ` [PATCH v4 7/8] rockchip: allow to build SPI images even without HAS_ROM option Quentin Schulz
@ 2022-08-03 18:13   ` Simon Glass
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Glass @ 2022-08-03 18:13 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: Bharat Gooty, Rayagonda Kokatanur, Philipp Tomsich, Kever Yang,
	Jagan Teki, Alper Nebi Yasak, Heinrich Schuchardt, Heiko Thiery,
	U-Boot Mailing List, Quentin Schulz

On Wed, 3 Aug 2022 at 06:19, Quentin Schulz <foss+uboot@0leil.net> wrote:
>
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> This prepares for the creation of a u-boot-rockchip-spi.bin image
> similar to u-boot-rockchip.bin to the exception it's destined for
> SPI-NOR flashes instead of MMC storage medium.
>
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>  arch/arm/dts/rk3288-u-boot.dtsi | 2 +-
>  arch/arm/dts/rk3399-u-boot.dtsi | 2 +-
>  arch/arm/mach-rockchip/Kconfig  | 6 ++----
>  3 files changed, 4 insertions(+), 6 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* Re: [PATCH v4 8/8] rockchip: add u-boot-rockchip-spi.bin image for booting from SPI-NOR flash
  2022-08-03 12:19 ` [PATCH v4 8/8] rockchip: add u-boot-rockchip-spi.bin image for booting from SPI-NOR flash Quentin Schulz
@ 2022-08-03 18:13   ` Simon Glass
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Glass @ 2022-08-03 18:13 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: Bharat Gooty, Rayagonda Kokatanur, Philipp Tomsich, Kever Yang,
	Jagan Teki, Alper Nebi Yasak, Heinrich Schuchardt, Heiko Thiery,
	U-Boot Mailing List, Quentin Schulz

On Wed, 3 Aug 2022 at 06:19, Quentin Schulz <foss+uboot@0leil.net> wrote:
>
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> This new image is similar to u-boot-rockchip.bin except that it's
> destined to be flashed on SPI-NOR flashes.
>
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>
> v3:
>  - added filename property so that idblaoder-spi.img binary is generated
>  by binman, as per community request,
>  - added new temporary files to the list of files to clean up on `make
>  clean`,
>
>  Makefile                          |  3 ++-
>  arch/arm/dts/rockchip-u-boot.dtsi | 30 ++++++++++++++++++++++++++++++
>  2 files changed, 32 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* Re: [PATCH v4 1/8] binman: add support for skipping file concatenation for mkimage
  2022-08-03 12:18 ` [PATCH v4 1/8] binman: add support for skipping file concatenation for mkimage Quentin Schulz
@ 2022-08-18  8:17   ` Simon Glass
  2022-08-24 16:29     ` Quentin Schulz
  0 siblings, 1 reply; 17+ messages in thread
From: Simon Glass @ 2022-08-18  8:17 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: Bharat Gooty, Rayagonda Kokatanur, Philipp Tomsich, Kever Yang,
	Jagan Teki, Alper Nebi Yasak, Heinrich Schuchardt, Heiko Thiery,
	U-Boot Mailing List, Quentin Schulz

Hi Quentin,

On Wed, 3 Aug 2022 at 06:19, Quentin Schulz <foss+uboot@0leil.net> wrote:
>
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> Some image types handled by mkimage require the datafiles to be passed
> independently (-d data1:data2) for specific handling of each. A
> concatenation of datafiles prior to passing them to mkimage wouldn't
> work.
>
> That is the case for rkspi for example which requires page alignment
> and only writing 2KB every 4KB.
>
> This adds the ability to tell binman to pass the datafiles without
> prior concatenation to mkimage, by adding the multiple-data-files
> boolean property to the mkimage node.
>
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>  tools/binman/entries.rst      | 22 +++++++++++++++++++
>  tools/binman/etype/mkimage.py | 41 +++++++++++++++++++++++++++++++----
>  2 files changed, 59 insertions(+), 4 deletions(-)

Somehow I missed this one, sorry.

It needs a test (try 'binman test -T' to see that it breaks code coverage).

Regards,
Simon

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

* Re: [PATCH v4 1/8] binman: add support for skipping file concatenation for mkimage
  2022-08-18  8:17   ` Simon Glass
@ 2022-08-24 16:29     ` Quentin Schulz
  2022-08-25  1:25       ` Simon Glass
  0 siblings, 1 reply; 17+ messages in thread
From: Quentin Schulz @ 2022-08-24 16:29 UTC (permalink / raw)
  To: Simon Glass, Quentin Schulz
  Cc: Bharat Gooty, Rayagonda Kokatanur, Philipp Tomsich, Kever Yang,
	Jagan Teki, Alper Nebi Yasak, Heinrich Schuchardt, Heiko Thiery,
	U-Boot Mailing List

Hi Simon,

On 8/18/22 10:17, Simon Glass wrote:
> Hi Quentin,
> 
> On Wed, 3 Aug 2022 at 06:19, Quentin Schulz <foss+uboot@0leil.net> wrote:
>>
>> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>>
>> Some image types handled by mkimage require the datafiles to be passed
>> independently (-d data1:data2) for specific handling of each. A
>> concatenation of datafiles prior to passing them to mkimage wouldn't
>> work.
>>
>> That is the case for rkspi for example which requires page alignment
>> and only writing 2KB every 4KB.
>>
>> This adds the ability to tell binman to pass the datafiles without
>> prior concatenation to mkimage, by adding the multiple-data-files
>> boolean property to the mkimage node.
>>
>> Cc: Quentin Schulz <foss+uboot@0leil.net>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>> ---
>>   tools/binman/entries.rst      | 22 +++++++++++++++++++
>>   tools/binman/etype/mkimage.py | 41 +++++++++++++++++++++++++++++++----
>>   2 files changed, 59 insertions(+), 4 deletions(-)
> 
> Somehow I missed this one, sorry.
> 
> It needs a test (try 'binman test -T' to see that it breaks code coverage).
> 

How do you see this test being implemented?

I think it'd be best to mock calls to mkimage (or 
self.mkimage.run_cmd()) and check that the -d parameter has two entries 
separated by a colon but my limited knowledge of unittest.mock does not 
seem to guide me to the proper implementation.

Another way would be to use a specific mkimage type that handles that 
kind of multiple files -d parameter and outputs something more or less 
reproducible, e.g. rkspi type. I don't like this too much even though 
it's much easier because we're bound to this type and the image type 
could change (I recall some endianness fixes a few months ago).

Cheers,
Quentin

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

* Re: [PATCH v4 1/8] binman: add support for skipping file concatenation for mkimage
  2022-08-24 16:29     ` Quentin Schulz
@ 2022-08-25  1:25       ` Simon Glass
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Glass @ 2022-08-25  1:25 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: Quentin Schulz, Bharat Gooty, Rayagonda Kokatanur,
	Philipp Tomsich, Kever Yang, Jagan Teki, Alper Nebi Yasak,
	Heinrich Schuchardt, Heiko Thiery, U-Boot Mailing List

Hi Quentin,

On Wed, 24 Aug 2022 at 09:29, Quentin Schulz
<quentin.schulz@theobroma-systems.com> wrote:
>
> Hi Simon,
>
> On 8/18/22 10:17, Simon Glass wrote:
> > Hi Quentin,
> >
> > On Wed, 3 Aug 2022 at 06:19, Quentin Schulz <foss+uboot@0leil.net> wrote:
> >>
> >> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> >>
> >> Some image types handled by mkimage require the datafiles to be passed
> >> independently (-d data1:data2) for specific handling of each. A
> >> concatenation of datafiles prior to passing them to mkimage wouldn't
> >> work.
> >>
> >> That is the case for rkspi for example which requires page alignment
> >> and only writing 2KB every 4KB.
> >>
> >> This adds the ability to tell binman to pass the datafiles without
> >> prior concatenation to mkimage, by adding the multiple-data-files
> >> boolean property to the mkimage node.
> >>
> >> Cc: Quentin Schulz <foss+uboot@0leil.net>
> >> Reviewed-by: Simon Glass <sjg@chromium.org>
> >> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> >> ---
> >>   tools/binman/entries.rst      | 22 +++++++++++++++++++
> >>   tools/binman/etype/mkimage.py | 41 +++++++++++++++++++++++++++++++----
> >>   2 files changed, 59 insertions(+), 4 deletions(-)
> >
> > Somehow I missed this one, sorry.
> >
> > It needs a test (try 'binman test -T' to see that it breaks code coverage).
> >
>
> How do you see this test being implemented?
>
> I think it'd be best to mock calls to mkimage (or
> self.mkimage.run_cmd()) and check that the -d parameter has two entries
> separated by a colon but my limited knowledge of unittest.mock does not
> seem to guide me to the proper implementation.
>
> Another way would be to use a specific mkimage type that handles that
> kind of multiple files -d parameter and outputs something more or less
> reproducible, e.g. rkspi type. I don't like this too much even though
> it's much easier because we're bound to this type and the image type
> could change (I recall some endianness fixes a few months ago).
>

You should be able to call mkimage for real and check that it does the
right thing by looking at the output, in a simple way.

See for example testMkimage() and let me know if you need any other hints.

Regards,
Simon

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

end of thread, other threads:[~2022-08-25  1:27 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03 12:18 [PATCH v4 0/8] migrate u-boot-rockchip.bin to binman and generate an image for SPI Quentin Schulz
2022-08-03 12:18 ` [PATCH v4 1/8] binman: add support for skipping file concatenation for mkimage Quentin Schulz
2022-08-18  8:17   ` Simon Glass
2022-08-24 16:29     ` Quentin Schulz
2022-08-25  1:25       ` Simon Glass
2022-08-03 12:19 ` [PATCH v4 2/8] binman: allow user-defined filenames for mkimage entry Quentin Schulz
2022-08-03 18:13   ` Simon Glass
2022-08-03 12:19 ` [PATCH v4 3/8] rockchip: remove binman temporary files when cleaning Quentin Schulz
2022-08-03 18:13   ` Simon Glass
2022-08-03 12:19 ` [PATCH v4 4/8] rockchip: generate idbloader.img content for u-boot-rockchip.bin with binman for ARM Quentin Schulz
2022-08-03 12:19 ` [PATCH v4 5/8] rockchip: generate u-boot-rockchip.bin with binman for ARM64 boards Quentin Schulz
2022-08-03 12:19 ` [PATCH v4 6/8] rockchip: simplify binman image dependencies addition to INPUTS Quentin Schulz
2022-08-03 18:13   ` Simon Glass
2022-08-03 12:19 ` [PATCH v4 7/8] rockchip: allow to build SPI images even without HAS_ROM option Quentin Schulz
2022-08-03 18:13   ` Simon Glass
2022-08-03 12:19 ` [PATCH v4 8/8] rockchip: add u-boot-rockchip-spi.bin image for booting from SPI-NOR flash Quentin Schulz
2022-08-03 18:13   ` Simon Glass

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.