All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] binman: Add support for generating more complex FITs
@ 2020-08-22  2:36 Simon Glass
  2020-08-22  2:36 ` [PATCH 1/7] binman: Allow entry args to be required Simon Glass
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Simon Glass @ 2020-08-22  2:36 UTC (permalink / raw)
  To: u-boot

This series allows binman to generate FITs that include multiple DTB
images and the configuration to use them.

It is then possible to remove the sunxi FIT generator script, so this
series handles that also.

With this, sunxi is fully converted to use binman.


Simon Glass (7):
  binman: Allow entry args to be required
  binman: Fix up a few missing comments
  libfdt: Detected out-of-space with fdt_finish()
  binman: Add support for ATF BL31
  binman: Support generating FITs with multiple dtbs
  sunxi: Convert 64-bit boards to use binman
  sunxi: Drop the FIT-generator script

 Kconfig                                 |   3 +-
 Makefile                                |  18 +---
 arch/arm/dts/sunxi-u-boot.dtsi          |  60 +++++++++++-
 board/sunxi/mksunxi_fit_atf.sh          |  87 -----------------
 scripts/dtc/pylibfdt/libfdt.i_shipped   |   3 +-
 tools/binman/README.entries             |  59 ++++++++++-
 tools/binman/etype/atf_bl31.py          |  20 ++++
 tools/binman/etype/blob_named_by_arg.py |  10 +-
 tools/binman/etype/cros_ec_rw.py        |   3 +-
 tools/binman/etype/fit.py               |  76 +++++++++++++--
 tools/binman/ftest.py                   | 124 ++++++++++++++++++++++--
 tools/binman/test/165_atf_bl31.dts      |  16 +++
 tools/binman/test/166_fit_fdt.dts       |  55 +++++++++++
 13 files changed, 405 insertions(+), 129 deletions(-)
 delete mode 100755 board/sunxi/mksunxi_fit_atf.sh
 create mode 100644 tools/binman/etype/atf_bl31.py
 create mode 100644 tools/binman/test/165_atf_bl31.dts
 create mode 100644 tools/binman/test/166_fit_fdt.dts

-- 
2.28.0.297.g1956fa8f8d-goog

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

* [PATCH 1/7] binman: Allow entry args to be required
  2020-08-22  2:36 [PATCH 0/7] binman: Add support for generating more complex FITs Simon Glass
@ 2020-08-22  2:36 ` Simon Glass
  2020-08-22  2:36 ` [PATCH 2/7] binman: Fix up a few missing comments Simon Glass
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Simon Glass @ 2020-08-22  2:36 UTC (permalink / raw)
  To: u-boot

If an entry argument is needed by an entry but the entry argument is not
present, then a strange error can occur when trying to read the file.

Fix this by allowing arguments to be required. Select this option for the
cros-ec-rw entry. If a filename is provided in the node, allow that to be
used.

Also tidy up a few related tests to make the error string easier to find,
and fully ignore unused return values.

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

 tools/binman/README.entries             |  7 ++++++-
 tools/binman/etype/blob_named_by_arg.py | 10 ++++++----
 tools/binman/etype/cros_ec_rw.py        |  3 +--
 tools/binman/ftest.py                   | 15 +++++++++++----
 4 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index bf8edce02b4..97bfae16116 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -60,7 +60,7 @@ Entry: blob-named-by-arg: A blob entry which gets its filename property from its
 
 Properties / Entry arguments:
     - <xxx>-path: Filename containing the contents of this entry (optional,
-        defaults to 0)
+        defaults to None)
 
 where <xxx> is the blob_fname argument to the constructor.
 
@@ -691,6 +691,11 @@ Properties / Entry arguments: (see binman README for more information)
     name-prefix: Adds a prefix to the name of every entry in the section
         when writing out the map
 
+Properties:
+    _allow_missing: True if this section permits external blobs to be
+        missing their contents. The second will produce an image but of
+        course it will not work.
+
 Since a section is also an entry, it inherits all the properies of entries
 too.
 
diff --git a/tools/binman/etype/blob_named_by_arg.py b/tools/binman/etype/blob_named_by_arg.py
index e95dabe4d07..7c486b2dc91 100644
--- a/tools/binman/etype/blob_named_by_arg.py
+++ b/tools/binman/etype/blob_named_by_arg.py
@@ -17,7 +17,7 @@ class Entry_blob_named_by_arg(Entry_blob):
 
     Properties / Entry arguments:
         - <xxx>-path: Filename containing the contents of this entry (optional,
-            defaults to 0)
+            defaults to None)
 
     where <xxx> is the blob_fname argument to the constructor.
 
@@ -28,7 +28,9 @@ class Entry_blob_named_by_arg(Entry_blob):
 
     See cros_ec_rw for an example of this.
     """
-    def __init__(self, section, etype, node, blob_fname):
+    def __init__(self, section, etype, node, blob_fname, required=False):
         super().__init__(section, etype, node)
-        self._filename, = self.GetEntryArgsOrProps(
-            [EntryArg('%s-path' % blob_fname, str)])
+        filename, = self.GetEntryArgsOrProps(
+            [EntryArg('%s-path' % blob_fname, str)], required=required)
+        if filename:
+            self._filename = filename
diff --git a/tools/binman/etype/cros_ec_rw.py b/tools/binman/etype/cros_ec_rw.py
index 741372e1af4..bf676b2d1a7 100644
--- a/tools/binman/etype/cros_ec_rw.py
+++ b/tools/binman/etype/cros_ec_rw.py
@@ -7,7 +7,6 @@
 
 from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
 
-
 class Entry_cros_ec_rw(Entry_blob_named_by_arg):
     """A blob entry which contains a Chromium OS read-write EC image
 
@@ -18,5 +17,5 @@ class Entry_cros_ec_rw(Entry_blob_named_by_arg):
     updating the EC on startup via software sync.
     """
     def __init__(self, section, etype, node):
-        super().__init__(section, etype, node, 'cros-ec-rw')
+        super().__init__(section, etype, node, 'cros-ec-rw', required=True)
         self.external = True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index bf7f59fb841..258296f2459 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1383,8 +1383,9 @@ class TestFunctional(unittest.TestCase):
         }
         with self.assertRaises(ValueError) as e:
             self._DoReadFileDtb('064_entry_args_required.dts')
-        self.assertIn("Node '/binman/_testing': Missing required "
-            'properties/entry args: test-str-arg, test-int-fdt, test-int-arg',
+        self.assertIn("Node '/binman/_testing': "
+            'Missing required properties/entry args: test-str-arg, '
+            'test-int-fdt, test-int-arg',
             str(e.exception))
 
     def testEntryArgsInvalidFormat(self):
@@ -1488,8 +1489,7 @@ class TestFunctional(unittest.TestCase):
         entry_args = {
             'cros-ec-rw-path': 'ecrw.bin',
         }
-        data, _, _, _ = self._DoReadFileDtb('068_blob_named_by_arg.dts',
-                                            entry_args=entry_args)
+        self._DoReadFileDtb('068_blob_named_by_arg.dts', entry_args=entry_args)
 
     def testFill(self):
         """Test for an fill entry type"""
@@ -3478,5 +3478,12 @@ class TestFunctional(unittest.TestCase):
         fnode = dtb.GetNode('/images/kernel')
         self.assertNotIn('data', fnode.props)
 
+    def testBlobNamedByArgMissing(self):
+        """Test handling of a missing entry arg"""
+        with self.assertRaises(ValueError) as e:
+            self._DoReadFile('068_blob_named_by_arg.dts')
+        self.assertIn("Missing required properties/entry args: cros-ec-rw-path",
+                      str(e.exception))
+
 if __name__ == "__main__":
     unittest.main()
-- 
2.28.0.297.g1956fa8f8d-goog

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

* [PATCH 2/7] binman: Fix up a few missing comments
  2020-08-22  2:36 [PATCH 0/7] binman: Add support for generating more complex FITs Simon Glass
  2020-08-22  2:36 ` [PATCH 1/7] binman: Allow entry args to be required Simon Glass
@ 2020-08-22  2:36 ` Simon Glass
  2020-08-22  2:36 ` [PATCH 3/7] libfdt: Detected out-of-space with fdt_finish() Simon Glass
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Simon Glass @ 2020-08-22  2:36 UTC (permalink / raw)
  To: u-boot

Tidy up a few test functions which lack argument comments. Rename one that
has the same name as a different test.

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

 tools/binman/ftest.py | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 258296f2459..8d687162185 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -299,6 +299,13 @@ class TestFunctional(unittest.TestCase):
                 key: arg name
                 value: value of that arg
             images: List of image names to build
+            use_real_dtb: True to use the test file as the contents of
+                the u-boot-dtb entry. Normally this is not needed and the
+                test contents (the U_BOOT_DTB_DATA string) can be used.
+                But in some test we need the real contents.
+            verbosity: Verbosity level to use (0-3, None=don't set it)
+            allow_missing: Set the '--allow-missing' flag so that missing
+                external binaries just produce a warning instead of an error
         """
         args = []
         if debug:
@@ -358,6 +365,13 @@ class TestFunctional(unittest.TestCase):
         We still want the DTBs for SPL and TPL to be different though, since
         otherwise it is confusing to know which one we are looking at. So add
         an 'spl' or 'tpl' property to the top-level node.
+
+        Args:
+            dtb_data: dtb data to modify (this should be a value devicetree)
+            name: Name of a new property to add
+
+        Returns:
+            New dtb data with the property added
         """
         dtb = fdt.Fdt.FromData(dtb_data)
         dtb.Scan()
@@ -385,6 +399,12 @@ class TestFunctional(unittest.TestCase):
             map: True to output map files for the images
             update_dtb: Update the offset and size of each entry in the device
                 tree before packing it into the image
+            entry_args: Dict of entry args to supply to binman
+                key: arg name
+                value: value of that arg
+            reset_dtbs: With use_real_dtb the test dtb is overwritten by this
+                function. If reset_dtbs is True, then the original test dtb
+                is written back before this function finishes
 
         Returns:
             Tuple:
@@ -3468,7 +3488,7 @@ class TestFunctional(unittest.TestCase):
         self.assertEqual(len(U_BOOT_SPL_DTB_DATA), int(data_sizes[1].split()[0]))
 
     def testFitExternal(self):
-        """Test an image with an FIT"""
+        """Test an image with an FIT with external images"""
         data = self._DoReadFile('162_fit_external.dts')
         fit_data = data[len(U_BOOT_DATA):-2]  # _testing is 2 bytes
 
-- 
2.28.0.297.g1956fa8f8d-goog

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

* [PATCH 3/7] libfdt: Detected out-of-space with fdt_finish()
  2020-08-22  2:36 [PATCH 0/7] binman: Add support for generating more complex FITs Simon Glass
  2020-08-22  2:36 ` [PATCH 1/7] binman: Allow entry args to be required Simon Glass
  2020-08-22  2:36 ` [PATCH 2/7] binman: Fix up a few missing comments Simon Glass
@ 2020-08-22  2:36 ` Simon Glass
  2020-08-22  2:36 ` [PATCH 4/7] binman: Add support for ATF BL31 Simon Glass
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Simon Glass @ 2020-08-22  2:36 UTC (permalink / raw)
  To: u-boot

At present the Python sequential-write interface can produce an error when
it calls fdt_finish(), since this needs to add a terminating tag to the
end of the struct section.

Fix this by automatically expanding the buffer if needed.

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

 scripts/dtc/pylibfdt/libfdt.i_shipped | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/dtc/pylibfdt/libfdt.i_shipped b/scripts/dtc/pylibfdt/libfdt.i_shipped
index fae0b27d7d0..1d69ad38e2e 100644
--- a/scripts/dtc/pylibfdt/libfdt.i_shipped
+++ b/scripts/dtc/pylibfdt/libfdt.i_shipped
@@ -786,7 +786,8 @@ class FdtSw(FdtRo):
             Fdt object allowing access to the newly created device tree
         """
         fdtsw = bytearray(self._fdt)
-        check_err(fdt_finish(fdtsw))
+        while self.check_space(fdt_finish(fdtsw)):
+            fdtsw = bytearray(self._fdt)
         return Fdt(fdtsw)
 
     def check_space(self, val):
-- 
2.28.0.297.g1956fa8f8d-goog

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

* [PATCH 4/7] binman: Add support for ATF BL31
  2020-08-22  2:36 [PATCH 0/7] binman: Add support for generating more complex FITs Simon Glass
                   ` (2 preceding siblings ...)
  2020-08-22  2:36 ` [PATCH 3/7] libfdt: Detected out-of-space with fdt_finish() Simon Glass
@ 2020-08-22  2:36 ` Simon Glass
  2020-08-25  2:44   ` Kever Yang
                     ` (2 more replies)
  2020-08-22  2:36 ` [PATCH 5/7] binman: Support generating FITs with multiple dtbs Simon Glass
                   ` (3 subsequent siblings)
  7 siblings, 3 replies; 19+ messages in thread
From: Simon Glass @ 2020-08-22  2:36 UTC (permalink / raw)
  To: u-boot

Add an entry for ARM Trusted Firmware's 'BL31' payload, which is the
device's main firmware. Typically this is U-Boot.

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

 tools/binman/README.entries        | 10 ++++++++++
 tools/binman/etype/atf_bl31.py     | 20 ++++++++++++++++++++
 tools/binman/ftest.py              |  9 +++++++++
 tools/binman/test/165_atf_bl31.dts | 16 ++++++++++++++++
 4 files changed, 55 insertions(+)
 create mode 100644 tools/binman/etype/atf_bl31.py
 create mode 100644 tools/binman/test/165_atf_bl31.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 97bfae16116..85b8ec9fa73 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -11,6 +11,16 @@ features to produce new behaviours.
 
 
 
+Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF) BL31 blob
+-------------------------------------------------------------------------
+
+Properties / Entry arguments:
+    - atf-bl31-path: Filename of file to read into entry
+
+This entry holds the run-time firmware started by ATF.
+
+
+
 Entry: blob: Entry containing an arbitrary binary blob
 ------------------------------------------------------
 
diff --git a/tools/binman/etype/atf_bl31.py b/tools/binman/etype/atf_bl31.py
new file mode 100644
index 00000000000..fd7223843b1
--- /dev/null
+++ b/tools/binman/etype/atf_bl31.py
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for Intel Management Engine binary blob
+#
+
+from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+
+class Entry_atf_bl31(Entry_blob_named_by_arg):
+    """Entry containing an ARM Trusted Firmware (ATF) BL31 blob
+
+    Properties / Entry arguments:
+        - atf-bl31-path: Filename of file to read into entry
+
+    This entry holds the run-time firmware started by ATF.
+    """
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node, 'atf-bl31')
+        self.external = True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 8d687162185..30c9c764327 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -75,6 +75,7 @@ REFCODE_DATA          = b'refcode'
 FSP_M_DATA            = b'fsp_m'
 FSP_S_DATA            = b'fsp_s'
 FSP_T_DATA            = b'fsp_t'
+ATF_BL31_DATA         = b'bl31'
 
 # The expected size for the device tree in some tests
 EXTRACT_DTB_SIZE = 0x3c9
@@ -168,6 +169,7 @@ class TestFunctional(unittest.TestCase):
                         os.path.join(cls._indir, 'files'))
 
         TestFunctional._MakeInputFile('compress', COMPRESS_DATA)
+        TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA)
 
         # Travis-CI may have an old lz4
         cls.have_lz4 = True
@@ -3505,5 +3507,12 @@ class TestFunctional(unittest.TestCase):
         self.assertIn("Missing required properties/entry args: cros-ec-rw-path",
                       str(e.exception))
 
+    def testPackBl31(self):
+        """Test that an image with an ATF BL31 binary can be created"""
+        data = self._DoReadFile('165_atf_bl31.dts')
+        self.assertEqual(ATF_BL31_DATA, data[:len(ATF_BL31_DATA)])
+
+ATF_BL31_DATA
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/165_atf_bl31.dts b/tools/binman/test/165_atf_bl31.dts
new file mode 100644
index 00000000000..2b7547d70f9
--- /dev/null
+++ b/tools/binman/test/165_atf_bl31.dts
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		size = <16>;
+
+		atf-bl31 {
+			filename = "bl31.bin";
+		};
+	};
+};
-- 
2.28.0.297.g1956fa8f8d-goog

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

* [PATCH 5/7] binman: Support generating FITs with multiple dtbs
  2020-08-22  2:36 [PATCH 0/7] binman: Add support for generating more complex FITs Simon Glass
                   ` (3 preceding siblings ...)
  2020-08-22  2:36 ` [PATCH 4/7] binman: Add support for ATF BL31 Simon Glass
@ 2020-08-22  2:36 ` Simon Glass
  2020-08-22  2:36 ` [PATCH 6/7] sunxi: Convert 64-bit boards to use binman Simon Glass
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Simon Glass @ 2020-08-22  2:36 UTC (permalink / raw)
  To: u-boot

In some cases it is useful to generate a FIT which has a number of DTB
images, selectable by configuration. Add support for this in binman,
using a simple iterator and string substitution.

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

 tools/binman/README.entries       | 42 +++++++++++++++-
 tools/binman/etype/fit.py         | 76 ++++++++++++++++++++++++++---
 tools/binman/ftest.py             | 80 +++++++++++++++++++++++++++++--
 tools/binman/test/166_fit_fdt.dts | 55 +++++++++++++++++++++
 4 files changed, 242 insertions(+), 11 deletions(-)
 create mode 100644 tools/binman/test/166_fit_fdt.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 85b8ec9fa73..2bf7655b7f0 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -335,6 +335,7 @@ For example, this creates an image containing a FIT with U-Boot SPL:
     binman {
         fit {
             description = "Test FIT";
+            fit,fdt-list = "of-list";
 
             images {
                 kernel at 1 {
@@ -353,7 +354,46 @@ For example, this creates an image containing a FIT with U-Boot SPL:
         };
     };
 
-Properties:
+U-Boot supports creating fdt and config nodes automatically. To do this,
+pass an of-list property (e.g. -a of-list=file1 file2). This tells binman
+that you want to generates nodes for two files: file1.dtb and file2.dtb
+The fit,fdt-list property (see above) indicates that of-list should be used.
+
+Then add a 'generator node', a node with a name starting with '@':
+
+    @fdt-SEQ {
+        description = "fdt-NAME";
+        type = "flat_dt";
+        compression = "none";
+    };
+
+This tells binman to create nodes fdt-1 and fdt-2 for each of your two
+files. All the properties you specify will be included in the node. This
+node acts like a template to generate the nodes. The generator node itself
+does not appear in the output - it is replaced with what binman generates.
+
+You can create config nodes in a similar way:
+
+    @config-SEQ {
+        description = "NAME";
+        firmware = "uboot";
+        loadables = "atf";
+        fdt = "fdt-SEQ";
+    };
+
+This tells binman to create nodes config-1 and config-2, i.e. a config for
+each of your two files.
+
+Available substitutions for '@' nodes are:
+
+    SEQ    Sequence number of the generated fdt (1, 2, ...)
+    NAME   Name of the dtb as provided (i.e. without adding '.dtb')
+
+Note that if no device tree files are provided (with '-a of-list' as above)
+then no nodes will be generated.
+
+
+Properties (in the 'fit' node itself):
     fit,external-offset: Indicates that the contents of the FIT are external
         and provides the external offset. This is passsed to mkimage via
         the -E and -p flags.
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index 75712f44092..e45a99dfd73 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -8,7 +8,7 @@
 from collections import defaultdict, OrderedDict
 import libfdt
 
-from binman.entry import Entry
+from binman.entry import Entry, EntryArg
 from dtoc import fdt_util
 from dtoc.fdt import Fdt
 from patman import tools
@@ -27,6 +27,7 @@ class Entry_fit(Entry):
         binman {
             fit {
                 description = "Test FIT";
+                fit,fdt-list = "of-list";
 
                 images {
                     kernel at 1 {
@@ -45,7 +46,46 @@ class Entry_fit(Entry):
             };
         };
 
-    Properties:
+    U-Boot supports creating fdt and config nodes automatically. To do this,
+    pass an of-list property (e.g. -a of-list=file1 file2). This tells binman
+    that you want to generates nodes for two files: file1.dtb and file2.dtb
+    The fit,fdt-list property (see above) indicates that of-list should be used.
+
+    Then add a 'generator node', a node with a name starting with '@':
+
+        @fdt-SEQ {
+            description = "fdt-NAME";
+            type = "flat_dt";
+            compression = "none";
+        };
+
+    This tells binman to create nodes fdt-1 and fdt-2 for each of your two
+    files. All the properties you specify will be included in the node. This
+    node acts like a template to generate the nodes. The generator node itself
+    does not appear in the output - it is replaced with what binman generates.
+
+    You can create config nodes in a similar way:
+
+        @config-SEQ {
+            description = "NAME";
+            firmware = "uboot";
+            loadables = "atf";
+            fdt = "fdt-SEQ";
+        };
+
+    This tells binman to create nodes config-1 and config-2, i.e. a config for
+    each of your two files.
+
+    Available substitutions for '@' nodes are:
+
+        SEQ    Sequence number of the generated fdt (1, 2, ...)
+        NAME   Name of the dtb as provided (i.e. without adding '.dtb')
+
+    Note that if no device tree files are provided (with '-a of-list' as above)
+    then no nodes will be generated.
+
+
+    Properties (in the 'fit' node itself):
         fit,external-offset: Indicates that the contents of the FIT are external
             and provides the external offset. This is passsed to mkimage via
             the -E and -p flags.
@@ -64,6 +104,15 @@ class Entry_fit(Entry):
         self._fit = None
         self._fit_content = defaultdict(list)
         self._fit_props = {}
+        for pname, prop in self._node.props.items():
+            if pname.startswith('fit,'):
+                self._fit_props[pname] = prop
+
+        self._fdts = []
+        list_prop = self._fit_props.get('fit,fdt-list')
+        if list_prop:
+            fdts, = self.GetEntryArgsOrProps([EntryArg(list_prop.value, str)])
+            self._fdts = fdts and fdts.split() or []
 
     def ReadNode(self):
         self._ReadSubnodes()
@@ -84,13 +133,12 @@ class Entry_fit(Entry):
                   image
             """
             for pname, prop in node.props.items():
-                if pname.startswith('fit,'):
-                    self._fit_props[pname] = prop
-                else:
+                if not pname.startswith('fit,'):
                     fsw.property(pname, prop.bytes)
 
             rel_path = node.path[len(base_node.path):]
-            has_images = depth == 2 and rel_path.startswith('/images/')
+            in_images = rel_path.startswith('/images')
+            has_images = depth == 2 and in_images
             for subnode in node.subnodes:
                 if has_images and not (subnode.name.startswith('hash') or
                                        subnode.name.startswith('signature')):
@@ -100,6 +148,22 @@ class Entry_fit(Entry):
                     entry = Entry.Create(self.section, subnode)
                     entry.ReadNode()
                     self._fit_content[rel_path].append(entry)
+                elif subnode.name.startswith('@'):
+                    for seq, fdt_fname in enumerate(self._fdts):
+                        node_name = subnode.name[1:].replace('SEQ',
+                                                             str(seq + 1))
+                        fname = tools.GetInputFilename(fdt_fname + '.dtb')
+                        with fsw.add_node(node_name):
+                            for pname, prop in subnode.props.items():
+                                val = prop.bytes.replace(
+                                    b'NAME', tools.ToBytes(fdt_fname))
+                                val = val.replace(b'SEQ',
+                                                  tools.ToBytes(str(seq + 1)))
+                                fsw.property(pname, val)
+
+                                # Add data for 'fdt' nodes (but not 'config')
+                                if depth == 1 and in_images:
+                                    fsw.property('data', tools.ReadFile(fname))
                 else:
                     with fsw.add_node(subnode.name):
                         _AddNode(base_node, depth + 1, subnode)
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 30c9c764327..67b86276724 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -76,6 +76,11 @@ FSP_M_DATA            = b'fsp_m'
 FSP_S_DATA            = b'fsp_s'
 FSP_T_DATA            = b'fsp_t'
 ATF_BL31_DATA         = b'bl31'
+TEST_FDT1_DATA        = b'fdt1'
+TEST_FDT2_DATA        = b'test-fdt2'
+
+# Subdirectory of the input dir to use to put test FDTs
+TEST_FDT_SUBDIR       = 'fdts'
 
 # The expected size for the device tree in some tests
 EXTRACT_DTB_SIZE = 0x3c9
@@ -171,6 +176,12 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('compress', COMPRESS_DATA)
         TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA)
 
+        # Add a few .dtb files for testing
+        TestFunctional._MakeInputFile('%s/test-fdt1.dtb' % TEST_FDT_SUBDIR,
+                                      TEST_FDT1_DATA)
+        TestFunctional._MakeInputFile('%s/test-fdt2.dtb' % TEST_FDT_SUBDIR,
+                                      TEST_FDT2_DATA)
+
         # Travis-CI may have an old lz4
         cls.have_lz4 = True
         try:
@@ -288,7 +299,7 @@ class TestFunctional(unittest.TestCase):
 
     def _DoTestFile(self, fname, debug=False, map=False, update_dtb=False,
                     entry_args=None, images=None, use_real_dtb=False,
-                    verbosity=None, allow_missing=False):
+                    verbosity=None, allow_missing=False, extra_indirs=None):
         """Run binman with a given test file
 
         Args:
@@ -308,6 +319,7 @@ class TestFunctional(unittest.TestCase):
             verbosity: Verbosity level to use (0-3, None=don't set it)
             allow_missing: Set the '--allow-missing' flag so that missing
                 external binaries just produce a warning instead of an error
+            extra_indirs: Extra input directories to add using -I
         """
         args = []
         if debug:
@@ -334,6 +346,9 @@ class TestFunctional(unittest.TestCase):
         if images:
             for image in images:
                 args += ['-i', image]
+        if extra_indirs:
+            for indir in extra_indirs:
+                args += ['-I', indir]
         return self._DoBinman(*args)
 
     def _SetupDtb(self, fname, outfile='u-boot.dtb'):
@@ -383,7 +398,8 @@ class TestFunctional(unittest.TestCase):
         return dtb.GetContents()
 
     def _DoReadFileDtb(self, fname, use_real_dtb=False, map=False,
-                       update_dtb=False, entry_args=None, reset_dtbs=True):
+                       update_dtb=False, entry_args=None, reset_dtbs=True,
+                       extra_indirs=None):
         """Run binman and return the resulting image
 
         This runs binman with a given test file and then reads the resulting
@@ -407,6 +423,7 @@ class TestFunctional(unittest.TestCase):
             reset_dtbs: With use_real_dtb the test dtb is overwritten by this
                 function. If reset_dtbs is True, then the original test dtb
                 is written back before this function finishes
+            extra_indirs: Extra input directories to add using -I
 
         Returns:
             Tuple:
@@ -430,7 +447,8 @@ class TestFunctional(unittest.TestCase):
 
         try:
             retcode = self._DoTestFile(fname, map=map, update_dtb=update_dtb,
-                    entry_args=entry_args, use_real_dtb=use_real_dtb)
+                    entry_args=entry_args, use_real_dtb=use_real_dtb,
+                    extra_indirs=extra_indirs)
             self.assertEqual(0, retcode)
             out_dtb_fname = tools.GetOutputFilename('u-boot.dtb.out')
 
@@ -3512,7 +3530,61 @@ class TestFunctional(unittest.TestCase):
         data = self._DoReadFile('165_atf_bl31.dts')
         self.assertEqual(ATF_BL31_DATA, data[:len(ATF_BL31_DATA)])
 
-ATF_BL31_DATA
+    def testFitFdt(self):
+        """Test an image with an FIT with multiple FDT images"""
+        def _CheckFdt(seq, expected_data):
+            """Check the FDT nodes
+
+            Args:
+                seq: Sequence number to check (0 or 1)
+                expected_data: Expected contents of 'data' property
+            """
+            name = 'fdt-%d' % seq
+            fnode = dtb.GetNode('/images/%s' % name)
+            self.assertIsNotNone(fnode)
+            self.assertEqual({'description','type', 'compression', 'data'},
+                             set(fnode.props.keys()))
+            self.assertEqual(expected_data, fnode.props['data'].bytes)
+            self.assertEqual('fdt-test-fdt%d.dtb' % seq,
+                             fnode.props['description'].value)
+        def _CheckConfig(seq, expected_data):
+            """Check the configuration nodes
+
+            Args:
+                seq: Sequence number to check (0 or 1)
+                expected_data: Expected contents of 'data' property
+            """
+            name = 'config-%d' % seq
+            fnode = dtb.GetNode('/configurations/%s' % name)
+            self.assertIsNotNone(fnode)
+            self.assertEqual({'description','firmware', 'loadables', 'fdt'},
+                             set(fnode.props.keys()))
+            self.assertEqual('conf-test-fdt%d.dtb' % seq,
+                             fnode.props['description'].value)
+            self.assertEqual('fdt-%d' % seq, fnode.props['fdt'].value)
+
+        entry_args = {
+            'of-list': 'test-fdt1 test-fdt2',
+        }
+        data = self._DoReadFileDtb(
+            '166_fit_fdt.dts',
+            entry_args=entry_args,
+            extra_indirs=[os.path.join(self._indir, TEST_FDT_SUBDIR)])[0]
+        self.assertEqual(U_BOOT_NODTB_DATA, data[-len(U_BOOT_NODTB_DATA):])
+        fit_data = data[len(U_BOOT_DATA):-len(U_BOOT_NODTB_DATA)]
+
+        dtb = fdt.Fdt.FromData(fit_data)
+        dtb.Scan()
+        fnode = dtb.GetNode('/images/kernel')
+        self.assertIn('data', fnode.props)
+
+        # Check all the properties in fdt-1 and fdt-2
+        _CheckFdt(1, TEST_FDT1_DATA)
+        _CheckFdt(2, TEST_FDT2_DATA)
+
+        # Check configurations
+        _CheckConfig(1, TEST_FDT1_DATA)
+        _CheckConfig(2, TEST_FDT2_DATA)
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/166_fit_fdt.dts b/tools/binman/test/166_fit_fdt.dts
new file mode 100644
index 00000000000..89142e91017
--- /dev/null
+++ b/tools/binman/test/166_fit_fdt.dts
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		u-boot {
+		};
+		fit {
+			description = "test-desc";
+			#address-cells = <1>;
+			fit,fdt-list = "of-list";
+
+			images {
+				kernel {
+					description = "Vanilla Linux kernel";
+					type = "kernel";
+					arch = "ppc";
+					os = "linux";
+					compression = "gzip";
+					load = <00000000>;
+					entry = <00000000>;
+					hash-1 {
+						algo = "crc32";
+					};
+					hash-2 {
+						algo = "sha1";
+					};
+					u-boot {
+					};
+				};
+				@fdt-SEQ {
+					description = "fdt-NAME.dtb";
+					type = "flat_dt";
+					compression = "none";
+				};
+			};
+
+			configurations {
+				default = "config-1";
+				@config-SEQ {
+					description = "conf-NAME.dtb";
+					firmware = "uboot";
+					loadables = "atf";
+					fdt = "fdt-SEQ";
+				};
+			};
+		};
+		u-boot-nodtb {
+		};
+	};
+};
-- 
2.28.0.297.g1956fa8f8d-goog

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

* [PATCH 6/7] sunxi: Convert 64-bit boards to use binman
  2020-08-22  2:36 [PATCH 0/7] binman: Add support for generating more complex FITs Simon Glass
                   ` (4 preceding siblings ...)
  2020-08-22  2:36 ` [PATCH 5/7] binman: Support generating FITs with multiple dtbs Simon Glass
@ 2020-08-22  2:36 ` Simon Glass
  2020-08-22  2:36 ` [PATCH 7/7] sunxi: Drop the FIT-generator script Simon Glass
  2020-08-25  4:07 ` [PATCH 0/7] binman: Add support for generating more complex FITs Heinrich Schuchardt
  7 siblings, 0 replies; 19+ messages in thread
From: Simon Glass @ 2020-08-22  2:36 UTC (permalink / raw)
  To: u-boot

At present 64-bit sunxi board use the Makefile to create a FIT, using
USE_SPL_FIT_GENERATOR. This is deprecated.

Update sunxi to use binman instead.

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

 Kconfig                        |  3 +-
 Makefile                       | 18 ++--------
 arch/arm/dts/sunxi-u-boot.dtsi | 60 +++++++++++++++++++++++++++++++++-
 3 files changed, 62 insertions(+), 19 deletions(-)

diff --git a/Kconfig b/Kconfig
index 883e3f71d01..837b2f517ae 100644
--- a/Kconfig
+++ b/Kconfig
@@ -659,12 +659,11 @@ config SPL_FIT_SOURCE
 
 config USE_SPL_FIT_GENERATOR
 	bool "Use a script to generate the .its script"
-	default y if SPL_FIT
+	default y if SPL_FIT && !ARCH_SUNXI
 
 config SPL_FIT_GENERATOR
 	string ".its file generator script for U-Boot FIT image"
 	depends on USE_SPL_FIT_GENERATOR
-	default "board/sunxi/mksunxi_fit_atf.sh" if SPL_LOAD_FIT && ARCH_SUNXI
 	default "arch/arm/mach-rockchip/make_fit_atf.py" if SPL_LOAD_FIT && ARCH_ROCKCHIP
 	default "arch/arm/mach-zynqmp/mkimage_fit_atf.sh" if SPL_LOAD_FIT && ARCH_ZYNQMP
 	default "arch/riscv/lib/mkimage_fit_opensbi.sh" if SPL_LOAD_FIT && RISCV
diff --git a/Makefile b/Makefile
index d9a08818cda..8e175bd0b40 100644
--- a/Makefile
+++ b/Makefile
@@ -923,11 +923,6 @@ INPUTS-$(CONFIG_REMAKE_ELF) += u-boot.elf
 INPUTS-$(CONFIG_EFI_APP) += u-boot-app.efi
 INPUTS-$(CONFIG_EFI_STUB) += u-boot-payload.efi
 
-# Build a combined spl + u-boot image for sunxi
-ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_ARM64)$(CONFIG_SPL),yyy)
-INPUTS-y += u-boot-sunxi-with-spl.bin
-endif
-
 # Generate this input file for binman
 ifeq ($(CONFIG_SPL),)
 INPUTS-$(CONFIG_ARCH_MEDIATEK) += u-boot-mtk.bin
@@ -1024,13 +1019,9 @@ PHONY += inputs
 inputs: $(INPUTS-y)
 
 all: .binman_stamp inputs
-# Hack for sunxi which doesn't have a proper binman definition for
-# 64-bit boards
-ifneq ($(CONFIG_ARCH_SUNXI)$(CONFIG_ARM64),yy)
 ifeq ($(CONFIG_BINMAN),y)
 	$(call if_changed,binman)
 endif
-endif
 
 # Timestamp file to make sure that binman always runs
 .binman_stamp: FORCE
@@ -1337,6 +1328,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
 		build -u -d u-boot.dtb -O . \
 		$(if $(BUILD_ROM),,-m --allow-missing) \
 		-I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+		-I arch/$(ARCH)/dts -a of-list=$(CONFIG_OF_LIST) \
+		-a atf-bl31-path=${BL31} \
 		$(BINMAN_$(@F))
 
 OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex
@@ -1626,13 +1619,6 @@ u-boot-x86-reset16.bin: u-boot FORCE
 
 endif # CONFIG_X86
 
-ifneq ($(CONFIG_ARCH_SUNXI),)
-ifeq ($(CONFIG_ARM64),y)
-u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb FORCE
-	$(call if_changed,cat)
-endif
-endif
-
 OBJCOPYFLAGS_u-boot-app.efi := $(OBJCOPYFLAGS_EFI)
 u-boot-app.efi: u-boot FORCE
 	$(call if_changed,zobjcopy)
diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi
index fdd4c80aa46..98f98d644e9 100644
--- a/arch/arm/dts/sunxi-u-boot.dtsi
+++ b/arch/arm/dts/sunxi-u-boot.dtsi
@@ -5,14 +5,72 @@
 		mmc1 = &mmc2;
 	};
 
-	binman {
+	binman: binman {
+		multiple-images;
+	};
+};
+
+&binman {
+	u-boot-sunxi-with-spl {
 		filename = "u-boot-sunxi-with-spl.bin";
 		pad-byte = <0xff>;
 		blob {
 			filename = "spl/sunxi-spl.bin";
 		};
+#ifdef CONFIG_ARM64
+		fit {
+			description = "Configuration to load ATF before U-Boot";
+			#address-cells = <1>;
+
+			images {
+				uboot {
+					description = "U-Boot (64-bit)";
+					type = "standalone";
+					arch = "arm64";
+					compression = "none";
+					load = <0x4a000000>;
+
+					u-boot-nodtb {
+					};
+				};
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+/* TODO: Do this with an overwrite in this board's dtb? */
+#ifdef CONFIG_MACH_SUN50I_H6
+					load = <0x104000>;
+					entry = <0x104000>;
+#else
+					load = <0x44000>;
+					entry = <0x44000>;
+#endif
+					atf-bl31 {
+					};
+				};
+
+				@fdt-SEQ {
+					description = "NAME";
+					type = "flat_dt";
+					compression = "none";
+				};
+			};
+
+			configurations {
+				default = "config-1";
+				@config-SEQ {
+					description = "NAME";
+					firmware = "uboot";
+					loadables = "atf";
+					fdt = "fdt-SEQ";
+				};
+			};
+		};
+#else
 		u-boot-img {
 			offset = <CONFIG_SPL_PAD_TO>;
 		};
+#endif
 	};
 };
-- 
2.28.0.297.g1956fa8f8d-goog

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

* [PATCH 7/7] sunxi: Drop the FIT-generator script
  2020-08-22  2:36 [PATCH 0/7] binman: Add support for generating more complex FITs Simon Glass
                   ` (5 preceding siblings ...)
  2020-08-22  2:36 ` [PATCH 6/7] sunxi: Convert 64-bit boards to use binman Simon Glass
@ 2020-08-22  2:36 ` Simon Glass
  2020-08-25  4:07 ` [PATCH 0/7] binman: Add support for generating more complex FITs Heinrich Schuchardt
  7 siblings, 0 replies; 19+ messages in thread
From: Simon Glass @ 2020-08-22  2:36 UTC (permalink / raw)
  To: u-boot

This file is no-longer used. Drop it.

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

 board/sunxi/mksunxi_fit_atf.sh | 87 ----------------------------------
 1 file changed, 87 deletions(-)
 delete mode 100755 board/sunxi/mksunxi_fit_atf.sh

diff --git a/board/sunxi/mksunxi_fit_atf.sh b/board/sunxi/mksunxi_fit_atf.sh
deleted file mode 100755
index 88ad7197470..00000000000
--- a/board/sunxi/mksunxi_fit_atf.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/sh
-#
-# script to generate FIT image source for 64-bit sunxi boards with
-# ARM Trusted Firmware and multiple device trees (given on the command line)
-#
-# usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
-
-[ -z "$BL31" ] && BL31="bl31.bin"
-
-if [ ! -f $BL31 ]; then
-	echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2
-	echo "Please read the section on ARM Trusted Firmware (ATF) in board/sunxi/README.sunxi64" >&2
-	BL31=/dev/null
-fi
-
-if grep -q "^CONFIG_MACH_SUN50I_H6=y" .config; then
-	BL31_ADDR=0x104000
-else
-	BL31_ADDR=0x44000
-fi
-
-cat << __HEADER_EOF
-/dts-v1/;
-
-/ {
-	description = "Configuration to load ATF before U-Boot";
-	#address-cells = <1>;
-
-	images {
-		uboot {
-			description = "U-Boot (64-bit)";
-			data = /incbin/("u-boot-nodtb.bin");
-			type = "standalone";
-			arch = "arm64";
-			compression = "none";
-			load = <0x4a000000>;
-		};
-		atf {
-			description = "ARM Trusted Firmware";
-			data = /incbin/("$BL31");
-			type = "firmware";
-			arch = "arm64";
-			compression = "none";
-			load = <$BL31_ADDR>;
-			entry = <$BL31_ADDR>;
-		};
-__HEADER_EOF
-
-cnt=1
-for dtname in $*
-do
-	cat << __FDT_IMAGE_EOF
-		fdt_$cnt {
-			description = "$(basename $dtname .dtb)";
-			data = /incbin/("$dtname");
-			type = "flat_dt";
-			compression = "none";
-		};
-__FDT_IMAGE_EOF
-	cnt=$((cnt+1))
-done
-
-cat << __CONF_HEADER_EOF
-	};
-	configurations {
-		default = "config_1";
-
-__CONF_HEADER_EOF
-
-cnt=1
-for dtname in $*
-do
-	cat << __CONF_SECTION_EOF
-		config_$cnt {
-			description = "$(basename $dtname .dtb)";
-			firmware = "uboot";
-			loadables = "atf";
-			fdt = "fdt_$cnt";
-		};
-__CONF_SECTION_EOF
-	cnt=$((cnt+1))
-done
-
-cat << __ITS_EOF
-	};
-};
-__ITS_EOF
-- 
2.28.0.297.g1956fa8f8d-goog

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

* [PATCH 4/7] binman: Add support for ATF BL31
  2020-08-22  2:36 ` [PATCH 4/7] binman: Add support for ATF BL31 Simon Glass
@ 2020-08-25  2:44   ` Kever Yang
  2020-08-25  4:04     ` Heinrich Schuchardt
  2020-08-25  7:44   ` Heinrich Schuchardt
  2020-08-25 10:16   ` Heinrich Schuchardt
  2 siblings, 1 reply; 19+ messages in thread
From: Kever Yang @ 2020-08-25  2:44 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On 2020/8/22 ??10:36, Simon Glass wrote:
> Add an entry for ARM Trusted Firmware's 'BL31' payload, which is the
> device's main firmware. Typically this is U-Boot.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>   tools/binman/README.entries        | 10 ++++++++++
>   tools/binman/etype/atf_bl31.py     | 20 ++++++++++++++++++++
>   tools/binman/ftest.py              |  9 +++++++++
>   tools/binman/test/165_atf_bl31.dts | 16 ++++++++++++++++
>   4 files changed, 55 insertions(+)
>   create mode 100644 tools/binman/etype/atf_bl31.py
>   create mode 100644 tools/binman/test/165_atf_bl31.dts
>
> diff --git a/tools/binman/README.entries b/tools/binman/README.entries
> index 97bfae16116..85b8ec9fa73 100644
> --- a/tools/binman/README.entries
> +++ b/tools/binman/README.entries
> @@ -11,6 +11,16 @@ features to produce new behaviours.
>   
>   
>   
> +Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF) BL31 blob
> +-------------------------------------------------------------------------
> +
> +Properties / Entry arguments:
> +    - atf-bl31-path: Filename of file to read into entry
> +
> +This entry holds the run-time firmware started by ATF.
> +
> +
> +
>   Entry: blob: Entry containing an arbitrary binary blob
>   ------------------------------------------------------
>   
> diff --git a/tools/binman/etype/atf_bl31.py b/tools/binman/etype/atf_bl31.py
> new file mode 100644
> index 00000000000..fd7223843b1
> --- /dev/null
> +++ b/tools/binman/etype/atf_bl31.py
> @@ -0,0 +1,20 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (c) 2016 Google, Inc
> +# Written by Simon Glass <sjg@chromium.org>
> +#
> +# Entry-type module for Intel Management Engine binary blob
> +#
> +
> +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
> +
> +class Entry_atf_bl31(Entry_blob_named_by_arg):
> +    """Entry containing an ARM Trusted Firmware (ATF) BL31 blob
> +
> +    Properties / Entry arguments:
> +        - atf-bl31-path: Filename of file to read into entry
> +
> +    This entry holds the run-time firmware started by ATF.
> +    """
> +    def __init__(self, section, etype, node):
> +        super().__init__(section, etype, node, 'atf-bl31')
> +        self.external = True
> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> index 8d687162185..30c9c764327 100644
> --- a/tools/binman/ftest.py
> +++ b/tools/binman/ftest.py
> @@ -75,6 +75,7 @@ REFCODE_DATA          = b'refcode'
>   FSP_M_DATA            = b'fsp_m'
>   FSP_S_DATA            = b'fsp_s'
>   FSP_T_DATA            = b'fsp_t'
> +ATF_BL31_DATA         = b'bl31'
>   
>   # The expected size for the device tree in some tests
>   EXTRACT_DTB_SIZE = 0x3c9
> @@ -168,6 +169,7 @@ class TestFunctional(unittest.TestCase):
>                           os.path.join(cls._indir, 'files'))
>   
>           TestFunctional._MakeInputFile('compress', COMPRESS_DATA)
> +        TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA)


Should this be 'bl31.elf' from ARM TF project instead of 'bl31.bin'?

Thanks,

- Kever

>   
>           # Travis-CI may have an old lz4
>           cls.have_lz4 = True
> @@ -3505,5 +3507,12 @@ class TestFunctional(unittest.TestCase):
>           self.assertIn("Missing required properties/entry args: cros-ec-rw-path",
>                         str(e.exception))
>   
> +    def testPackBl31(self):
> +        """Test that an image with an ATF BL31 binary can be created"""
> +        data = self._DoReadFile('165_atf_bl31.dts')
> +        self.assertEqual(ATF_BL31_DATA, data[:len(ATF_BL31_DATA)])
> +
> +ATF_BL31_DATA
> +
>   if __name__ == "__main__":
>       unittest.main()
> diff --git a/tools/binman/test/165_atf_bl31.dts b/tools/binman/test/165_atf_bl31.dts
> new file mode 100644
> index 00000000000..2b7547d70f9
> --- /dev/null
> +++ b/tools/binman/test/165_atf_bl31.dts
> @@ -0,0 +1,16 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +/dts-v1/;
> +
> +/ {
> +	#address-cells = <1>;
> +	#size-cells = <1>;
> +
> +	binman {
> +		size = <16>;
> +
> +		atf-bl31 {
> +			filename = "bl31.bin";
> +		};
> +	};
> +};

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

* [PATCH 4/7] binman: Add support for ATF BL31
  2020-08-25  2:44   ` Kever Yang
@ 2020-08-25  4:04     ` Heinrich Schuchardt
  0 siblings, 0 replies; 19+ messages in thread
From: Heinrich Schuchardt @ 2020-08-25  4:04 UTC (permalink / raw)
  To: u-boot

On 8/25/20 4:44 AM, Kever Yang wrote:
> Hi Simon,
>
> On 2020/8/22 ??10:36, Simon Glass wrote:
>> Add an entry for ARM Trusted Firmware's 'BL31' payload, which is the
>> device's main firmware. Typically this is U-Boot.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>> ? tools/binman/README.entries??????? | 10 ++++++++++
>> ? tools/binman/etype/atf_bl31.py???? | 20 ++++++++++++++++++++
>> ? tools/binman/ftest.py????????????? |? 9 +++++++++
>> ? tools/binman/test/165_atf_bl31.dts | 16 ++++++++++++++++
>> ? 4 files changed, 55 insertions(+)
>> ? create mode 100644 tools/binman/etype/atf_bl31.py
>> ? create mode 100644 tools/binman/test/165_atf_bl31.dts
>>
>> diff --git a/tools/binman/README.entries b/tools/binman/README.entries
>> index 97bfae16116..85b8ec9fa73 100644
>> --- a/tools/binman/README.entries
>> +++ b/tools/binman/README.entries
>> @@ -11,6 +11,16 @@ features to produce new behaviours.
>> ? ? ? +Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF)
>> BL31 blob
>> +-------------------------------------------------------------------------
>>
>> +
>> +Properties / Entry arguments:
>> +??? - atf-bl31-path: Filename of file to read into entry
>> +
>> +This entry holds the run-time firmware started by ATF.
>> +
>> +
>> +
>> ? Entry: blob: Entry containing an arbitrary binary blob
>> ? ------------------------------------------------------
>> ? diff --git a/tools/binman/etype/atf_bl31.py
>> b/tools/binman/etype/atf_bl31.py
>> new file mode 100644
>> index 00000000000..fd7223843b1
>> --- /dev/null
>> +++ b/tools/binman/etype/atf_bl31.py
>> @@ -0,0 +1,20 @@
>> +# SPDX-License-Identifier: GPL-2.0+
>> +# Copyright (c) 2016 Google, Inc
>> +# Written by Simon Glass <sjg@chromium.org>
>> +#
>> +# Entry-type module for Intel Management Engine binary blob
>> +#
>> +
>> +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
>> +
>> +class Entry_atf_bl31(Entry_blob_named_by_arg):
>> +??? """Entry containing an ARM Trusted Firmware (ATF) BL31 blob
>> +
>> +??? Properties / Entry arguments:
>> +??????? - atf-bl31-path: Filename of file to read into entry
>> +
>> +??? This entry holds the run-time firmware started by ATF.
>> +??? """
>> +??? def __init__(self, section, etype, node):
>> +??????? super().__init__(section, etype, node, 'atf-bl31')
>> +??????? self.external = True
>> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
>> index 8d687162185..30c9c764327 100644
>> --- a/tools/binman/ftest.py
>> +++ b/tools/binman/ftest.py
>> @@ -75,6 +75,7 @@ REFCODE_DATA????????? = b'refcode'
>> ? FSP_M_DATA??????????? = b'fsp_m'
>> ? FSP_S_DATA??????????? = b'fsp_s'
>> ? FSP_T_DATA??????????? = b'fsp_t'
>> +ATF_BL31_DATA???????? = b'bl31'
>> ? ? # The expected size for the device tree in some tests
>> ? EXTRACT_DTB_SIZE = 0x3c9
>> @@ -168,6 +169,7 @@ class TestFunctional(unittest.TestCase):
>> ????????????????????????? os.path.join(cls._indir, 'files'))
>> ? ????????? TestFunctional._MakeInputFile('compress', COMPRESS_DATA)
>> +??????? TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA)
>
>
> Should this be 'bl31.elf' from ARM TF project instead of 'bl31.bin'?

The file that I need to include from the TF-A project is:

<trusted-firmware-a>/build/sun50i_a64/debug/bl31.bin

Best regards

Heinrich

>
> Thanks,
>
> - Kever
>
>> ? ????????? # Travis-CI may have an old lz4
>> ????????? cls.have_lz4 = True
>> @@ -3505,5 +3507,12 @@ class TestFunctional(unittest.TestCase):
>> ????????? self.assertIn("Missing required properties/entry args:
>> cros-ec-rw-path",
>> ??????????????????????? str(e.exception))
>> ? +??? def testPackBl31(self):
>> +??????? """Test that an image with an ATF BL31 binary can be created"""
>> +??????? data = self._DoReadFile('165_atf_bl31.dts')
>> +??????? self.assertEqual(ATF_BL31_DATA, data[:len(ATF_BL31_DATA)])
>> +
>> +ATF_BL31_DATA
>> +
>> ? if __name__ == "__main__":
>> ????? unittest.main()
>> diff --git a/tools/binman/test/165_atf_bl31.dts
>> b/tools/binman/test/165_atf_bl31.dts
>> new file mode 100644
>> index 00000000000..2b7547d70f9
>> --- /dev/null
>> +++ b/tools/binman/test/165_atf_bl31.dts
>> @@ -0,0 +1,16 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +
>> +/dts-v1/;
>> +
>> +/ {
>> +??? #address-cells = <1>;
>> +??? #size-cells = <1>;
>> +
>> +??? binman {
>> +??????? size = <16>;
>> +
>> +??????? atf-bl31 {
>> +??????????? filename = "bl31.bin";
>> +??????? };
>> +??? };
>> +};
>
>

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

* [PATCH 0/7] binman: Add support for generating more complex FITs
  2020-08-22  2:36 [PATCH 0/7] binman: Add support for generating more complex FITs Simon Glass
                   ` (6 preceding siblings ...)
  2020-08-22  2:36 ` [PATCH 7/7] sunxi: Drop the FIT-generator script Simon Glass
@ 2020-08-25  4:07 ` Heinrich Schuchardt
  2020-08-25 10:12   ` Heinrich Schuchardt
  7 siblings, 1 reply; 19+ messages in thread
From: Heinrich Schuchardt @ 2020-08-25  4:07 UTC (permalink / raw)
  To: u-boot

On 8/22/20 4:36 AM, Simon Glass wrote:
> This series allows binman to generate FITs that include multiple DTB
> images and the configuration to use them.
>
> It is then possible to remove the sunxi FIT generator script, so this
> series handles that also.
>
> With this, sunxi is fully converted to use binman.

I have applied this patch series and it does not work on my
pine64-lts_defconfig.

Environment variable BL31 points to my bl31.bin:

$ echo $BL31
../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin

U-Boot SPL 2020.10-rc2-00147-g72293dc579 (Aug 25 2020 - 03:29:28 +0000)
DRAM: 2048 MiB
Trying to boot from MMC1
No matching DT out of these options:
   Configuration to load ATF before U-Boot
No matching DT out of these options:
   Configuration to load ATF before U-Boot
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Without your patches U-Boot works. But CONFIG_SYS_MALLOC_F_LEN=0x400 is
too small. This results in a warning "alloc space exhausted". Cf.
https://patchwork.ozlabs.org/project/uboot/patch/20200725181851.4339-1-xypron.glpk at gmx.de/

U-Boot SPL 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +0000)
DRAM: 2048 MiB
Trying to boot from MMC1
NOTICE:  BL31: v2.2():v2.2-1138-g78460ced4
NOTICE:  BL31: Built : 05:50:47, Apr  7 2020
NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
NOTICE:  BL31: Found U-Boot DTB at 0x4092cc8, model: Pine64 LTS
INFO:    ARM GICv2 driver initialized
INFO:    Configuring SPC Controller
INFO:    PMIC: Probing AXP803 on RSB
INFO:    PMIC: dcdc1 voltage: 3.300V
INFO:    PMIC: dcdc5 voltage: 1.200V
INFO:    PMIC: dcdc6 voltage: 1.100V
INFO:    PMIC: dldo1 voltage: 3.300V
INFO:    PMIC: dldo2 voltage: 3.300V
INFO:    PMIC: dldo4 voltage: 3.300V
INFO:    PMIC: fldo1 voltage: 1.200V
INFO:    PMIC: Enabling DC SW
INFO:    BL31: Platform setup done
INFO:    BL31: Initializing runtime services
INFO:    BL31: cortex_a53: CPU workaround for 843419 was applied
INFO:    BL31: cortex_a53: CPU workaround for 855873 was applied
NOTICE:  PSCI: System suspend is unavailable
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0x4a000000
INFO:    SPSR = 0x3c9
alloc space exhausted


U-Boot 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +0000)
Allwinner Technology

CPU:   Allwinner A64 (SUN50I)
Model: Pine64 LTS
DRAM:  2 GiB
MMC:   mmc at 1c0f000: 0, mmc at 1c11000: 1
Loading Environment from FAT... Card did not respond to voltage select!
In:    serial
Out:   serial
Err:   serial
Net:   phy interface7
eth0: ethernet at 1c30000
Hit any key to stop autoboot:  0

Best regards

Heinrich

>
>
> Simon Glass (7):
>   binman: Allow entry args to be required
>   binman: Fix up a few missing comments
>   libfdt: Detected out-of-space with fdt_finish()
>   binman: Add support for ATF BL31
>   binman: Support generating FITs with multiple dtbs
>   sunxi: Convert 64-bit boards to use binman
>   sunxi: Drop the FIT-generator script
>
>  Kconfig                                 |   3 +-
>  Makefile                                |  18 +---
>  arch/arm/dts/sunxi-u-boot.dtsi          |  60 +++++++++++-
>  board/sunxi/mksunxi_fit_atf.sh          |  87 -----------------
>  scripts/dtc/pylibfdt/libfdt.i_shipped   |   3 +-
>  tools/binman/README.entries             |  59 ++++++++++-
>  tools/binman/etype/atf_bl31.py          |  20 ++++
>  tools/binman/etype/blob_named_by_arg.py |  10 +-
>  tools/binman/etype/cros_ec_rw.py        |   3 +-
>  tools/binman/etype/fit.py               |  76 +++++++++++++--
>  tools/binman/ftest.py                   | 124 ++++++++++++++++++++++--
>  tools/binman/test/165_atf_bl31.dts      |  16 +++
>  tools/binman/test/166_fit_fdt.dts       |  55 +++++++++++
>  13 files changed, 405 insertions(+), 129 deletions(-)
>  delete mode 100755 board/sunxi/mksunxi_fit_atf.sh
>  create mode 100644 tools/binman/etype/atf_bl31.py
>  create mode 100644 tools/binman/test/165_atf_bl31.dts
>  create mode 100644 tools/binman/test/166_fit_fdt.dts
>

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

* [PATCH 4/7] binman: Add support for ATF BL31
  2020-08-22  2:36 ` [PATCH 4/7] binman: Add support for ATF BL31 Simon Glass
  2020-08-25  2:44   ` Kever Yang
@ 2020-08-25  7:44   ` Heinrich Schuchardt
  2020-08-25 10:16   ` Heinrich Schuchardt
  2 siblings, 0 replies; 19+ messages in thread
From: Heinrich Schuchardt @ 2020-08-25  7:44 UTC (permalink / raw)
  To: u-boot

On 22.08.20 04:36, Simon Glass wrote:
> Add an entry for ARM Trusted Firmware's 'BL31' payload, which is the
> device's main firmware. Typically this is U-Boot.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  tools/binman/README.entries        | 10 ++++++++++
>  tools/binman/etype/atf_bl31.py     | 20 ++++++++++++++++++++
>  tools/binman/ftest.py              |  9 +++++++++
>  tools/binman/test/165_atf_bl31.dts | 16 ++++++++++++++++
>  4 files changed, 55 insertions(+)
>  create mode 100644 tools/binman/etype/atf_bl31.py
>  create mode 100644 tools/binman/test/165_atf_bl31.dts
>
> diff --git a/tools/binman/README.entries b/tools/binman/README.entries
> index 97bfae16116..85b8ec9fa73 100644
> --- a/tools/binman/README.entries
> +++ b/tools/binman/README.entries
> @@ -11,6 +11,16 @@ features to produce new behaviours.
>
>
>
> +Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF) BL31 blob
> +-------------------------------------------------------------------------
> +
> +Properties / Entry arguments:
> +    - atf-bl31-path: Filename of file to read into entry
> +
> +This entry holds the run-time firmware started by ATF.
> +
> +
> +
>  Entry: blob: Entry containing an arbitrary binary blob
>  ------------------------------------------------------
>
> diff --git a/tools/binman/etype/atf_bl31.py b/tools/binman/etype/atf_bl31.py
> new file mode 100644
> index 00000000000..fd7223843b1
> --- /dev/null
> +++ b/tools/binman/etype/atf_bl31.py
> @@ -0,0 +1,20 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (c) 2016 Google, Inc

Nits:

It is 2020 now.

> +# Written by Simon Glass <sjg@chromium.org>
> +#
> +# Entry-type module for Intel Management Engine binary blob
> +#
> +
> +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
> +
> +class Entry_atf_bl31(Entry_blob_named_by_arg):
> +    """Entry containing an ARM Trusted Firmware (ATF) BL31 blob
> +
> +    Properties / Entry arguments:
> +        - atf-bl31-path: Filename of file to read into entry
> +
> +    This entry holds the run-time firmware started by ATF.
> +    """
> +    def __init__(self, section, etype, node):
> +        super().__init__(section, etype, node, 'atf-bl31')
> +        self.external = True
> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> index 8d687162185..30c9c764327 100644
> --- a/tools/binman/ftest.py
> +++ b/tools/binman/ftest.py
> @@ -75,6 +75,7 @@ REFCODE_DATA          = b'refcode'
>  FSP_M_DATA            = b'fsp_m'
>  FSP_S_DATA            = b'fsp_s'
>  FSP_T_DATA            = b'fsp_t'
> +ATF_BL31_DATA         = b'bl31'
>
>  # The expected size for the device tree in some tests
>  EXTRACT_DTB_SIZE = 0x3c9
> @@ -168,6 +169,7 @@ class TestFunctional(unittest.TestCase):
>                          os.path.join(cls._indir, 'files'))
>
>          TestFunctional._MakeInputFile('compress', COMPRESS_DATA)
> +        TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA)
>
>          # Travis-CI may have an old lz4
>          cls.have_lz4 = True
> @@ -3505,5 +3507,12 @@ class TestFunctional(unittest.TestCase):
>          self.assertIn("Missing required properties/entry args: cros-ec-rw-path",
>                        str(e.exception))
>
> +    def testPackBl31(self):
> +        """Test that an image with an ATF BL31 binary can be created"""
> +        data = self._DoReadFile('165_atf_bl31.dts')
> +        self.assertEqual(ATF_BL31_DATA, data[:len(ATF_BL31_DATA)])
> +
> +ATF_BL31_DATA
> +
>  if __name__ == "__main__":
>      unittest.main()
> diff --git a/tools/binman/test/165_atf_bl31.dts b/tools/binman/test/165_atf_bl31.dts
> new file mode 100644
> index 00000000000..2b7547d70f9
> --- /dev/null
> +++ b/tools/binman/test/165_atf_bl31.dts
> @@ -0,0 +1,16 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +/dts-v1/;
> +
> +/ {
> +	#address-cells = <1>;
> +	#size-cells = <1>;
> +
> +	binman {
> +		size = <16>;
> +
> +		atf-bl31 {
> +			filename = "bl31.bin";
> +		};
> +	};
> +};
>

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

* [PATCH 0/7] binman: Add support for generating more complex FITs
  2020-08-25  4:07 ` [PATCH 0/7] binman: Add support for generating more complex FITs Heinrich Schuchardt
@ 2020-08-25 10:12   ` Heinrich Schuchardt
  2020-08-25 16:57     ` Simon Glass
  0 siblings, 1 reply; 19+ messages in thread
From: Heinrich Schuchardt @ 2020-08-25 10:12 UTC (permalink / raw)
  To: u-boot

On 25.08.20 06:07, Heinrich Schuchardt wrote:
> On 8/22/20 4:36 AM, Simon Glass wrote:
>> This series allows binman to generate FITs that include multiple DTB
>> images and the configuration to use them.
>>
>> It is then possible to remove the sunxi FIT generator script, so this
>> series handles that also.
>>
>> With this, sunxi is fully converted to use binman.
>
> I have applied this patch series and it does not work on my
> pine64-lts_defconfig.
>
> Environment variable BL31 points to my bl31.bin:
>
> $ echo $BL31
> ../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin
>
> U-Boot SPL 2020.10-rc2-00147-g72293dc579 (Aug 25 2020 - 03:29:28 +0000)
> DRAM: 2048 MiB
> Trying to boot from MMC1
> No matching DT out of these options:
>    Configuration to load ATF before U-Boot
> No matching DT out of these options:
>    Configuration to load ATF before U-Boot
> mmc_load_image_raw_sector: mmc block read error
> SPL: failed to boot from all boot devices
> ### ERROR ### Please RESET the board ###
>
> Without your patches U-Boot works. But CONFIG_SYS_MALLOC_F_LEN=0x400 is
> too small. This results in a warning "alloc space exhausted". Cf.
> https://patchwork.ozlabs.org/project/uboot/patch/20200725181851.4339-1-xypron.glpk at gmx.de/
>
> U-Boot SPL 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +0000)
> DRAM: 2048 MiB
> Trying to boot from MMC1
> NOTICE:  BL31: v2.2():v2.2-1138-g78460ced4
> NOTICE:  BL31: Built : 05:50:47, Apr  7 2020
> NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
> NOTICE:  BL31: Found U-Boot DTB at 0x4092cc8, model: Pine64 LTS
> INFO:    ARM GICv2 driver initialized
> INFO:    Configuring SPC Controller
> INFO:    PMIC: Probing AXP803 on RSB
> INFO:    PMIC: dcdc1 voltage: 3.300V
> INFO:    PMIC: dcdc5 voltage: 1.200V
> INFO:    PMIC: dcdc6 voltage: 1.100V
> INFO:    PMIC: dldo1 voltage: 3.300V
> INFO:    PMIC: dldo2 voltage: 3.300V
> INFO:    PMIC: dldo4 voltage: 3.300V
> INFO:    PMIC: fldo1 voltage: 1.200V
> INFO:    PMIC: Enabling DC SW
> INFO:    BL31: Platform setup done
> INFO:    BL31: Initializing runtime services
> INFO:    BL31: cortex_a53: CPU workaround for 843419 was applied
> INFO:    BL31: cortex_a53: CPU workaround for 855873 was applied
> NOTICE:  PSCI: System suspend is unavailable
> INFO:    BL31: Preparing for EL3 exit to normal world
> INFO:    Entry point address = 0x4a000000
> INFO:    SPSR = 0x3c9
> alloc space exhausted
>
>
> U-Boot 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +0000)
> Allwinner Technology
>
> CPU:   Allwinner A64 (SUN50I)
> Model: Pine64 LTS
> DRAM:  2 GiB
> MMC:   mmc at 1c0f000: 0, mmc at 1c11000: 1
> Loading Environment from FAT... Card did not respond to voltage select!
> In:    serial
> Out:   serial
> Err:   serial
> Net:   phy interface7
> eth0: ethernet at 1c30000
> Hit any key to stop autoboot:  0
>
> Best regards
>
> Heinrich

This is u-boot.its created without your patches:

/dts-v1/;

/ {
        description = "Configuration to load ATF before U-Boot";
        #address-cells = <1>;

        images {
                uboot {
                        description = "U-Boot (64-bit)";
                        data = /incbin/("u-boot-nodtb.bin");
                        type = "standalone";
                        arch = "arm64";
                        compression = "none";
                        load = <0x4a000000>;
                };
                atf {
                        description = "ARM Trusted Firmware";
                        data =
/incbin/("../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin");
                        type = "firmware";
                        arch = "arm64";
                        compression = "none";
                        load = <0x44000>;
                        entry = <0x44000>;
                };
                fdt_1 {
                        description = "sun50i-a64-pine64-lts";
                        data =
/incbin/("arch/arm/dts/sun50i-a64-pine64-lts.dtb");
                        type = "flat_dt";
                        compression = "none";
                };
        };
        configurations {
                default = "config_1";

                config_1 {
                        description = "sun50i-a64-pine64-lts";
                        firmware = "uboot";
                        loadables = "atf";
                        fdt = "fdt_1";
                };
        };
};

This is the itb that is created with your patches:

/dts-v1/;

/ {
        description = "Configuration to load ATF before U-Boot";
        #address-cells = < 0x01 >;

        images {

                uboot {
                        data = < 0x1f000 ...
                        description = "U-Boot (64-bit)";
                        type = "standalone";
                        arch = "arm64";
                        compression = "none";
                        load = < 0x4a000000 >;
                };

                atf {
                        data = [ f4 ...
                        description = "ARM Trusted Firmware";
                        type = "firmware";
                        arch = "arm64";
                        compression = "none";
                        load = < 0x44000 >;
                        entry = < 0x44000 >;
                };
        };

        configurations {
                default = "config-1";
        };
};


The device tree is missing and the default configuration is empty.

Best regards

Heinrich

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

* [PATCH 4/7] binman: Add support for ATF BL31
  2020-08-22  2:36 ` [PATCH 4/7] binman: Add support for ATF BL31 Simon Glass
  2020-08-25  2:44   ` Kever Yang
  2020-08-25  7:44   ` Heinrich Schuchardt
@ 2020-08-25 10:16   ` Heinrich Schuchardt
  2020-08-25 16:57     ` Simon Glass
  2 siblings, 1 reply; 19+ messages in thread
From: Heinrich Schuchardt @ 2020-08-25 10:16 UTC (permalink / raw)
  To: u-boot

On 22.08.20 04:36, Simon Glass wrote:
> Add an entry for ARM Trusted Firmware's 'BL31' payload, which is the
> device's main firmware. Typically this is U-Boot.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  tools/binman/README.entries        | 10 ++++++++++
>  tools/binman/etype/atf_bl31.py     | 20 ++++++++++++++++++++
>  tools/binman/ftest.py              |  9 +++++++++
>  tools/binman/test/165_atf_bl31.dts | 16 ++++++++++++++++
>  4 files changed, 55 insertions(+)
>  create mode 100644 tools/binman/etype/atf_bl31.py
>  create mode 100644 tools/binman/test/165_atf_bl31.dts
>
> diff --git a/tools/binman/README.entries b/tools/binman/README.entries
> index 97bfae16116..85b8ec9fa73 100644
> --- a/tools/binman/README.entries
> +++ b/tools/binman/README.entries
> @@ -11,6 +11,16 @@ features to produce new behaviours.
>
>
>
> +Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF) BL31 blob
> +-------------------------------------------------------------------------
> +
> +Properties / Entry arguments:
> +    - atf-bl31-path: Filename of file to read into entry
> +
> +This entry holds the run-time firmware started by ATF.

No, BL31 is started by U-Boot SPL on the Sunxi platform.

Best regards

Heinrich

> +
> +
> +
>  Entry: blob: Entry containing an arbitrary binary blob
>  ------------------------------------------------------
>
> diff --git a/tools/binman/etype/atf_bl31.py b/tools/binman/etype/atf_bl31.py
> new file mode 100644
> index 00000000000..fd7223843b1
> --- /dev/null
> +++ b/tools/binman/etype/atf_bl31.py
> @@ -0,0 +1,20 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (c) 2016 Google, Inc
> +# Written by Simon Glass <sjg@chromium.org>
> +#
> +# Entry-type module for Intel Management Engine binary blob
> +#
> +
> +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
> +
> +class Entry_atf_bl31(Entry_blob_named_by_arg):
> +    """Entry containing an ARM Trusted Firmware (ATF) BL31 blob
> +
> +    Properties / Entry arguments:
> +        - atf-bl31-path: Filename of file to read into entry
> +
> +    This entry holds the run-time firmware started by ATF.
> +    """
> +    def __init__(self, section, etype, node):
> +        super().__init__(section, etype, node, 'atf-bl31')
> +        self.external = True
> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> index 8d687162185..30c9c764327 100644
> --- a/tools/binman/ftest.py
> +++ b/tools/binman/ftest.py
> @@ -75,6 +75,7 @@ REFCODE_DATA          = b'refcode'
>  FSP_M_DATA            = b'fsp_m'
>  FSP_S_DATA            = b'fsp_s'
>  FSP_T_DATA            = b'fsp_t'
> +ATF_BL31_DATA         = b'bl31'
>
>  # The expected size for the device tree in some tests
>  EXTRACT_DTB_SIZE = 0x3c9
> @@ -168,6 +169,7 @@ class TestFunctional(unittest.TestCase):
>                          os.path.join(cls._indir, 'files'))
>
>          TestFunctional._MakeInputFile('compress', COMPRESS_DATA)
> +        TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA)
>
>          # Travis-CI may have an old lz4
>          cls.have_lz4 = True
> @@ -3505,5 +3507,12 @@ class TestFunctional(unittest.TestCase):
>          self.assertIn("Missing required properties/entry args: cros-ec-rw-path",
>                        str(e.exception))
>
> +    def testPackBl31(self):
> +        """Test that an image with an ATF BL31 binary can be created"""
> +        data = self._DoReadFile('165_atf_bl31.dts')
> +        self.assertEqual(ATF_BL31_DATA, data[:len(ATF_BL31_DATA)])
> +
> +ATF_BL31_DATA
> +
>  if __name__ == "__main__":
>      unittest.main()
> diff --git a/tools/binman/test/165_atf_bl31.dts b/tools/binman/test/165_atf_bl31.dts
> new file mode 100644
> index 00000000000..2b7547d70f9
> --- /dev/null
> +++ b/tools/binman/test/165_atf_bl31.dts
> @@ -0,0 +1,16 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +/dts-v1/;
> +
> +/ {
> +	#address-cells = <1>;
> +	#size-cells = <1>;
> +
> +	binman {
> +		size = <16>;
> +
> +		atf-bl31 {
> +			filename = "bl31.bin";
> +		};
> +	};
> +};
>

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

* [PATCH 0/7] binman: Add support for generating more complex FITs
  2020-08-25 10:12   ` Heinrich Schuchardt
@ 2020-08-25 16:57     ` Simon Glass
  2020-08-25 17:36       ` Heinrich Schuchardt
  0 siblings, 1 reply; 19+ messages in thread
From: Simon Glass @ 2020-08-25 16:57 UTC (permalink / raw)
  To: u-boot

Hi Heinrich,

On Tue, 25 Aug 2020 at 04:12, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 25.08.20 06:07, Heinrich Schuchardt wrote:
> > On 8/22/20 4:36 AM, Simon Glass wrote:
> >> This series allows binman to generate FITs that include multiple DTB
> >> images and the configuration to use them.
> >>
> >> It is then possible to remove the sunxi FIT generator script, so this
> >> series handles that also.
> >>
> >> With this, sunxi is fully converted to use binman.
> >
> > I have applied this patch series and it does not work on my
> > pine64-lts_defconfig.
> >
> > Environment variable BL31 points to my bl31.bin:
> >
> > $ echo $BL31
> > ../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin
> >
> > U-Boot SPL 2020.10-rc2-00147-g72293dc579 (Aug 25 2020 - 03:29:28 +0000)
> > DRAM: 2048 MiB
> > Trying to boot from MMC1
> > No matching DT out of these options:
> >    Configuration to load ATF before U-Boot
> > No matching DT out of these options:
> >    Configuration to load ATF before U-Boot
> > mmc_load_image_raw_sector: mmc block read error
> > SPL: failed to boot from all boot devices
> > ### ERROR ### Please RESET the board ###
> >
> > Without your patches U-Boot works. But CONFIG_SYS_MALLOC_F_LEN=0x400 is
> > too small. This results in a warning "alloc space exhausted". Cf.
> > https://patchwork.ozlabs.org/project/uboot/patch/20200725181851.4339-1-xypron.glpk at gmx.de/
> >
> > U-Boot SPL 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +0000)
> > DRAM: 2048 MiB
> > Trying to boot from MMC1
> > NOTICE:  BL31: v2.2():v2.2-1138-g78460ced4
> > NOTICE:  BL31: Built : 05:50:47, Apr  7 2020
> > NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
> > NOTICE:  BL31: Found U-Boot DTB at 0x4092cc8, model: Pine64 LTS
> > INFO:    ARM GICv2 driver initialized
> > INFO:    Configuring SPC Controller
> > INFO:    PMIC: Probing AXP803 on RSB
> > INFO:    PMIC: dcdc1 voltage: 3.300V
> > INFO:    PMIC: dcdc5 voltage: 1.200V
> > INFO:    PMIC: dcdc6 voltage: 1.100V
> > INFO:    PMIC: dldo1 voltage: 3.300V
> > INFO:    PMIC: dldo2 voltage: 3.300V
> > INFO:    PMIC: dldo4 voltage: 3.300V
> > INFO:    PMIC: fldo1 voltage: 1.200V
> > INFO:    PMIC: Enabling DC SW
> > INFO:    BL31: Platform setup done
> > INFO:    BL31: Initializing runtime services
> > INFO:    BL31: cortex_a53: CPU workaround for 843419 was applied
> > INFO:    BL31: cortex_a53: CPU workaround for 855873 was applied
> > NOTICE:  PSCI: System suspend is unavailable
> > INFO:    BL31: Preparing for EL3 exit to normal world
> > INFO:    Entry point address = 0x4a000000
> > INFO:    SPSR = 0x3c9
> > alloc space exhausted
> >
> >
> > U-Boot 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +0000)
> > Allwinner Technology
> >
> > CPU:   Allwinner A64 (SUN50I)
> > Model: Pine64 LTS
> > DRAM:  2 GiB
> > MMC:   mmc at 1c0f000: 0, mmc at 1c11000: 1
> > Loading Environment from FAT... Card did not respond to voltage select!
> > In:    serial
> > Out:   serial
> > Err:   serial
> > Net:   phy interface7
> > eth0: ethernet at 1c30000
> > Hit any key to stop autoboot:  0
> >
> > Best regards
> >
> > Heinrich
>
> This is u-boot.its created without your patches:
>
> /dts-v1/;
>
> / {
>         description = "Configuration to load ATF before U-Boot";
>         #address-cells = <1>;
>
>         images {
>                 uboot {
>                         description = "U-Boot (64-bit)";
>                         data = /incbin/("u-boot-nodtb.bin");
>                         type = "standalone";
>                         arch = "arm64";
>                         compression = "none";
>                         load = <0x4a000000>;
>                 };
>                 atf {
>                         description = "ARM Trusted Firmware";
>                         data =
> /incbin/("../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin");
>                         type = "firmware";
>                         arch = "arm64";
>                         compression = "none";
>                         load = <0x44000>;
>                         entry = <0x44000>;
>                 };
>                 fdt_1 {
>                         description = "sun50i-a64-pine64-lts";
>                         data =
> /incbin/("arch/arm/dts/sun50i-a64-pine64-lts.dtb");
>                         type = "flat_dt";
>                         compression = "none";
>                 };
>         };
>         configurations {
>                 default = "config_1";
>
>                 config_1 {
>                         description = "sun50i-a64-pine64-lts";
>                         firmware = "uboot";
>                         loadables = "atf";
>                         fdt = "fdt_1";
>                 };
>         };
> };
>
> This is the itb that is created with your patches:
>
> /dts-v1/;
>
> / {
>         description = "Configuration to load ATF before U-Boot";
>         #address-cells = < 0x01 >;
>
>         images {
>
>                 uboot {
>                         data = < 0x1f000 ...
>                         description = "U-Boot (64-bit)";
>                         type = "standalone";
>                         arch = "arm64";
>                         compression = "none";
>                         load = < 0x4a000000 >;
>                 };
>
>                 atf {
>                         data = [ f4 ...
>                         description = "ARM Trusted Firmware";
>                         type = "firmware";
>                         arch = "arm64";
>                         compression = "none";
>                         load = < 0x44000 >;
>                         entry = < 0x44000 >;
>                 };
>         };
>
>         configurations {
>                 default = "config-1";
>         };
> };
>
>
> The device tree is missing and the default configuration is empty.

There was a thread on this, I thought. Can you check u-boot-dm/binman-working ?

I can send v2 I suppose.

Regards,
Simon

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

* [PATCH 4/7] binman: Add support for ATF BL31
  2020-08-25 10:16   ` Heinrich Schuchardt
@ 2020-08-25 16:57     ` Simon Glass
  2020-08-25 17:59       ` Heinrich Schuchardt
  0 siblings, 1 reply; 19+ messages in thread
From: Simon Glass @ 2020-08-25 16:57 UTC (permalink / raw)
  To: u-boot

Hi Heinrich,

On Tue, 25 Aug 2020 at 04:16, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 22.08.20 04:36, Simon Glass wrote:
> > Add an entry for ARM Trusted Firmware's 'BL31' payload, which is the
> > device's main firmware. Typically this is U-Boot.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  tools/binman/README.entries        | 10 ++++++++++
> >  tools/binman/etype/atf_bl31.py     | 20 ++++++++++++++++++++
> >  tools/binman/ftest.py              |  9 +++++++++
> >  tools/binman/test/165_atf_bl31.dts | 16 ++++++++++++++++
> >  4 files changed, 55 insertions(+)
> >  create mode 100644 tools/binman/etype/atf_bl31.py
> >  create mode 100644 tools/binman/test/165_atf_bl31.dts
> >
> > diff --git a/tools/binman/README.entries b/tools/binman/README.entries
> > index 97bfae16116..85b8ec9fa73 100644
> > --- a/tools/binman/README.entries
> > +++ b/tools/binman/README.entries
> > @@ -11,6 +11,16 @@ features to produce new behaviours.
> >
> >
> >
> > +Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF) BL31 blob
> > +-------------------------------------------------------------------------
> > +
> > +Properties / Entry arguments:
> > +    - atf-bl31-path: Filename of file to read into entry
> > +
> > +This entry holds the run-time firmware started by ATF.
>
> No, BL31 is started by U-Boot SPL on the Sunxi platform.

So perhaps I should reword this to indicate it can go either way?

>
> Best regards
>
[..]

Regards,
Simon

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

* [PATCH 0/7] binman: Add support for generating more complex FITs
  2020-08-25 16:57     ` Simon Glass
@ 2020-08-25 17:36       ` Heinrich Schuchardt
  2020-08-30 20:37         ` Simon Glass
  0 siblings, 1 reply; 19+ messages in thread
From: Heinrich Schuchardt @ 2020-08-25 17:36 UTC (permalink / raw)
  To: u-boot

On 8/25/20 6:57 PM, Simon Glass wrote:
> Hi Heinrich,
>
> On Tue, 25 Aug 2020 at 04:12, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>>
>> On 25.08.20 06:07, Heinrich Schuchardt wrote:
>>> On 8/22/20 4:36 AM, Simon Glass wrote:
>>>> This series allows binman to generate FITs that include multiple DTB
>>>> images and the configuration to use them.
>>>>
>>>> It is then possible to remove the sunxi FIT generator script, so this
>>>> series handles that also.
>>>>
>>>> With this, sunxi is fully converted to use binman.
>>>
>>> I have applied this patch series and it does not work on my
>>> pine64-lts_defconfig.
>>>
>>> Environment variable BL31 points to my bl31.bin:
>>>
>>> $ echo $BL31
>>> ../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin
>>>
>>> U-Boot SPL 2020.10-rc2-00147-g72293dc579 (Aug 25 2020 - 03:29:28 +0000)
>>> DRAM: 2048 MiB
>>> Trying to boot from MMC1
>>> No matching DT out of these options:
>>>    Configuration to load ATF before U-Boot
>>> No matching DT out of these options:
>>>    Configuration to load ATF before U-Boot
>>> mmc_load_image_raw_sector: mmc block read error
>>> SPL: failed to boot from all boot devices
>>> ### ERROR ### Please RESET the board ###
>>>
>>> Without your patches U-Boot works. But CONFIG_SYS_MALLOC_F_LEN=0x400 is
>>> too small. This results in a warning "alloc space exhausted". Cf.
>>> https://patchwork.ozlabs.org/project/uboot/patch/20200725181851.4339-1-xypron.glpk at gmx.de/
>>>
>>> U-Boot SPL 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +0000)
>>> DRAM: 2048 MiB
>>> Trying to boot from MMC1
>>> NOTICE:  BL31: v2.2():v2.2-1138-g78460ced4
>>> NOTICE:  BL31: Built : 05:50:47, Apr  7 2020
>>> NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
>>> NOTICE:  BL31: Found U-Boot DTB at 0x4092cc8, model: Pine64 LTS
>>> INFO:    ARM GICv2 driver initialized
>>> INFO:    Configuring SPC Controller
>>> INFO:    PMIC: Probing AXP803 on RSB
>>> INFO:    PMIC: dcdc1 voltage: 3.300V
>>> INFO:    PMIC: dcdc5 voltage: 1.200V
>>> INFO:    PMIC: dcdc6 voltage: 1.100V
>>> INFO:    PMIC: dldo1 voltage: 3.300V
>>> INFO:    PMIC: dldo2 voltage: 3.300V
>>> INFO:    PMIC: dldo4 voltage: 3.300V
>>> INFO:    PMIC: fldo1 voltage: 1.200V
>>> INFO:    PMIC: Enabling DC SW
>>> INFO:    BL31: Platform setup done
>>> INFO:    BL31: Initializing runtime services
>>> INFO:    BL31: cortex_a53: CPU workaround for 843419 was applied
>>> INFO:    BL31: cortex_a53: CPU workaround for 855873 was applied
>>> NOTICE:  PSCI: System suspend is unavailable
>>> INFO:    BL31: Preparing for EL3 exit to normal world
>>> INFO:    Entry point address = 0x4a000000
>>> INFO:    SPSR = 0x3c9
>>> alloc space exhausted
>>>
>>>
>>> U-Boot 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +0000)
>>> Allwinner Technology
>>>
>>> CPU:   Allwinner A64 (SUN50I)
>>> Model: Pine64 LTS
>>> DRAM:  2 GiB
>>> MMC:   mmc at 1c0f000: 0, mmc at 1c11000: 1
>>> Loading Environment from FAT... Card did not respond to voltage select!
>>> In:    serial
>>> Out:   serial
>>> Err:   serial
>>> Net:   phy interface7
>>> eth0: ethernet at 1c30000
>>> Hit any key to stop autoboot:  0
>>>
>>> Best regards
>>>
>>> Heinrich
>>
>> This is u-boot.its created without your patches:
>>
>> /dts-v1/;
>>
>> / {
>>         description = "Configuration to load ATF before U-Boot";
>>         #address-cells = <1>;
>>
>>         images {
>>                 uboot {
>>                         description = "U-Boot (64-bit)";
>>                         data = /incbin/("u-boot-nodtb.bin");
>>                         type = "standalone";
>>                         arch = "arm64";
>>                         compression = "none";
>>                         load = <0x4a000000>;
>>                 };
>>                 atf {
>>                         description = "ARM Trusted Firmware";
>>                         data =
>> /incbin/("../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin");
>>                         type = "firmware";
>>                         arch = "arm64";
>>                         compression = "none";
>>                         load = <0x44000>;
>>                         entry = <0x44000>;
>>                 };
>>                 fdt_1 {
>>                         description = "sun50i-a64-pine64-lts";
>>                         data =
>> /incbin/("arch/arm/dts/sun50i-a64-pine64-lts.dtb");
>>                         type = "flat_dt";
>>                         compression = "none";
>>                 };
>>         };
>>         configurations {
>>                 default = "config_1";
>>
>>                 config_1 {
>>                         description = "sun50i-a64-pine64-lts";
>>                         firmware = "uboot";
>>                         loadables = "atf";
>>                         fdt = "fdt_1";
>>                 };
>>         };
>> };
>>
>> This is the itb that is created with your patches:
>>
>> /dts-v1/;
>>
>> / {
>>         description = "Configuration to load ATF before U-Boot";
>>         #address-cells = < 0x01 >;
>>
>>         images {
>>
>>                 uboot {
>>                         data = < 0x1f000 ...
>>                         description = "U-Boot (64-bit)";
>>                         type = "standalone";
>>                         arch = "arm64";
>>                         compression = "none";
>>                         load = < 0x4a000000 >;
>>                 };
>>
>>                 atf {
>>                         data = [ f4 ...
>>                         description = "ARM Trusted Firmware";
>>                         type = "firmware";
>>                         arch = "arm64";
>>                         compression = "none";
>>                         load = < 0x44000 >;
>>                         entry = < 0x44000 >;
>>                 };
>>         };
>>
>>         configurations {
>>                 default = "config-1";
>>         };
>> };
>>
>>
>> The device tree is missing and the default configuration is empty.
>
> There was a thread on this, I thought.

Do you have a link?

> Can you check u-boot-dm/binman-working ?

Bad luck. The problem is reproducible with your branch

commit c6723231a80ad6c2a842778fea7d4857ba81d7c3 (HEAD -> binman-working,
dm/binman-working)
Author: Simon Glass <sjg@chromium.org>
Date:   Fri Aug 21 20:25:56 2020 -0600

    sunxi: Drop the FIT-generator script


U-Boot SPL 2020.10-rc2-00107-gc6723231a8 (Aug 25 2020 - 17:29:26 +0000)
DRAM: 2048 MiB
Trying to boot from MMC1
No matching DT out of these options:
   Configuration to load ATF before U-Boot
No matching DT out of these options:
   Configuration to load ATF before U-Boot
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###


Best regards

Heinrich

>
> I can send v2 I suppose.
>
> Regards,
> Simon
>

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

* [PATCH 4/7] binman: Add support for ATF BL31
  2020-08-25 16:57     ` Simon Glass
@ 2020-08-25 17:59       ` Heinrich Schuchardt
  0 siblings, 0 replies; 19+ messages in thread
From: Heinrich Schuchardt @ 2020-08-25 17:59 UTC (permalink / raw)
  To: u-boot

Am 25. August 2020 18:57:57 MESZ schrieb Simon Glass <sjg@chromium.org>:
>Hi Heinrich,
>
>On Tue, 25 Aug 2020 at 04:16, Heinrich Schuchardt <xypron.glpk@gmx.de>
>wrote:
>>
>> On 22.08.20 04:36, Simon Glass wrote:
>> > Add an entry for ARM Trusted Firmware's 'BL31' payload, which is
>the
>> > device's main firmware. Typically this is U-Boot.
>> >
>> > Signed-off-by: Simon Glass <sjg@chromium.org>
>> > ---
>> >
>> >  tools/binman/README.entries        | 10 ++++++++++
>> >  tools/binman/etype/atf_bl31.py     | 20 ++++++++++++++++++++
>> >  tools/binman/ftest.py              |  9 +++++++++
>> >  tools/binman/test/165_atf_bl31.dts | 16 ++++++++++++++++
>> >  4 files changed, 55 insertions(+)
>> >  create mode 100644 tools/binman/etype/atf_bl31.py
>> >  create mode 100644 tools/binman/test/165_atf_bl31.dts
>> >
>> > diff --git a/tools/binman/README.entries
>b/tools/binman/README.entries
>> > index 97bfae16116..85b8ec9fa73 100644
>> > --- a/tools/binman/README.entries
>> > +++ b/tools/binman/README.entries
>> > @@ -11,6 +11,16 @@ features to produce new behaviours.
>> >
>> >
>> >
>> > +Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF)
>BL31 blob
>> >
>+-------------------------------------------------------------------------
>> > +
>> > +Properties / Entry arguments:
>> > +    - atf-bl31-path: Filename of file to read into entry
>> > +
>> > +This entry holds the run-time firmware started by ATF.
>>
>> No, BL31 is started by U-Boot SPL on the Sunxi platform.
>
>So perhaps I should reword this to indicate it can go either way?

If SPL is not loading BL31, we don't need this value. Instead we will pass U-Boot as BL33 to the TF-A make command.

Best regards

Heinrich

>
>>
>> Best regards
>>
>[..]
>
>Regards,
>Simon

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

* [PATCH 0/7] binman: Add support for generating more complex FITs
  2020-08-25 17:36       ` Heinrich Schuchardt
@ 2020-08-30 20:37         ` Simon Glass
  0 siblings, 0 replies; 19+ messages in thread
From: Simon Glass @ 2020-08-30 20:37 UTC (permalink / raw)
  To: u-boot

Hi Heinrich,

On Tue, 25 Aug 2020 at 11:37, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 8/25/20 6:57 PM, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On Tue, 25 Aug 2020 at 04:12, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >>
> >> On 25.08.20 06:07, Heinrich Schuchardt wrote:
> >>> On 8/22/20 4:36 AM, Simon Glass wrote:
> >>>> This series allows binman to generate FITs that include multiple DTB
> >>>> images and the configuration to use them.
> >>>>
> >>>> It is then possible to remove the sunxi FIT generator script, so this
> >>>> series handles that also.
> >>>>
> >>>> With this, sunxi is fully converted to use binman.
> >>>
> >>> I have applied this patch series and it does not work on my
> >>> pine64-lts_defconfig.
> >>>
> >>> Environment variable BL31 points to my bl31.bin:
> >>>
> >>> $ echo $BL31
> >>> ../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin
> >>>
> >>> U-Boot SPL 2020.10-rc2-00147-g72293dc579 (Aug 25 2020 - 03:29:28 +0000)
> >>> DRAM: 2048 MiB
> >>> Trying to boot from MMC1
> >>> No matching DT out of these options:
> >>>    Configuration to load ATF before U-Boot
> >>> No matching DT out of these options:
> >>>    Configuration to load ATF before U-Boot
> >>> mmc_load_image_raw_sector: mmc block read error
> >>> SPL: failed to boot from all boot devices
> >>> ### ERROR ### Please RESET the board ###
> >>>
> >>> Without your patches U-Boot works. But CONFIG_SYS_MALLOC_F_LEN=0x400 is
> >>> too small. This results in a warning "alloc space exhausted". Cf.
> >>> https://patchwork.ozlabs.org/project/uboot/patch/20200725181851.4339-1-xypron.glpk at gmx.de/
> >>>
> >>> U-Boot SPL 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +0000)
> >>> DRAM: 2048 MiB
> >>> Trying to boot from MMC1
> >>> NOTICE:  BL31: v2.2():v2.2-1138-g78460ced4
> >>> NOTICE:  BL31: Built : 05:50:47, Apr  7 2020
> >>> NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
> >>> NOTICE:  BL31: Found U-Boot DTB at 0x4092cc8, model: Pine64 LTS
> >>> INFO:    ARM GICv2 driver initialized
> >>> INFO:    Configuring SPC Controller
> >>> INFO:    PMIC: Probing AXP803 on RSB
> >>> INFO:    PMIC: dcdc1 voltage: 3.300V
> >>> INFO:    PMIC: dcdc5 voltage: 1.200V
> >>> INFO:    PMIC: dcdc6 voltage: 1.100V
> >>> INFO:    PMIC: dldo1 voltage: 3.300V
> >>> INFO:    PMIC: dldo2 voltage: 3.300V
> >>> INFO:    PMIC: dldo4 voltage: 3.300V
> >>> INFO:    PMIC: fldo1 voltage: 1.200V
> >>> INFO:    PMIC: Enabling DC SW
> >>> INFO:    BL31: Platform setup done
> >>> INFO:    BL31: Initializing runtime services
> >>> INFO:    BL31: cortex_a53: CPU workaround for 843419 was applied
> >>> INFO:    BL31: cortex_a53: CPU workaround for 855873 was applied
> >>> NOTICE:  PSCI: System suspend is unavailable
> >>> INFO:    BL31: Preparing for EL3 exit to normal world
> >>> INFO:    Entry point address = 0x4a000000
> >>> INFO:    SPSR = 0x3c9
> >>> alloc space exhausted
> >>>
> >>>
> >>> U-Boot 2020.10-rc2-00140-g1aa3966173 (Aug 25 2020 - 03:46:36 +0000)
> >>> Allwinner Technology
> >>>
> >>> CPU:   Allwinner A64 (SUN50I)
> >>> Model: Pine64 LTS
> >>> DRAM:  2 GiB
> >>> MMC:   mmc at 1c0f000: 0, mmc at 1c11000: 1
> >>> Loading Environment from FAT... Card did not respond to voltage select!
> >>> In:    serial
> >>> Out:   serial
> >>> Err:   serial
> >>> Net:   phy interface7
> >>> eth0: ethernet at 1c30000
> >>> Hit any key to stop autoboot:  0
> >>>
> >>> Best regards
> >>>
> >>> Heinrich
> >>
> >> This is u-boot.its created without your patches:
> >>
> >> /dts-v1/;
> >>
> >> / {
> >>         description = "Configuration to load ATF before U-Boot";
> >>         #address-cells = <1>;
> >>
> >>         images {
> >>                 uboot {
> >>                         description = "U-Boot (64-bit)";
> >>                         data = /incbin/("u-boot-nodtb.bin");
> >>                         type = "standalone";
> >>                         arch = "arm64";
> >>                         compression = "none";
> >>                         load = <0x4a000000>;
> >>                 };
> >>                 atf {
> >>                         description = "ARM Trusted Firmware";
> >>                         data =
> >> /incbin/("../trusted-firmware-a/build/sun50i_a64/debug/bl31.bin");
> >>                         type = "firmware";
> >>                         arch = "arm64";
> >>                         compression = "none";
> >>                         load = <0x44000>;
> >>                         entry = <0x44000>;
> >>                 };
> >>                 fdt_1 {
> >>                         description = "sun50i-a64-pine64-lts";
> >>                         data =
> >> /incbin/("arch/arm/dts/sun50i-a64-pine64-lts.dtb");
> >>                         type = "flat_dt";
> >>                         compression = "none";
> >>                 };
> >>         };
> >>         configurations {
> >>                 default = "config_1";
> >>
> >>                 config_1 {
> >>                         description = "sun50i-a64-pine64-lts";
> >>                         firmware = "uboot";
> >>                         loadables = "atf";
> >>                         fdt = "fdt_1";
> >>                 };
> >>         };
> >> };
> >>
> >> This is the itb that is created with your patches:
> >>
> >> /dts-v1/;
> >>
> >> / {
> >>         description = "Configuration to load ATF before U-Boot";
> >>         #address-cells = < 0x01 >;
> >>
> >>         images {
> >>
> >>                 uboot {
> >>                         data = < 0x1f000 ...
> >>                         description = "U-Boot (64-bit)";
> >>                         type = "standalone";
> >>                         arch = "arm64";
> >>                         compression = "none";
> >>                         load = < 0x4a000000 >;
> >>                 };
> >>
> >>                 atf {
> >>                         data = [ f4 ...
> >>                         description = "ARM Trusted Firmware";
> >>                         type = "firmware";
> >>                         arch = "arm64";
> >>                         compression = "none";
> >>                         load = < 0x44000 >;
> >>                         entry = < 0x44000 >;
> >>                 };
> >>         };
> >>
> >>         configurations {
> >>                 default = "config-1";
> >>         };
> >> };
> >>
> >>
> >> The device tree is missing and the default configuration is empty.
> >
> > There was a thread on this, I thought.
>
> Do you have a link?
>
> > Can you check u-boot-dm/binman-working ?
>
> Bad luck. The problem is reproducible with your branch
>

Yes it is missing the fit,fdt-list property. I'll add an error check for this.

> commit c6723231a80ad6c2a842778fea7d4857ba81d7c3 (HEAD -> binman-working,
> dm/binman-working)
> Author: Simon Glass <sjg@chromium.org>
> Date:   Fri Aug 21 20:25:56 2020 -0600
>
>     sunxi: Drop the FIT-generator script
>
>
> U-Boot SPL 2020.10-rc2-00107-gc6723231a8 (Aug 25 2020 - 17:29:26 +0000)
> DRAM: 2048 MiB
> Trying to boot from MMC1
> No matching DT out of these options:
>    Configuration to load ATF before U-Boot
> No matching DT out of these options:
>    Configuration to load ATF before U-Boot
> mmc_load_image_raw_sector: mmc block read error
> SPL: failed to boot from all boot devices
> ### ERROR ### Please RESET the board ###

Regards,
SImon

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

end of thread, other threads:[~2020-08-30 20:37 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22  2:36 [PATCH 0/7] binman: Add support for generating more complex FITs Simon Glass
2020-08-22  2:36 ` [PATCH 1/7] binman: Allow entry args to be required Simon Glass
2020-08-22  2:36 ` [PATCH 2/7] binman: Fix up a few missing comments Simon Glass
2020-08-22  2:36 ` [PATCH 3/7] libfdt: Detected out-of-space with fdt_finish() Simon Glass
2020-08-22  2:36 ` [PATCH 4/7] binman: Add support for ATF BL31 Simon Glass
2020-08-25  2:44   ` Kever Yang
2020-08-25  4:04     ` Heinrich Schuchardt
2020-08-25  7:44   ` Heinrich Schuchardt
2020-08-25 10:16   ` Heinrich Schuchardt
2020-08-25 16:57     ` Simon Glass
2020-08-25 17:59       ` Heinrich Schuchardt
2020-08-22  2:36 ` [PATCH 5/7] binman: Support generating FITs with multiple dtbs Simon Glass
2020-08-22  2:36 ` [PATCH 6/7] sunxi: Convert 64-bit boards to use binman Simon Glass
2020-08-22  2:36 ` [PATCH 7/7] sunxi: Drop the FIT-generator script Simon Glass
2020-08-25  4:07 ` [PATCH 0/7] binman: Add support for generating more complex FITs Heinrich Schuchardt
2020-08-25 10:12   ` Heinrich Schuchardt
2020-08-25 16:57     ` Simon Glass
2020-08-25 17:36       ` Heinrich Schuchardt
2020-08-30 20:37         ` 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.