All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/27] binman: Support devicetree update in all entries
@ 2021-03-18  7:24 Simon Glass
  2021-03-18  7:24 ` [PATCH v3 01/27] binman: Allow extracting to current directory Simon Glass
                   ` (52 more replies)
  0 siblings, 53 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:24 UTC (permalink / raw)
  To: u-boot

U-Boot's various phase binaries actually comprise two or three pieces.
For example, u-boot.bin has the executable followed by a devicetree.

With binman we want to be able to update that devicetree with full image
information so that it is accessible to the executable. This is tricky
if it is not clear where the devicetree starts.

At present this is handled manually, by creating two separate nodes in
the binman definition, u-boot-nodtb and u-boot-dtb, so that binman sees
them separately and can easily update the devicetree. But this is not
very convenient.

Of course we could try to detect the devicetree in the binary, which is
easy enough for binman to do. But this approach rapidly gets out of hand.
When listing an existing image, should we show the devicetree separately?
If we don't then binman cannot extract it by itself, only the whole
binary. With SPL and TPL we may have BSS padding and this is harder
to detect reliably. Also, a design goal of binman is to provide full
information about what is in the image. The detection approach goes
against that.

So instead it seems best to convert these multi-part binaries into a
section with the component parts inside. We can do this automatically
without affecting the operation of binman very much.

One implementation option for this feature would be to update the entries
to behave in two different ways, i.e. either to act as a section containing
sub-entries, or as a simple blob. However this is tricky because each entry
has to use a particular base class. It is not reasonably possible for an
entry to choose between using one base class (e.g. blob) or another
(e.g. section), depending on a flag.

Instead, the approach taken in this series is to replace an entry type
with an expanded version, so 'u-boot' becomes 'u-boot-expanded', for
example. The new entry is a section containing two or three sub-entries.

A similar approach could be take to reduce the complexity of the x86 binman
definition. The microcode is either in TPL, SPL or U-Boot proper, so an
entryarg could control which of those is expanded to include microcode.
That possibility is left for future consideration.

Changes in v3:
- Add new patch to support symbols in u-boot-spl-nodtb
- Add new patch to drop unnecessary 'type' property in tests
- Add new patch to use the fake SPL/TPL only if requested
- Add new patch to drop an unnecessary field in output_fdt_info
- Add new patch to move the comment for GetFdts() to the base class
- Add new patch to use standard filenames for SPL/TPL devicetree
- Update sizes for new behaviour
- Fix x86 docs which refer to this
- Update entry docs
- Make a symlink to the entry docs

Changes in v2:
- Move UEFI under develop/ instead
- Add new patch to move driver model docs under develop/
- Put binman docs in doc/develop and FIT in doc/usage
- Rename README.rst to binman.rst and use a symlink

Simon Glass (27):
  binman: Allow extracting to current directory
  binman: Document ExpandEntries() in the base class
  binman: Update entry help for files-align
  binman: Tidy up underscores in entry documentation
  binman: Correct the documentation for u-boot-spl-bss-pad
  binman: Support symbols in u-boot-spl-nodtb
  binman: Add support for u-boot-tpl-nodtb
  binman: Add support for u-boot-tpl-bss-bad
  binman: Drop unnecessary 'type' property in tests
  binman: Use the fake SPL/TPL only if requested
  binman: Drop unnecessary field in output_fdt_info
  binman: Move the comment for GetFdts() to the base class
  binman: Use standard filenames for SPL/TPL devicetree
  binman: Allow using an an 'expanded' entry type
  binman: Allow a way to select expanded entries
  binman: Plumb expanded entries through fully
  binman: Automatically expand phase binaries into sections
  Makefile: Pass new entry args to binman
  x86: Make use of binman expanded entries
  x86: dts: Drop unused CONFIG_SPL
  doc: Move UEFI under develop/
  doc: Move driver model docs under develop/
  binman: doc: Add documentation to htmldocs
  binman: Rearrange documentation into headings
  binman: Incorporate entry documentation
  binman: Drop repetitive heading for each entry
  binman: Update various pieces of the documentation

 Makefile                                      |   8 +
 arch/x86/dts/u-boot.dtsi                      |  17 +-
 doc/arch/x86.rst                              |   4 +-
 doc/{ => develop}/driver-model/bind.rst       |   0
 doc/{ => develop}/driver-model/debugging.rst  |   0
 doc/{ => develop}/driver-model/design.rst     |   0
 doc/{ => develop}/driver-model/ethernet.rst   |   0
 doc/{ => develop}/driver-model/fdt-fixup.rst  |   0
 .../driver-model/fs_firmware_loader.rst       |   0
 doc/{ => develop}/driver-model/i2c-howto.rst  |   0
 doc/{ => develop}/driver-model/index.rst      |   4 +
 doc/{ => develop}/driver-model/livetree.rst   |   0
 doc/{ => develop}/driver-model/migration.rst  |   0
 doc/{ => develop}/driver-model/of-plat.rst    |   0
 doc/{ => develop}/driver-model/pci-info.rst   |   0
 .../driver-model/pmic-framework.rst           |   0
 .../driver-model/remoteproc-framework.rst     |   0
 .../driver-model/serial-howto.rst             |   0
 .../driver-model/soc-framework.rst            |   0
 doc/{ => develop}/driver-model/spi-howto.rst  |   0
 doc/{ => develop}/driver-model/usb-info.rst   |   0
 doc/develop/index.rst                         |  10 +
 doc/develop/package/binman.rst                |   1 +
 doc/develop/package/entries.rst               |   1 +
 doc/develop/package/index.rst                 |  19 +
 doc/{ => develop}/uefi/index.rst              |   4 +
 doc/{ => develop}/uefi/iscsi.rst              |   0
 doc/{ => develop}/uefi/u-boot_on_efi.rst      |   0
 doc/{ => develop}/uefi/uefi.rst               |   0
 doc/index.rst                                 |  23 -
 doc/usage/fit.rst                             |   8 +
 doc/usage/index.rst                           |   1 +
 tools/binman/README.rst                       |   1 +
 tools/binman/{README => binman.rst}           | 959 ++++++++++--------
 tools/binman/cmdline.py                       |   5 +-
 tools/binman/control.py                       |  28 +-
 tools/binman/{README.entries => entries.rst}  | 336 ++++--
 tools/binman/entry.py                         |  73 +-
 tools/binman/entry_test.py                    |  12 +
 tools/binman/etype/atf_bl31.py                |   2 +-
 tools/binman/etype/blob.py                    |   4 +-
 tools/binman/etype/blob_dtb.py                |   9 -
 tools/binman/etype/blob_ext.py                |   2 +-
 tools/binman/etype/blob_phase.py              |  51 +
 tools/binman/etype/cbfs.py                    |  12 +-
 tools/binman/etype/fdtmap.py                  |  30 +-
 tools/binman/etype/files.py                   |   2 +-
 tools/binman/etype/fit.py                     |  21 +-
 tools/binman/etype/intel_cmc.py               |   2 +-
 tools/binman/etype/intel_fsp.py               |   2 +-
 tools/binman/etype/intel_fsp_m.py             |   2 +-
 tools/binman/etype/intel_fsp_s.py             |   2 +-
 tools/binman/etype/intel_fsp_t.py             |   2 +-
 tools/binman/etype/intel_ifwi.py              |  10 +-
 tools/binman/etype/intel_me.py                |   2 +-
 tools/binman/etype/intel_mrc.py               |   2 +-
 tools/binman/etype/intel_refcode.py           |   2 +-
 tools/binman/etype/intel_vbt.py               |   2 +-
 tools/binman/etype/intel_vga.py               |   2 +-
 tools/binman/etype/mkimage.py                 |   4 +-
 tools/binman/etype/scp.py                     |   2 +-
 tools/binman/etype/section.py                 |  15 +-
 tools/binman/etype/text.py                    |   6 +-
 tools/binman/etype/u_boot.py                  |   8 +-
 tools/binman/etype/u_boot_dtb_with_ucode.py   |   4 +-
 tools/binman/etype/u_boot_expanded.py         |  24 +
 tools/binman/etype/u_boot_nodtb.py            |   8 +-
 tools/binman/etype/u_boot_spl.py              |   3 +
 tools/binman/etype/u_boot_spl_bss_pad.py      |  17 +-
 tools/binman/etype/u_boot_spl_expanded.py     |  45 +
 tools/binman/etype/u_boot_spl_nodtb.py        |  24 +-
 tools/binman/etype/u_boot_tpl.py              |   3 +
 tools/binman/etype/u_boot_tpl_bss_pad.py      |  44 +
 tools/binman/etype/u_boot_tpl_expanded.py     |  45 +
 tools/binman/etype/u_boot_tpl_nodtb.py        |  42 +
 tools/binman/etype/u_boot_with_ucode_ptr.py   |   2 +-
 tools/binman/ftest.py                         | 268 ++++-
 tools/binman/image.py                         |  17 +-
 tools/binman/index.rst                        |   9 +
 tools/binman/setup.py                         |   2 +-
 tools/binman/state.py                         |  71 +-
 tools/binman/test/053_symbols.dts             |   2 +-
 tools/binman/test/149_symbols_tpl.dts         |   1 -
 tools/binman/test/155_symbols_tpl_x86.dts     |   1 -
 tools/binman/test/192_symbols_nodtb.dts       |  26 +
 tools/binman/test/192_u_boot_tpl_nodtb.dts    |  13 +
 tools/binman/test/193_tpl_bss_pad.dts         |  19 +
 tools/binman/test/194_fdt_incl.dts            |  17 +
 tools/binman/test/195_fdt_incl_tpl.dts        |  13 +
 tools/binman/test/u_boot_binman_syms.c        |   2 +-
 tools/patman/tools.py                         |   8 +-
 91 files changed, 1697 insertions(+), 745 deletions(-)
 rename doc/{ => develop}/driver-model/bind.rst (100%)
 rename doc/{ => develop}/driver-model/debugging.rst (100%)
 rename doc/{ => develop}/driver-model/design.rst (100%)
 rename doc/{ => develop}/driver-model/ethernet.rst (100%)
 rename doc/{ => develop}/driver-model/fdt-fixup.rst (100%)
 rename doc/{ => develop}/driver-model/fs_firmware_loader.rst (100%)
 rename doc/{ => develop}/driver-model/i2c-howto.rst (100%)
 rename doc/{ => develop}/driver-model/index.rst (68%)
 rename doc/{ => develop}/driver-model/livetree.rst (100%)
 rename doc/{ => develop}/driver-model/migration.rst (100%)
 rename doc/{ => develop}/driver-model/of-plat.rst (100%)
 rename doc/{ => develop}/driver-model/pci-info.rst (100%)
 rename doc/{ => develop}/driver-model/pmic-framework.rst (100%)
 rename doc/{ => develop}/driver-model/remoteproc-framework.rst (100%)
 rename doc/{ => develop}/driver-model/serial-howto.rst (100%)
 rename doc/{ => develop}/driver-model/soc-framework.rst (100%)
 rename doc/{ => develop}/driver-model/spi-howto.rst (100%)
 rename doc/{ => develop}/driver-model/usb-info.rst (100%)
 create mode 120000 doc/develop/package/binman.rst
 create mode 120000 doc/develop/package/entries.rst
 create mode 100644 doc/develop/package/index.rst
 rename doc/{ => develop}/uefi/index.rst (51%)
 rename doc/{ => develop}/uefi/iscsi.rst (100%)
 rename doc/{ => develop}/uefi/u-boot_on_efi.rst (100%)
 rename doc/{ => develop}/uefi/uefi.rst (100%)
 create mode 100644 doc/usage/fit.rst
 create mode 120000 tools/binman/README.rst
 rename tools/binman/{README => binman.rst} (64%)
 rename tools/binman/{README.entries => entries.rst} (82%)
 create mode 100644 tools/binman/etype/blob_phase.py
 create mode 100644 tools/binman/etype/u_boot_expanded.py
 create mode 100644 tools/binman/etype/u_boot_spl_expanded.py
 create mode 100644 tools/binman/etype/u_boot_tpl_bss_pad.py
 create mode 100644 tools/binman/etype/u_boot_tpl_expanded.py
 create mode 100644 tools/binman/etype/u_boot_tpl_nodtb.py
 create mode 100644 tools/binman/index.rst
 create mode 100644 tools/binman/test/192_symbols_nodtb.dts
 create mode 100644 tools/binman/test/192_u_boot_tpl_nodtb.dts
 create mode 100644 tools/binman/test/193_tpl_bss_pad.dts
 create mode 100644 tools/binman/test/194_fdt_incl.dts
 create mode 100644 tools/binman/test/195_fdt_incl_tpl.dts

-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 01/27] binman: Allow extracting to current directory
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
@ 2021-03-18  7:24 ` Simon Glass
  2021-03-18  7:24 ` [PATCH v3 02/27] binman: Document ExpandEntries() in the base class Simon Glass
                   ` (51 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:24 UTC (permalink / raw)
  To: u-boot

Extracting files to the current directory is not normally a very friendly
thing to do, but it can be warranted, e.g. in a new temporary dir. At
present binman reports an error when such an attempt is made. Fix it.

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

(no changes since v1)

 tools/binman/control.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/binman/control.py b/tools/binman/control.py
index 1952b2abf48..9c0cafeafc4 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -241,7 +241,7 @@ def ExtractEntries(image_fname, output_fname, outdir, entry_paths,
         # If this entry has children, create a directory for it and put its
         # data in a file called 'root' in that directory
         if entry.GetEntries():
-            if not os.path.exists(fname):
+            if fname and not os.path.exists(fname):
                 os.makedirs(fname)
             fname = os.path.join(fname, 'root')
         tout.Notice("Write entry '%s' size %x to '%s'" %
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 02/27] binman: Document ExpandEntries() in the base class
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
  2021-03-18  7:24 ` [PATCH v3 01/27] binman: Allow extracting to current directory Simon Glass
@ 2021-03-18  7:24 ` Simon Glass
  2021-03-18  7:24 ` [PATCH v3 03/27] binman: Update entry help for files-align Simon Glass
                   ` (50 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:24 UTC (permalink / raw)
  To: u-boot

Move the documentation to the base method as it is with other methods.
Also update it a little while we are here.

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

(no changes since v1)

 tools/binman/entry.py         | 11 +++++++++++
 tools/binman/etype/section.py |  6 ------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index d58a730f3d5..507760e2a86 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -211,6 +211,17 @@ class Entry(object):
         return {}
 
     def ExpandEntries(self):
+        """Expand out entries which produce other entries
+
+        Some entries generate subnodes automatically, from which sub-entries
+        are then created. This method allows those to be added to the binman
+        definition for the current image. An entry which implements this method
+        should call state.AddSubnode() to add a subnode and can add properties
+        with state.AddString(), etc.
+
+        An example is 'files', which produces a section containing a list of
+        files.
+        """
         pass
 
     def AddMissingProperties(self, have_image_pos):
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 1ceadef13f3..2103919b0c3 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -126,12 +126,6 @@ class Entry_section(Entry):
         return True
 
     def ExpandEntries(self):
-        """Expand out any entries which have calculated sub-entries
-
-        Some entries are expanded out at runtime, e.g. 'files', which produces
-        a section containing a list of files. Process these entries so that
-        this information is added to the device tree.
-        """
         super().ExpandEntries()
         for entry in self._entries.values():
             entry.ExpandEntries()
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 03/27] binman: Update entry help for files-align
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
  2021-03-18  7:24 ` [PATCH v3 01/27] binman: Allow extracting to current directory Simon Glass
  2021-03-18  7:24 ` [PATCH v3 02/27] binman: Document ExpandEntries() in the base class Simon Glass
@ 2021-03-18  7:24 ` Simon Glass
  2021-03-18  7:24 ` [PATCH v3 04/27] binman: Tidy up underscores in entry documentation Simon Glass
                   ` (49 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:24 UTC (permalink / raw)
  To: u-boot

Regenerate the entry documentation, which step was missed when the
files-align feature was added.

Fixes: 6eb9932668f ("binman: Support alignment of files")

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

(no changes since v1)

 tools/binman/README.entries | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 999b77690f0..7cca030409e 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -302,6 +302,7 @@ Properties / Entry arguments:
     - files-compress: Compression algorithm to use:
         none: No compression
         lz4: Use lz4 compression (via 'lz4' command-line utility)
+    - files-align: Align each file to the given alignment
 
 This entry reads a number of files and places each in a separate sub-entry
 within this entry. To access these you need to enable device-tree updates
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 04/27] binman: Tidy up underscores in entry documentation
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (2 preceding siblings ...)
  2021-03-18  7:24 ` [PATCH v3 03/27] binman: Update entry help for files-align Simon Glass
@ 2021-03-18  7:24 ` Simon Glass
  2021-03-18  7:24 ` [PATCH v3 05/27] binman: Correct the documentation for u-boot-spl-bss-pad Simon Glass
                   ` (48 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:24 UTC (permalink / raw)
  To: u-boot

Several entries currently use an underscore in the entry-type name, but in
fact a hyphen is used. Update the docs to fix this as it might be
confusing.

Also simplify the 'filename' comment and fix the 'operation' typo.

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

(no changes since v1)

 tools/binman/README.entries                 | 23 ++++++++++-----------
 tools/binman/etype/blob.py                  |  2 +-
 tools/binman/etype/u_boot.py                |  2 +-
 tools/binman/etype/u_boot_dtb_with_ucode.py |  4 ++--
 tools/binman/etype/u_boot_nodtb.py          |  6 +++---
 tools/binman/etype/u_boot_spl_nodtb.py      |  7 +++----
 tools/binman/etype/u_boot_with_ucode_ptr.py |  2 +-
 7 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 7cca030409e..3fbc06d9264 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -39,7 +39,7 @@ Properties / Entry arguments:
 
 This entry reads data from a file and places it in the entry. The
 default filename is often specified specified by the subclass. See for
-example the 'u_boot' entry which provides the filename 'u-boot.bin'.
+example the 'u-boot' entry which provides the filename 'u-boot.bin'.
 
 If compression is enabled, an extra 'uncomp-size' property is written to
 the node (if enabled with -u) which provides the uncompressed size of the
@@ -840,7 +840,7 @@ Properties / Entry arguments:
 
 This is the U-Boot binary, containing relocation information to allow it
 to relocate itself at runtime. The binary typically includes a device tree
-blob at the end of it. Use u_boot_nodtb if you want to package the device
+blob at the end of it. Use u-boot-nodtb if you want to package the device
 tree separately.
 
 U-Boot can access binman symbols at runtime. See:
@@ -876,9 +876,9 @@ See Entry_u_boot_ucode for full details of the three entries involved in
 this process. This entry provides the U-Boot device-tree file, which
 contains the microcode. If the microcode is not being collated into one
 place then the offset and size of the microcode is recorded by this entry,
-for use by u_boot_with_ucode_ptr. If it is being collated, then this
+for use by u-boot-with-ucode_ptr. If it is being collated, then this
 entry deletes the microcode from the device tree (to save space) and makes
-it available to u_boot_ucode.
+it available to u-boot-ucode.
 
 
 
@@ -920,12 +920,12 @@ Entry: u-boot-nodtb: U-Boot flat binary without device tree appended
 --------------------------------------------------------------------
 
 Properties / Entry arguments:
-    - filename: Filename of u-boot.bin (default 'u-boot-nodtb.bin')
+    - filename: Filename to include (default 'u-boot-nodtb.bin')
 
 This is the U-Boot binary, containing relocation information to allow it
 to relocate itself at runtime. It does not include a device tree blob at
-the end of it so normally cannot work without it. You can add a u_boot_dtb
-entry after this one, or use a u_boot entry instead (which contains both
+the end of it so normally cannot work without it. You can add a u-boot-dtb
+entry after this one, or use a u-boot entry instead (which contains both
 U-Boot and the device tree).
 
 
@@ -1000,13 +1000,12 @@ Entry: u-boot-spl-nodtb: SPL binary without device tree appended
 ----------------------------------------------------------------
 
 Properties / Entry arguments:
-    - filename: Filename of spl/u-boot-spl-nodtb.bin (default
-        'spl/u-boot-spl-nodtb.bin')
+    - filename: Filename to include (default 'spl/u-boot-spl-nodtb.bin')
 
 This is the U-Boot SPL binary, It does not include a device tree blob at
 the end of it so may not be able to work without it, assuming SPL needs
-a device tree to operation on your platform. You can add a u_boot_spl_dtb
-entry after this one, or use a u_boot_spl entry instead (which contains
+a device tree to operate on your platform. You can add a u-boot-spl-dtb
+entry after this one, or use a u-boot-spl entry instead (which contains
 both SPL and the device tree).
 
 
@@ -1148,7 +1147,7 @@ Properties / Entry arguments:
 See Entry_u_boot_ucode for full details of the three entries involved in
 this process. This entry updates U-Boot with the offset and size of the
 microcode, to allow early x86 boot code to find it without doing anything
-complicated. Otherwise it is the same as the u_boot entry.
+complicated. Otherwise it is the same as the u-boot entry.
 
 
 
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index 81756c326d9..e609a8b253f 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -24,7 +24,7 @@ class Entry_blob(Entry):
 
     This entry reads data from a file and places it in the entry. The
     default filename is often specified specified by the subclass. See for
-    example the 'u_boot' entry which provides the filename 'u-boot.bin'.
+    example the 'u-boot' entry which provides the filename 'u-boot.bin'.
 
     If compression is enabled, an extra 'uncomp-size' property is written to
     the node (if enabled with -u) which provides the uncompressed size of the
diff --git a/tools/binman/etype/u_boot.py b/tools/binman/etype/u_boot.py
index 4767197e13a..de783b26772 100644
--- a/tools/binman/etype/u_boot.py
+++ b/tools/binman/etype/u_boot.py
@@ -16,7 +16,7 @@ class Entry_u_boot(Entry_blob):
 
     This is the U-Boot binary, containing relocation information to allow it
     to relocate itself at runtime. The binary typically includes a device tree
-    blob at the end of it. Use u_boot_nodtb if you want to package the device
+    blob at the end of it. Use u-boot-nodtb if you want to package the device
     tree separately.
 
     U-Boot can access binman symbols at runtime. See:
diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py
index 66a9db55cad..554b3b2e008 100644
--- a/tools/binman/etype/u_boot_dtb_with_ucode.py
+++ b/tools/binman/etype/u_boot_dtb_with_ucode.py
@@ -19,9 +19,9 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
     this process. This entry provides the U-Boot device-tree file, which
     contains the microcode. If the microcode is not being collated into one
     place then the offset and size of the microcode is recorded by this entry,
-    for use by u_boot_with_ucode_ptr. If it is being collated, then this
+    for use by u-boot-with-ucode_ptr. If it is being collated, then this
     entry deletes the microcode from the device tree (to save space) and makes
-    it available to u_boot_ucode.
+    it available to u-boot-ucode.
     """
     def __init__(self, section, etype, node):
         # Put this here to allow entry-docs and help to work without libfdt
diff --git a/tools/binman/etype/u_boot_nodtb.py b/tools/binman/etype/u_boot_nodtb.py
index e84df490f65..289b24fa6c6 100644
--- a/tools/binman/etype/u_boot_nodtb.py
+++ b/tools/binman/etype/u_boot_nodtb.py
@@ -12,12 +12,12 @@ class Entry_u_boot_nodtb(Entry_blob):
     """U-Boot flat binary without device tree appended
 
     Properties / Entry arguments:
-        - filename: Filename of u-boot.bin (default 'u-boot-nodtb.bin')
+        - filename: Filename to include (default 'u-boot-nodtb.bin')
 
     This is the U-Boot binary, containing relocation information to allow it
     to relocate itself at runtime. It does not include a device tree blob at
-    the end of it so normally cannot work without it. You can add a u_boot_dtb
-    entry after this one, or use a u_boot entry instead (which contains both
+    the end of it so normally cannot work without it. You can add a u-boot-dtb
+    entry after this one, or use a u-boot entry instead (which contains both
     U-Boot and the device tree).
     """
     def __init__(self, section, etype, node):
diff --git a/tools/binman/etype/u_boot_spl_nodtb.py b/tools/binman/etype/u_boot_spl_nodtb.py
index c154cfde57b..41d75054910 100644
--- a/tools/binman/etype/u_boot_spl_nodtb.py
+++ b/tools/binman/etype/u_boot_spl_nodtb.py
@@ -12,13 +12,12 @@ class Entry_u_boot_spl_nodtb(Entry_blob):
     """SPL binary without device tree appended
 
     Properties / Entry arguments:
-        - filename: Filename of spl/u-boot-spl-nodtb.bin (default
-            'spl/u-boot-spl-nodtb.bin')
+        - filename: Filename to include (default 'spl/u-boot-spl-nodtb.bin')
 
     This is the U-Boot SPL binary, It does not include a device tree blob at
     the end of it so may not be able to work without it, assuming SPL needs
-    a device tree to operation on your platform. You can add a u_boot_spl_dtb
-    entry after this one, or use a u_boot_spl entry instead (which contains
+    a device tree to operate on your platform. You can add a u-boot-spl-dtb
+    entry after this one, or use a u-boot-spl entry instead (which contains
     both SPL and the device tree).
     """
     def __init__(self, section, etype, node):
diff --git a/tools/binman/etype/u_boot_with_ucode_ptr.py b/tools/binman/etype/u_boot_with_ucode_ptr.py
index 92d2fc68538..20be22a1fd2 100644
--- a/tools/binman/etype/u_boot_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_with_ucode_ptr.py
@@ -26,7 +26,7 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob):
     See Entry_u_boot_ucode for full details of the three entries involved in
     this process. This entry updates U-Boot with the offset and size of the
     microcode, to allow early x86 boot code to find it without doing anything
-    complicated. Otherwise it is the same as the u_boot entry.
+    complicated. Otherwise it is the same as the u-boot entry.
     """
     def __init__(self, section, etype, node):
         super().__init__(section, etype, node)
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 05/27] binman: Correct the documentation for u-boot-spl-bss-pad
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (3 preceding siblings ...)
  2021-03-18  7:24 ` [PATCH v3 04/27] binman: Tidy up underscores in entry documentation Simon Glass
@ 2021-03-18  7:24 ` Simon Glass
  2021-03-18  7:24 ` [PATCH v3 06/27] binman: Support symbols in u-boot-spl-nodtb Simon Glass
                   ` (47 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:24 UTC (permalink / raw)
  To: u-boot

The documentation for this entry indicates that the SPL binary is included
along with the padding. It is not, so update it to correct the error.

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

(no changes since v1)

 tools/binman/README.entries              | 17 ++++++++++-------
 tools/binman/etype/u_boot_spl_bss_pad.py | 17 ++++++++++-------
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 3fbc06d9264..5c6663e2c7c 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -960,13 +960,16 @@ Entry: u-boot-spl-bss-pad: U-Boot SPL binary padded with a BSS region
 Properties / Entry arguments:
     None
 
-This is similar to u_boot_spl except that padding is added after the SPL
-binary to cover the BSS (Block Started by Symbol) region. This region holds
-the various used by SPL. It is set to 0 by SPL when it starts up. If you
-want to append data to the SPL image (such as a device tree file), you must
-pad out the BSS region to avoid the data overlapping with U-Boot variables.
-This entry is useful in that case. It automatically pads out the entry size
-to cover both the code, data and BSS.
+This holds the padding added after the SPL binary to cover the BSS (Block
+Started by Symbol) region. This region holds the various variables used by
+SPL. It is set to 0 by SPL when it starts up. If you want to append data to
+the SPL image (such as a device tree file), you must pad out the BSS region
+to avoid the data overlapping with U-Boot variables. This entry is useful in
+that case. It automatically pads out the entry size to cover both the code,
+data and BSS.
+
+The contents of this entry will a certain number of zero bytes, determined
+by __bss_size
 
 The ELF file 'spl/u-boot-spl' must also be available for this to work, since
 binman uses that to look up the BSS address.
diff --git a/tools/binman/etype/u_boot_spl_bss_pad.py b/tools/binman/etype/u_boot_spl_bss_pad.py
index df15cd24ce7..18c5596bd35 100644
--- a/tools/binman/etype/u_boot_spl_bss_pad.py
+++ b/tools/binman/etype/u_boot_spl_bss_pad.py
@@ -18,13 +18,16 @@ class Entry_u_boot_spl_bss_pad(Entry_blob):
     Properties / Entry arguments:
         None
 
-    This is similar to u_boot_spl except that padding is added after the SPL
-    binary to cover the BSS (Block Started by Symbol) region. This region holds
-    the various used by SPL. It is set to 0 by SPL when it starts up. If you
-    want to append data to the SPL image (such as a device tree file), you must
-    pad out the BSS region to avoid the data overlapping with U-Boot variables.
-    This entry is useful in that case. It automatically pads out the entry size
-    to cover both the code, data and BSS.
+    This holds the padding added after the SPL binary to cover the BSS (Block
+    Started by Symbol) region. This region holds the various variables used by
+    SPL. It is set to 0 by SPL when it starts up. If you want to append data to
+    the SPL image (such as a device tree file), you must pad out the BSS region
+    to avoid the data overlapping with U-Boot variables. This entry is useful in
+    that case. It automatically pads out the entry size to cover both the code,
+    data and BSS.
+
+    The contents of this entry will a certain number of zero bytes, determined
+    by __bss_size
 
     The ELF file 'spl/u-boot-spl' must also be available for this to work, since
     binman uses that to look up the BSS address.
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 06/27] binman: Support symbols in u-boot-spl-nodtb
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (4 preceding siblings ...)
  2021-03-18  7:24 ` [PATCH v3 05/27] binman: Correct the documentation for u-boot-spl-bss-pad Simon Glass
@ 2021-03-18  7:24 ` Simon Glass
  2021-03-18  7:24 ` [PATCH v3 07/27] binman: Add support for u-boot-tpl-nodtb Simon Glass
                   ` (46 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:24 UTC (permalink / raw)
  To: u-boot

Since this is an execuable we should be able insert symbol values into it.
Add support for this.

Use common code for this test and the original testSymbols. Use hex
consistently for the values and add some more comments.

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

Changes in v3:
- Add new patch to support symbols in u-boot-spl-nodtb

 tools/binman/README.entries             |  9 +++++
 tools/binman/etype/u_boot_spl_nodtb.py  | 14 +++++++
 tools/binman/ftest.py                   | 49 +++++++++++++++----------
 tools/binman/test/053_symbols.dts       |  2 +-
 tools/binman/test/192_symbols_nodtb.dts | 26 +++++++++++++
 tools/binman/test/u_boot_binman_syms.c  |  2 +-
 6 files changed, 81 insertions(+), 21 deletions(-)
 create mode 100644 tools/binman/test/192_symbols_nodtb.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 5c6663e2c7c..1dbdd0be03d 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -1011,6 +1011,15 @@ a device tree to operate on your platform. You can add a u-boot-spl-dtb
 entry after this one, or use a u-boot-spl entry instead (which contains
 both SPL and the device tree).
 
+SPL can access binman symbols at runtime. See:
+
+    'Access to binman entry offsets at run time (symbols)'
+
+in the binman README for more information.
+
+The ELF file 'spl/u-boot-spl' must also be available for this to work, since
+binman uses that to look up symbols to write into the SPL binary.
+
 
 
 Entry: u-boot-spl-with-ucode-ptr: U-Boot SPL with embedded microcode pointer
diff --git a/tools/binman/etype/u_boot_spl_nodtb.py b/tools/binman/etype/u_boot_spl_nodtb.py
index 41d75054910..dbf2f12743a 100644
--- a/tools/binman/etype/u_boot_spl_nodtb.py
+++ b/tools/binman/etype/u_boot_spl_nodtb.py
@@ -5,6 +5,7 @@
 # Entry-type module for 'u-boot-spl-nodtb.bin'
 #
 
+from binman import elf
 from binman.entry import Entry
 from binman.etype.blob import Entry_blob
 
@@ -19,9 +20,22 @@ class Entry_u_boot_spl_nodtb(Entry_blob):
     a device tree to operate on your platform. You can add a u-boot-spl-dtb
     entry after this one, or use a u-boot-spl entry instead (which contains
     both SPL and the device tree).
+
+    SPL can access binman symbols at runtime. See:
+
+        'Access to binman entry offsets at run time (symbols)'
+
+    in the binman README for more information.
+
+    The ELF file 'spl/u-boot-spl' must also be available for this to work, since
+    binman uses that to look up symbols to write into the SPL binary.
     """
     def __init__(self, section, etype, node):
         super().__init__(section, etype, node)
+        self.elf_fname = 'spl/u-boot-spl'
 
     def GetDefaultFilename(self):
         return 'spl/u-boot-spl-nodtb.bin'
+
+    def WriteSymbols(self, section):
+        elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage())
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 814e91d42e9..e056601b9a4 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1337,21 +1337,43 @@ class TestFunctional(unittest.TestCase):
         data = self._DoReadFile('052_u_boot_spl_nodtb.dts')
         self.assertEqual(U_BOOT_SPL_NODTB_DATA, data[:len(U_BOOT_SPL_NODTB_DATA)])
 
-    def testSymbols(self):
-        """Test binman can assign symbols embedded in U-Boot"""
+    def checkSymbols(self, dts, base_data, u_boot_offset):
+        """Check the image contains the expected symbol values
+
+        Args:
+            dts: Device tree file to use for test
+            base_data: Data before and after 'u-boot' section
+            u_boot_offset: Offset of 'u-boot' section in image
+        """
         elf_fname = self.ElfTestFile('u_boot_binman_syms')
         syms = elf.GetSymbols(elf_fname, ['binman', 'image'])
         addr = elf.GetSymbolAddress(elf_fname, '__image_copy_start')
-        self.assertEqual(syms['_binman_u_boot_spl_prop_offset'].address, addr)
+        self.assertEqual(syms['_binman_u_boot_spl_any_prop_offset'].address,
+                         addr)
 
         self._SetupSplElf('u_boot_binman_syms')
-        data = self._DoReadFile('053_symbols.dts')
-        sym_values = struct.pack('<LQLL', 0x00, 0x1c, 0x28, 0x04)
-        expected = (sym_values + U_BOOT_SPL_DATA[20:] +
+        data = self._DoReadFile(dts)
+        # The image should contain the symbols from u_boot_binman_syms.c
+        # Note that image_pos is adjusted by the base address of the image,
+        # which is 0x10 in our test image
+        sym_values = struct.pack('<LQLL', 0x00,
+                                 u_boot_offset + len(U_BOOT_DATA),
+                                 0x10 + u_boot_offset, 0x04)
+        expected = (sym_values + base_data[20:] +
                     tools.GetBytes(0xff, 1) + U_BOOT_DATA + sym_values +
-                    U_BOOT_SPL_DATA[20:])
+                    base_data[20:])
         self.assertEqual(expected, data)
 
+    def testSymbols(self):
+        """Test binman can assign symbols embedded in U-Boot"""
+        self.checkSymbols('053_symbols.dts', U_BOOT_SPL_DATA, 0x18)
+
+    def testSymbolsNoDtb(self):
+        """Test binman can assign symbols embedded in U-Boot SPL"""
+        self.checkSymbols('192_symbols_nodtb.dts',
+                          U_BOOT_SPL_NODTB_DATA + U_BOOT_SPL_DTB_DATA,
+                          0x38)
+
     def testPackUnitAddress(self):
         """Test that we support multiple binaries with the same name"""
         data = self._DoReadFile('054_unit_address.dts')
@@ -4186,18 +4208,7 @@ class TestFunctional(unittest.TestCase):
 
     def testSymbolsSubsection(self):
         """Test binman can assign symbols from a subsection"""
-        elf_fname = self.ElfTestFile('u_boot_binman_syms')
-        syms = elf.GetSymbols(elf_fname, ['binman', 'image'])
-        addr = elf.GetSymbolAddress(elf_fname, '__image_copy_start')
-        self.assertEqual(syms['_binman_u_boot_spl_prop_offset'].address, addr)
-
-        self._SetupSplElf('u_boot_binman_syms')
-        data = self._DoReadFile('187_symbols_sub.dts')
-        sym_values = struct.pack('<LQLL', 0x00, 0x1c, 0x28, 0x04)
-        expected = (sym_values + U_BOOT_SPL_DATA[20:] +
-                    tools.GetBytes(0xff, 1) + U_BOOT_DATA + sym_values +
-                    U_BOOT_SPL_DATA[20:])
-        self.assertEqual(expected, data)
+        self.checkSymbols('187_symbols_sub.dts', U_BOOT_SPL_DATA, 0x18)
 
     def testReadImageEntryArg(self):
         """Test reading an image that would need an entry arg to generate"""
diff --git a/tools/binman/test/053_symbols.dts b/tools/binman/test/053_symbols.dts
index 8af575158f5..29658092764 100644
--- a/tools/binman/test/053_symbols.dts
+++ b/tools/binman/test/053_symbols.dts
@@ -10,7 +10,7 @@
 		};
 
 		u-boot {
-			offset = <24>;
+			offset = <0x18>;
 		};
 
 		u-boot-spl2 {
diff --git a/tools/binman/test/192_symbols_nodtb.dts b/tools/binman/test/192_symbols_nodtb.dts
new file mode 100644
index 00000000000..5c900d60709
--- /dev/null
+++ b/tools/binman/test/192_symbols_nodtb.dts
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		pad-byte = <0xff>;
+		u-boot-spl-nodtb {
+		};
+		u-boot-spl-dtb {
+		};
+
+		u-boot {
+			offset = <0x38>;
+		};
+
+		u-boot-spl2 {
+			type = "u-boot-spl-nodtb";
+		};
+		u-boot-spl-dtb2 {
+			type = "u-boot-spl-dtb";
+		};
+	};
+};
diff --git a/tools/binman/test/u_boot_binman_syms.c b/tools/binman/test/u_boot_binman_syms.c
index 4520b319f16..37fc339ce84 100644
--- a/tools/binman/test/u_boot_binman_syms.c
+++ b/tools/binman/test/u_boot_binman_syms.c
@@ -8,7 +8,7 @@
 #define CONFIG_BINMAN
 #include <binman_sym.h>
 
-binman_sym_declare(unsigned long, u_boot_spl, offset);
+binman_sym_declare(unsigned long, u_boot_spl_any, offset);
 binman_sym_declare(unsigned long long, u_boot_spl2, offset);
 binman_sym_declare(unsigned long, u_boot_any, image_pos);
 binman_sym_declare(unsigned long, u_boot_any, size);
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 07/27] binman: Add support for u-boot-tpl-nodtb
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (5 preceding siblings ...)
  2021-03-18  7:24 ` [PATCH v3 06/27] binman: Support symbols in u-boot-spl-nodtb Simon Glass
@ 2021-03-18  7:24 ` Simon Glass
  2021-03-18  7:24 ` [PATCH v3 08/27] binman: Add support for u-boot-tpl-bss-bad Simon Glass
                   ` (45 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:24 UTC (permalink / raw)
  To: u-boot

Allow this entry type to be placed in an image. This is the TPL binary,
without a devicetree appended.

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

(no changes since v1)

 tools/binman/README.entries                | 23 ++++++++++++
 tools/binman/etype/u_boot_tpl_nodtb.py     | 41 ++++++++++++++++++++++
 tools/binman/ftest.py                      |  6 ++++
 tools/binman/test/192_u_boot_tpl_nodtb.dts | 13 +++++++
 4 files changed, 83 insertions(+)
 create mode 100644 tools/binman/etype/u_boot_tpl_nodtb.py
 create mode 100644 tools/binman/test/192_u_boot_tpl_nodtb.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 1dbdd0be03d..8651ba05f29 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -1089,6 +1089,29 @@ be relocated to any address for execution.
 
 
 
+Entry: u-boot-tpl-nodtb: TPL binary without device tree appended
+----------------------------------------------------------------
+
+Properties / Entry arguments:
+    - filename: Filename to include (default 'tpl/u-boot-tpl-nodtb.bin')
+
+This is the U-Boot TPL binary, It does not include a device tree blob at
+the end of it so may not be able to work without it, assuming TPL needs
+a device tree to operate on your platform. You can add a u-boot-tpl-dtb
+entry after this one, or use a u-boot-tpl entry instead (which contains
+both TPL and the device tree).
+
+TPL can access binman symbols at runtime. See:
+
+    'Access to binman entry offsets at run time (symbols)'
+
+in the binman README for more information.
+
+The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since
+binman uses that to look up symbols to write into the TPL binary.
+
+
+
 Entry: u-boot-tpl-with-ucode-ptr: U-Boot TPL with embedded microcode pointer
 ----------------------------------------------------------------------------
 
diff --git a/tools/binman/etype/u_boot_tpl_nodtb.py b/tools/binman/etype/u_boot_tpl_nodtb.py
new file mode 100644
index 00000000000..9a47f599bf1
--- /dev/null
+++ b/tools/binman/etype/u_boot_tpl_nodtb.py
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2021 Google LLC
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for 'u-boot-tpl-nodtb.bin'
+#
+
+from binman import elf
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+
+class Entry_u_boot_tpl_nodtb(Entry_blob):
+    """TPL binary without device tree appended
+
+    Properties / Entry arguments:
+        - filename: Filename to include (default 'tpl/u-boot-tpl-nodtb.bin')
+
+    This is the U-Boot TPL binary, It does not include a device tree blob at
+    the end of it so may not be able to work without it, assuming TPL needs
+    a device tree to operate on your platform. You can add a u-boot-tpl-dtb
+    entry after this one, or use a u-boot-tpl entry instead (which contains
+    both TPL and the device tree).
+
+    TPL can access binman symbols at runtime. See:
+
+        'Access to binman entry offsets at run time (symbols)'
+
+    in the binman README for more information.
+
+    The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since
+    binman uses that to look up symbols to write into the TPL binary.
+    """
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node)
+        self.elf_fname = 'tpl/u-boot-tpl'
+
+    def GetDefaultFilename(self):
+        return 'tpl/u-boot-tpl-nodtb.bin'
+
+    def WriteSymbols(self, section):
+        elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage())
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index e056601b9a4..684e507e6ed 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -4256,6 +4256,12 @@ class TestFunctional(unittest.TestCase):
 
         self.assertEquals(U_BOOT_DATA, u_boot.ReadData())
 
+    def testTplNoDtb(self):
+        """Test that an image with tpl/u-boot-tpl-nodtb.bin can be created"""
+        data = self._DoReadFile('192_u_boot_tpl_nodtb.dts')
+        self.assertEqual(U_BOOT_TPL_NODTB_DATA,
+                         data[:len(U_BOOT_TPL_NODTB_DATA)])
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/192_u_boot_tpl_nodtb.dts b/tools/binman/test/192_u_boot_tpl_nodtb.dts
new file mode 100644
index 00000000000..94cef395e89
--- /dev/null
+++ b/tools/binman/test/192_u_boot_tpl_nodtb.dts
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		u-boot-tpl-nodtb {
+		};
+	};
+};
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 08/27] binman: Add support for u-boot-tpl-bss-bad
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (6 preceding siblings ...)
  2021-03-18  7:24 ` [PATCH v3 07/27] binman: Add support for u-boot-tpl-nodtb Simon Glass
@ 2021-03-18  7:24 ` Simon Glass
  2021-03-18  7:24 ` [PATCH v3 09/27] binman: Drop unnecessary 'type' property in tests Simon Glass
                   ` (44 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:24 UTC (permalink / raw)
  To: u-boot

This entry holds the padding between the end of of TPL binary and the
end of BSS. This region must be left empty so that the devicetree can be
appended correctly and remain accessible without interfering with BSS.

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

(no changes since v1)

 tools/binman/README.entries              | 22 ++++++++++++
 tools/binman/etype/u_boot_tpl_bss_pad.py | 44 ++++++++++++++++++++++++
 tools/binman/ftest.py                    | 16 +++++++++
 tools/binman/test/193_tpl_bss_pad.dts    | 19 ++++++++++
 4 files changed, 101 insertions(+)
 create mode 100644 tools/binman/etype/u_boot_tpl_bss_pad.py
 create mode 100644 tools/binman/test/193_tpl_bss_pad.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 8651ba05f29..368c976497d 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -1056,6 +1056,28 @@ binman uses that to look up symbols to write into the TPL binary.
 
 
 
+Entry: u-boot-tpl-bss-pad: U-Boot TPL binary padded with a BSS region
+---------------------------------------------------------------------
+
+Properties / Entry arguments:
+    None
+
+This holds the padding added after the TPL binary to cover the BSS (Block
+Started by Symbol) region. This region holds the various variables used by
+TPL. It is set to 0 by TPL when it starts up. If you want to append data to
+the TPL image (such as a device tree file), you must pad out the BSS region
+to avoid the data overlapping with U-Boot variables. This entry is useful in
+that case. It automatically pads out the entry size to cover both the code,
+data and BSS.
+
+The contents of this entry will a certain number of zero bytes, determined
+by __bss_size
+
+The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since
+binman uses that to look up the BSS address.
+
+
+
 Entry: u-boot-tpl-dtb: U-Boot TPL device tree
 ---------------------------------------------
 
diff --git a/tools/binman/etype/u_boot_tpl_bss_pad.py b/tools/binman/etype/u_boot_tpl_bss_pad.py
new file mode 100644
index 00000000000..521b24a384e
--- /dev/null
+++ b/tools/binman/etype/u_boot_tpl_bss_pad.py
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2021 Google LLC
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for BSS padding for tpl/u-boot-tpl.bin. This padding
+# can be added after the TPL binary to ensure that anything concatenated
+# to it will appear to TPL to be at the end of BSS rather than the start.
+#
+
+from binman import elf
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+from patman import tools
+
+class Entry_u_boot_tpl_bss_pad(Entry_blob):
+    """U-Boot TPL binary padded with a BSS region
+
+    Properties / Entry arguments:
+        None
+
+    This holds the padding added after the TPL binary to cover the BSS (Block
+    Started by Symbol) region. This region holds the various variables used by
+    TPL. It is set to 0 by TPL when it starts up. If you want to append data to
+    the TPL image (such as a device tree file), you must pad out the BSS region
+    to avoid the data overlapping with U-Boot variables. This entry is useful in
+    that case. It automatically pads out the entry size to cover both the code,
+    data and BSS.
+
+    The contents of this entry will a certain number of zero bytes, determined
+    by __bss_size
+
+    The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since
+    binman uses that to look up the BSS address.
+    """
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node)
+
+    def ObtainContents(self):
+        fname = tools.GetInputFilename('tpl/u-boot-tpl')
+        bss_size = elf.GetSymbolAddress(fname, '__bss_size')
+        if not bss_size:
+            self.Raise('Expected __bss_size symbol in tpl/u-boot-tpl')
+        self.SetContents(tools.GetBytes(0, bss_size))
+        return True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 684e507e6ed..d1bf64ce271 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -4262,6 +4262,22 @@ class TestFunctional(unittest.TestCase):
         self.assertEqual(U_BOOT_TPL_NODTB_DATA,
                          data[:len(U_BOOT_TPL_NODTB_DATA)])
 
+    def testTplBssPad(self):
+        """Test that we can pad TPL's BSS with zeros"""
+        # ELF file with a '__bss_size' symbol
+        self._SetupTplElf()
+        data = self._DoReadFile('193_tpl_bss_pad.dts')
+        self.assertEqual(U_BOOT_TPL_DATA + tools.GetBytes(0, 10) + U_BOOT_DATA,
+                         data)
+
+    def testTplBssPadMissing(self):
+        """Test that a missing symbol is detected"""
+        self._SetupTplElf('u_boot_ucode_ptr')
+        with self.assertRaises(ValueError) as e:
+            self._DoReadFile('193_tpl_bss_pad.dts')
+        self.assertIn('Expected __bss_size symbol in tpl/u-boot-tpl',
+                      str(e.exception))
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/193_tpl_bss_pad.dts b/tools/binman/test/193_tpl_bss_pad.dts
new file mode 100644
index 00000000000..f5c2db0646c
--- /dev/null
+++ b/tools/binman/test/193_tpl_bss_pad.dts
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		u-boot-tpl {
+		};
+
+		u-boot-tpl-bss-pad {
+		};
+
+		u-boot {
+		};
+	};
+};
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 09/27] binman: Drop unnecessary 'type' property in tests
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (7 preceding siblings ...)
  2021-03-18  7:24 ` [PATCH v3 08/27] binman: Add support for u-boot-tpl-bss-bad Simon Glass
@ 2021-03-18  7:24 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 10/27] binman: Use the fake SPL/TPL only if requested Simon Glass
                   ` (43 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:24 UTC (permalink / raw)
  To: u-boot

A few tests declare a type when this can be inferred from the node name.
Drop these lines, since it might cause confusion.

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

Changes in v3:
- Add new patch to drop unnecessary 'type' property in tests

 tools/binman/test/149_symbols_tpl.dts     | 1 -
 tools/binman/test/155_symbols_tpl_x86.dts | 1 -
 2 files changed, 2 deletions(-)

diff --git a/tools/binman/test/149_symbols_tpl.dts b/tools/binman/test/149_symbols_tpl.dts
index dfc84af5e72..0a4ab3f1fab 100644
--- a/tools/binman/test/149_symbols_tpl.dts
+++ b/tools/binman/test/149_symbols_tpl.dts
@@ -21,7 +21,6 @@
 
 		section {
 			u-boot-tpl {
-				type = "u-boot-tpl";
 			};
 		};
 	};
diff --git a/tools/binman/test/155_symbols_tpl_x86.dts b/tools/binman/test/155_symbols_tpl_x86.dts
index 72ca4474474..9d7dc51b3d9 100644
--- a/tools/binman/test/155_symbols_tpl_x86.dts
+++ b/tools/binman/test/155_symbols_tpl_x86.dts
@@ -24,7 +24,6 @@
 
 		section {
 			u-boot-tpl {
-				type = "u-boot-tpl";
 			};
 		};
 	};
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 10/27] binman: Use the fake SPL/TPL only if requested
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (8 preceding siblings ...)
  2021-03-18  7:24 ` [PATCH v3 09/27] binman: Drop unnecessary 'type' property in tests Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 11/27] binman: Drop unnecessary field in output_fdt_info Simon Glass
                   ` (42 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

At present we always use the main devicetree for SPL/TPL as well when
setting up the state. But this it not needed if there is a real devicetree
for SPL or TPL. In fact it confuses things since we cannot distinguish
between one being provided and using the fake one.

Update the code to create the fakes only when requested. Put the mapping
in a constant so we can use it elsewhere.

Rename 'other_fname' to 'fname' while we are here since there is nothing
'other' about it.

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

Changes in v3:
- Add new patch to use the fake SPL/TPL only if requested

 tools/binman/state.py | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/tools/binman/state.py b/tools/binman/state.py
index bb3e36ea7af..cef5f660bba 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -13,6 +13,12 @@ import os
 from patman import tools
 from patman import tout
 
+# Map an dtb etype to its expected filename
+DTB_TYPE_FNAME = {
+    'u-boot-spl-dtb': 'spl/u-boot-spl.dtb',
+    'u-boot-tpl-dtb': 'tpl/u-boot-tpl.dtb',
+    }
+
 # Records the device-tree files known to binman, keyed by entry type (e.g.
 # 'u-boot-spl-dtb'). These are the output FDT files, which can be updated by
 # binman. They have been copied to <xxx>.out files.
@@ -178,19 +184,20 @@ def Prepare(images, dtb):
     output_fdt_info.clear()
     fdt_path_prefix = ''
     output_fdt_info['u-boot-dtb'] = [dtb, 'u-boot.dtb', None]
-    output_fdt_info['u-boot-spl-dtb'] = [dtb, 'spl/u-boot-spl.dtb', None]
-    output_fdt_info['u-boot-tpl-dtb'] = [dtb, 'tpl/u-boot-tpl.dtb', None]
-    if not use_fake_dtb:
+    if use_fake_dtb:
+        for etype, fname in DTB_TYPE_FNAME.items():
+            output_fdt_info[etype] = [dtb, fname, None]
+    else:
         fdt_set = {}
         for image in images.values():
             fdt_set.update(image.GetFdts())
         for etype, other in fdt_set.items():
-            entry, other_fname = other
-            infile = tools.GetInputFilename(other_fname)
-            other_fname_dtb = fdt_util.EnsureCompiled(infile)
+            entry, fname = other
+            infile = tools.GetInputFilename(fname)
+            fname_dtb = fdt_util.EnsureCompiled(infile)
             out_fname = tools.GetOutputFilename('%s.out' %
-                    os.path.split(other_fname)[1])
-            tools.WriteFile(out_fname, tools.ReadFile(other_fname_dtb))
+                    os.path.split(fname)[1])
+            tools.WriteFile(out_fname, tools.ReadFile(fname_dtb))
             other_dtb = fdt.FdtScan(out_fname)
             output_fdt_info[etype] = [other_dtb, out_fname, entry]
 
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 11/27] binman: Drop unnecessary field in output_fdt_info
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (9 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 10/27] binman: Use the fake SPL/TPL only if requested Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 12/27] binman: Move the comment for GetFdts() to the base class Simon Glass
                   ` (41 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

At present we store an entry as the third field in output_fdt_info[].
This is only used to get the type of the entry. Of course multiple entries
may have this same type. Also the entry type is the key to this dict, so
we can use that instead.

Drop the field and update GetUpdateNodes() to suit. Improve the comment for
output_fdt_info a little while here.

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

Changes in v3:
- Add new patch to drop an unnecessary field in output_fdt_info

 tools/binman/state.py | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/tools/binman/state.py b/tools/binman/state.py
index cef5f660bba..053b4fe73f1 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -23,11 +23,10 @@ DTB_TYPE_FNAME = {
 # 'u-boot-spl-dtb'). These are the output FDT files, which can be updated by
 # binman. They have been copied to <xxx>.out files.
 #
-#   key: entry type
+#   key: entry type (e.g. 'u-boot-dtb)
 #   value: tuple:
 #       Fdt object
 #       Filename
-#       Entry object, or None if not known
 output_fdt_info = {}
 
 # Prefix to add to an fdtmap path to turn it into a path to the /binman node
@@ -124,11 +123,11 @@ def UpdateFdtContents(etype, data):
         etype: Entry type (e.g. 'u-boot-dtb')
         data: Data to replace the DTB with
     """
-    dtb, fname, entry = output_fdt_info[etype]
+    dtb, fname = output_fdt_info[etype]
     dtb_fname = dtb.GetFilename()
     tools.WriteFile(dtb_fname, data)
     dtb = fdt.FdtScan(dtb_fname)
-    output_fdt_info[etype] = [dtb, fname, entry]
+    output_fdt_info[etype] = [dtb, fname]
 
 def SetEntryArgs(args):
     """Set the value of the entry args
@@ -183,10 +182,10 @@ def Prepare(images, dtb):
     main_dtb = dtb
     output_fdt_info.clear()
     fdt_path_prefix = ''
-    output_fdt_info['u-boot-dtb'] = [dtb, 'u-boot.dtb', None]
+    output_fdt_info['u-boot-dtb'] = [dtb, 'u-boot.dtb']
     if use_fake_dtb:
         for etype, fname in DTB_TYPE_FNAME.items():
-            output_fdt_info[etype] = [dtb, fname, None]
+            output_fdt_info[etype] = [dtb, fname]
     else:
         fdt_set = {}
         for image in images.values():
@@ -199,7 +198,7 @@ def Prepare(images, dtb):
                     os.path.split(fname)[1])
             tools.WriteFile(out_fname, tools.ReadFile(fname_dtb))
             other_dtb = fdt.FdtScan(out_fname)
-            output_fdt_info[etype] = [other_dtb, out_fname, entry]
+            output_fdt_info[etype] = [other_dtb, out_fname]
 
 def PrepareFromLoadedData(image):
     """Get device tree files ready for use with a loaded image
@@ -222,7 +221,7 @@ def PrepareFromLoadedData(image):
     tout.Info('Preparing device trees')
     output_fdt_info.clear()
     fdt_path_prefix = ''
-    output_fdt_info['fdtmap'] = [image.fdtmap_dtb, 'u-boot.dtb', None]
+    output_fdt_info['fdtmap'] = [image.fdtmap_dtb, 'u-boot.dtb']
     main_dtb = None
     tout.Info("   Found device tree type 'fdtmap' '%s'" % image.fdtmap_dtb.name)
     for etype, value in image.GetFdts().items():
@@ -240,7 +239,7 @@ def PrepareFromLoadedData(image):
         if 'multiple-images' in image_node.props:
             image_node = dtb.GetNode('/binman/%s' % image.image_node)
         fdt_path_prefix = image_node.path
-        output_fdt_info[etype] = [dtb, None, entry]
+        output_fdt_info[etype] = [dtb, None]
     tout.Info("   FDT path prefix '%s'" % fdt_path_prefix)
 
 
@@ -275,12 +274,11 @@ def GetUpdateNodes(node, for_repack=False):
             is node, SPL and TPL)
     """
     yield node
-    for dtb, fname, entry in output_fdt_info.values():
+    for entry_type, (dtb, fname) in output_fdt_info.items():
         if dtb != node.GetFdt():
-            if for_repack and entry.etype != 'u-boot-dtb':
+            if for_repack and entry_type != 'u-boot-dtb':
                 continue
             other_node = dtb.GetNode(fdt_path_prefix + node.path)
-            #print('   try', fdt_path_prefix + node.path, other_node)
             if other_node:
                 yield other_node
 
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 12/27] binman: Move the comment for GetFdts() to the base class
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (10 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 11/27] binman: Drop unnecessary field in output_fdt_info Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 13/27] binman: Use standard filenames for SPL/TPL devicetree Simon Glass
                   ` (40 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

Like with other methods this comment should be in the base class. Move it.

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

Changes in v3:
- Add new patch to move the comment for GetFdts() to the base class

 tools/binman/entry.py          | 2 +-
 tools/binman/etype/blob_dtb.py | 9 ---------
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 507760e2a86..be9419584a2 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -205,7 +205,7 @@ class Entry(object):
             Dict:
                 key: Filename from this entry (without the path)
                 value: Tuple:
-                    Fdt object for this dtb, or None if not available
+                    Entry object for this dtb
                     Filename of file containing this dtb
         """
         return {}
diff --git a/tools/binman/etype/blob_dtb.py b/tools/binman/etype/blob_dtb.py
index 724647a7bbb..3ce7511f6f4 100644
--- a/tools/binman/etype/blob_dtb.py
+++ b/tools/binman/etype/blob_dtb.py
@@ -44,15 +44,6 @@ class Entry_blob_dtb(Entry_blob):
         return None
 
     def GetFdts(self):
-        """Get the device trees used by this entry
-
-        Returns:
-            Dict:
-                key: Filename from this entry (without the path)
-                value: Tuple:
-                    Fdt object for this dtb, or None if not available
-                    Filename of file containing this dtb
-        """
         fname = self.GetDefaultFilename()
         return {self.GetFdtEtype(): [self, fname]}
 
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 13/27] binman: Use standard filenames for SPL/TPL devicetree
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (11 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 12/27] binman: Move the comment for GetFdts() to the base class Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 14/27] binman: Allow using an an 'expanded' entry type Simon Glass
                   ` (39 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

At present, before any entry expansion is done (such as a 'files' entry
expanding out to individual entries for each file it contains), we check
the binman definition (i.e. '/binman' node) to find out what devicetree
files are used in the images.

This is a pain, since the definition may change during expansion. For
example if there is no u-boot-spl-dtb entry in the definition at the start,
we assume that the SPL devicetree is not used. But if an entry later
expands to include this, then we don't notice.

In fact the flexibility provided by the current approach of checking the
definition is not really useful. We know that we can have SPL and TPL
devicetrees. We know the pathname to each, so we can simply check if the
files are present. If they are present, we can prepare them and update
them regardless of whether they are actually used. If they are not present,
we cannot prepare/update them anyway, i.e. an error will be generated.

Simplify state.Prepare() so it uses a hard-coded list of devicetree files.

Note that state.PrepareFromLoadedData() is left untouched, since in that
case we have a complete definition from the loaded file, but cannot of
course rely on the devicetree files that created it still being present.
So in that case we still check the image defitions.

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

Changes in v3:
- Add new patch to use standard filenames for SPL/TPL devicetree

 tools/binman/state.py | 21 ++++++++++-----------
 tools/patman/tools.py |  8 ++++++--
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/tools/binman/state.py b/tools/binman/state.py
index 053b4fe73f1..84f606b1885 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -188,17 +188,16 @@ def Prepare(images, dtb):
             output_fdt_info[etype] = [dtb, fname]
     else:
         fdt_set = {}
-        for image in images.values():
-            fdt_set.update(image.GetFdts())
-        for etype, other in fdt_set.items():
-            entry, fname = other
-            infile = tools.GetInputFilename(fname)
-            fname_dtb = fdt_util.EnsureCompiled(infile)
-            out_fname = tools.GetOutputFilename('%s.out' %
-                    os.path.split(fname)[1])
-            tools.WriteFile(out_fname, tools.ReadFile(fname_dtb))
-            other_dtb = fdt.FdtScan(out_fname)
-            output_fdt_info[etype] = [other_dtb, out_fname]
+        for etype, fname in DTB_TYPE_FNAME.items():
+            infile = tools.GetInputFilename(fname, allow_missing=True)
+            if infile and os.path.exists(infile):
+                fname_dtb = fdt_util.EnsureCompiled(infile)
+                out_fname = tools.GetOutputFilename('%s.out' %
+                        os.path.split(fname)[1])
+                tools.WriteFile(out_fname, tools.ReadFile(fname_dtb))
+                other_dtb = fdt.FdtScan(out_fname)
+                output_fdt_info[etype] = [other_dtb, out_fname]
+
 
 def PrepareFromLoadedData(image):
     """Get device tree files ready for use with a loaded image
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 10997e43868..e5f391b7aa9 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -130,8 +130,12 @@ def GetInputFilename(fname, allow_missing=False):
         allow_missing: True if the filename can be missing
 
     Returns:
-        The full path of the filename, within the input directory, or
-        None on error
+        fname, if indir is None;
+        full path of the filename, within the input directory;
+        None, if file is missing and allow_missing is True
+
+    Raises:
+        ValueError if file is missing and allow_missing is False
     """
     if not indir or fname[:1] == '/':
         return fname
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 14/27] binman: Allow using an an 'expanded' entry type
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (12 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 13/27] binman: Use standard filenames for SPL/TPL devicetree Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 15/27] binman: Allow a way to select expanded entries Simon Glass
                   ` (38 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

As the first step in supporting expanded entries, add a way for binman to
automatically select an 'expanded' version of an entry type, if requested.
This is controlled by a class method.

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

(no changes since v1)

 tools/binman/entry.py      | 60 ++++++++++++++++++++++++++++++++------
 tools/binman/entry_test.py | 12 ++++++++
 2 files changed, 63 insertions(+), 9 deletions(-)

diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index be9419584a2..1cfa024a9f9 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -102,22 +102,30 @@ class Entry(object):
         self.allow_missing = False
 
     @staticmethod
-    def Lookup(node_path, etype):
+    def Lookup(node_path, etype, expanded):
         """Look up the entry class for a node.
 
         Args:
             node_node: Path name of Node object containing information about
                        the entry to create (used for errors)
             etype:   Entry type to use
+            expanded: Use the expanded version of etype
 
         Returns:
-            The entry class object if found, else None
+            The entry class object if found, else None if not found and expanded
+                is True
+
+        Raise:
+            ValueError if expanded is False and the class is not found
         """
         # Convert something like 'u-boot at 0' to 'u_boot' since we are only
         # interested in the type.
         module_name = etype.replace('-', '_')
+
         if '@' in module_name:
             module_name = module_name.split('@')[0]
+        if expanded:
+            module_name += '_expanded'
         module = modules.get(module_name)
 
         # Also allow entry-type modules to be brought in from the etype directory.
@@ -127,6 +135,8 @@ class Entry(object):
             try:
                 module = importlib.import_module('binman.etype.' + module_name)
             except ImportError as e:
+                if expanded:
+                    return None
                 raise ValueError("Unknown entry type '%s' in node '%s' (expected etype/%s.py, error '%s'" %
                                  (etype, node_path, module_name, e))
             modules[module_name] = module
@@ -135,21 +145,31 @@ class Entry(object):
         return getattr(module, 'Entry_%s' % module_name)
 
     @staticmethod
-    def Create(section, node, etype=None):
+    def Create(section, node, etype=None, expanded=False):
         """Create a new entry for a node.
 
         Args:
-            section: Section object containing this node
-            node:    Node object containing information about the entry to
-                     create
-            etype:   Entry type to use, or None to work it out (used for tests)
+            section:  Section object containing this node
+            node:     Node object containing information about the entry to
+                      create
+            etype:    Entry type to use, or None to work it out (used for tests)
+            expanded: True to use expanded versions of entries, where available
 
         Returns:
             A new Entry object of the correct type (a subclass of Entry)
         """
         if not etype:
             etype = fdt_util.GetString(node, 'type', node.name)
-        obj = Entry.Lookup(node.path, etype)
+        obj = Entry.Lookup(node.path, etype, expanded)
+        if obj and expanded:
+            # Check whether to use the expanded entry
+            new_etype = etype + '-expanded'
+            if obj.UseExpanded(node, etype, new_etype):
+                etype = new_etype
+            else:
+                obj = None
+        if not obj:
+            obj = Entry.Lookup(node.path, etype, False)
 
         # Call its constructor to get the object we want.
         return obj(section, etype, node)
@@ -648,7 +668,7 @@ features to produce new behaviours.
             modules.remove('_testing')
         missing = []
         for name in modules:
-            module = Entry.Lookup('WriteDocs', name)
+            module = Entry.Lookup('WriteDocs', name, False)
             docs = getattr(module, '__doc__')
             if test_missing == name:
                 docs = None
@@ -907,3 +927,25 @@ features to produce new behaviours.
             self.uncomp_size = len(indata)
         data = tools.Compress(indata, self.compress)
         return data
+
+    @classmethod
+    def UseExpanded(cls, node, etype, new_etype):
+        """Check whether to use an expanded entry type
+
+        This is called by Entry.Create() when it finds an expanded version of
+        an entry type (e.g. 'u-boot-expanded'). If this method returns True then
+        it will be used (e.g. in place of 'u-boot'). If it returns False, it is
+        ignored.
+
+        Args:
+            node:     Node object containing information about the entry to
+                      create
+            etype:    Original entry type being used
+            new_etype: New entry type proposed
+
+        Returns:
+            True to use this entry type, False to use the original one
+        """
+        tout.Info("Node '%s': etype '%s': %s selected" %
+                  (node.path, etype, new_etype))
+        return True
diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
index 80802f33de6..c3d5f3eef48 100644
--- a/tools/binman/entry_test.py
+++ b/tools/binman/entry_test.py
@@ -87,6 +87,18 @@ class TestEntry(unittest.TestCase):
         base = entry.Entry.Create(None, self.GetNode(), 'blob-dtb')
         self.assertIsNone(base.ReadChildData(base))
 
+    def testExpandedEntry(self):
+        """Test use of an expanded entry when available"""
+        base = entry.Entry.Create(None, self.GetNode())
+        self.assertEqual('u-boot', base.etype)
+
+        expanded = entry.Entry.Create(None, self.GetNode(), expanded=True)
+        self.assertEqual('u-boot-expanded', expanded.etype)
+
+        with self.assertRaises(ValueError) as e:
+            entry.Entry.Create(None, self.GetNode(), 'missing', expanded=True)
+        self.assertIn("Unknown entry type 'missing' in node '/binman/u-boot'",
+                      str(e.exception))
 
 if __name__ == "__main__":
     unittest.main()
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 15/27] binman: Allow a way to select expanded entries
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (13 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 14/27] binman: Allow using an an 'expanded' entry type Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 16/27] binman: Plumb expanded entries through fully Simon Glass
                   ` (37 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

Add a new command-line option to disable expanded entries. This is needed
for most tests, since it is much easier to 'factor out' this function into
a separate test and keep the existing packing tests simple.

Add the option and select it by default from tests.

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

(no changes since v1)

 tools/binman/cmdline.py |  3 +++
 tools/binman/ftest.py   | 19 +++++++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py
index c007d0a036d..0c0f48951f6 100644
--- a/tools/binman/cmdline.py
+++ b/tools/binman/cmdline.py
@@ -56,6 +56,9 @@ controlled by a description in the board device tree.'''
         default=False, help='Output a map file for each image')
     build_parser.add_argument('-M', '--allow-missing', action='store_true',
         default=False, help='Allow external blobs to be missing')
+    build_parser.add_argument('-n', '--no-expanded', action='store_true',
+            help="Don't use 'expanded' versions of entries where available; "
+                 "normally 'u-boot' becomes 'u-boot-expanded', for example")
     build_parser.add_argument('-O', '--outdir', type=str,
         action='store', help='Path to directory to use for intermediate and '
         'output files')
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index d1bf64ce271..91825844178 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -305,7 +305,8 @@ 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, extra_indirs=None):
+                    use_expanded=False, verbosity=None, allow_missing=False,
+                    extra_indirs=None):
         """Run binman with a given test file
 
         Args:
@@ -322,6 +323,8 @@ class TestFunctional(unittest.TestCase):
                 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.
+            use_expanded: True to use expanded entries where available, e.g.
+                'u-boot-expanded' instead of 'u-boot'
             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
@@ -344,6 +347,8 @@ class TestFunctional(unittest.TestCase):
             args.append('-u')
         if not use_real_dtb:
             args.append('--fake-dtb')
+        if not use_expanded:
+            args.append('--no-expanded')
         if entry_args:
             for arg, value in entry_args.items():
                 args.append('-a%s=%s' % (arg, value))
@@ -403,9 +408,9 @@ class TestFunctional(unittest.TestCase):
         dtb.Pack()
         return dtb.GetContents()
 
-    def _DoReadFileDtb(self, fname, use_real_dtb=False, map=False,
-                       update_dtb=False, entry_args=None, reset_dtbs=True,
-                       extra_indirs=None):
+    def _DoReadFileDtb(self, fname, use_real_dtb=False, use_expanded=False,
+                       map=False, 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
@@ -420,6 +425,8 @@ class TestFunctional(unittest.TestCase):
                 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.
+            use_expanded: True to use expanded entries where available, e.g.
+                'u-boot-expanded' instead of 'u-boot'
             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
@@ -454,7 +461,7 @@ 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,
-                    extra_indirs=extra_indirs)
+                    use_expanded=use_expanded, extra_indirs=extra_indirs)
             self.assertEqual(0, retcode)
             out_dtb_fname = tools.GetOutputFilename('u-boot.dtb.out')
 
@@ -652,7 +659,7 @@ class TestFunctional(unittest.TestCase):
         """Test that we can run it with a specific board"""
         self._SetupDtb('005_simple.dts', 'sandbox/u-boot.dtb')
         TestFunctional._MakeInputFile('sandbox/u-boot.bin', U_BOOT_DATA)
-        result = self._DoBinman('build', '-b', 'sandbox')
+        result = self._DoBinman('build', '-n', '-b', 'sandbox')
         self.assertEqual(0, result)
 
     def testNeedBoard(self):
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 16/27] binman: Plumb expanded entries through fully
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (14 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 15/27] binman: Allow a way to select expanded entries Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 17/27] binman: Automatically expand phase binaries into sections Simon Glass
                   ` (36 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

Add support for this feature in the control, image and section modules, so
that expanded entries will be selected by default. So far there are no
expanded entry types, so this is a nop.

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

(no changes since v1)

 tools/binman/control.py       | 24 ++++++++++++++++++------
 tools/binman/etype/section.py |  3 ++-
 tools/binman/image.py         | 17 ++++++++++++++++-
 3 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/tools/binman/control.py b/tools/binman/control.py
index 9c0cafeafc4..9709aa9a2b2 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -28,7 +28,7 @@ images = OrderedDict()
 #    value: Text for the help
 missing_blob_help = {}
 
-def _ReadImageDesc(binman_node):
+def _ReadImageDesc(binman_node, use_expanded):
     """Read the image descriptions from the /binman node
 
     This normally produces a single Image object called 'image'. But if
@@ -36,15 +36,17 @@ def _ReadImageDesc(binman_node):
 
     Args:
         binman_node: Node object of the /binman node
+        use_expanded: True if the FDT will be updated with the entry information
     Returns:
         OrderedDict of Image objects, each of which describes an image
     """
     images = OrderedDict()
     if 'multiple-images' in binman_node.props:
         for node in binman_node.subnodes:
-            images[node.name] = Image(node.name, node)
+            images[node.name] = Image(node.name, node,
+                                      use_expanded=use_expanded)
     else:
-        images['image'] = Image('image', binman_node)
+        images['image'] = Image('image', binman_node, use_expanded=use_expanded)
     return images
 
 def _FindBinmanNode(dtb):
@@ -399,7 +401,7 @@ def ReplaceEntries(image_fname, input_fname, indir, entry_paths,
     return image
 
 
-def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt):
+def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt, use_expanded):
     """Prepare the images to be processed and select the device tree
 
     This function:
@@ -413,6 +415,9 @@ def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt):
         dtb_fname: Filename of the device tree file to use (.dts or .dtb)
         selected_images: List of images to output, or None for all
         update_fdt: True to update the FDT wth entry offsets, etc.
+        use_expanded: True to use expanded versions of entries, if available.
+            So if 'u-boot' is called for, we use 'u-boot-expanded' instead. This
+            is needed if update_fdt is True (although tests may disable it)
 
     Returns:
         OrderedDict of images:
@@ -438,7 +443,7 @@ def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt):
         raise ValueError("Device tree '%s' does not have a 'binman' "
                             "node" % dtb_fname)
 
-    images = _ReadImageDesc(node)
+    images = _ReadImageDesc(node, use_expanded)
 
     if select_images:
         skip = []
@@ -611,6 +616,13 @@ def Binman(args):
         elf.debug = args.debug
         cbfs_util.VERBOSE = args.verbosity > 2
         state.use_fake_dtb = args.fake_dtb
+
+        # Normally we replace the 'u-boot' etype with 'u-boot-expanded', etc.
+        # When running tests this can be disabled using this flag. When not
+        # updating the FDT in image, it is not needed by binman, but we use it
+        # for consistency, so that the images look the same to U-Boot at
+        # runtime.
+        use_expanded = not args.no_expanded
         try:
             tools.SetInputDirs(args.indir)
             tools.PrepareOutputDir(args.outdir, args.preserve)
@@ -618,7 +630,7 @@ def Binman(args):
             state.SetEntryArgs(args.entry_arg)
 
             images = PrepareImagesAndDtbs(dtb_fname, args.image,
-                                          args.update_fdt)
+                                          args.update_fdt, use_expanded)
             missing = False
             for image in images.values():
                 missing |= ProcessImage(image, args.update_fdt, args.map,
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 2103919b0c3..2f862bddf0f 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -84,7 +84,8 @@ class Entry_section(Entry):
         for node in self._node.subnodes:
             if node.name.startswith('hash') or node.name.startswith('signature'):
                 continue
-            entry = Entry.Create(self, node)
+            entry = Entry.Create(self, node,
+                                 expanded=self.GetImage().use_expanded)
             entry.ReadNode()
             entry.SetPrefix(self._name_prefix)
             self._entries[node.name] = entry
diff --git a/tools/binman/image.py b/tools/binman/image.py
index e9494352413..10778f47fe9 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -47,9 +47,23 @@ class Image(section.Entry_section):
             exception). This should be used if the Image is being loaded from
             a file rather than generated. In that case we obviously don't need
             the entry arguments since the contents already exists.
+        use_expanded: True if we are updating the FDT wth entry offsets, etc.
+            and should use the expanded versions of the U-Boot entries.
+            Any entry type that includes a devicetree must put it in a
+            separate entry so that it will be updated. For example. 'u-boot'
+            normally just picks up 'u-boot.bin' which includes the
+            devicetree, but this is not updateable, since it comes into
+            binman as one piece and binman doesn't know that it is actually
+            an executable followed by a devicetree. Of course it could be
+            taught this, but then when reading an image (e.g. 'binman ls')
+            it may need to be able to split the devicetree out of the image
+            in order to determine the location of things. Instead we choose
+            to ignore 'u-boot-bin' in this case, and build it ourselves in
+            binman with 'u-boot-dtb.bin' and 'u-boot.dtb'. See
+            Entry_u_boot_expanded and Entry_blob_phase for details.
     """
     def __init__(self, name, node, copy_to_orig=True, test=False,
-                 ignore_missing=False):
+                 ignore_missing=False, use_expanded=False):
         super().__init__(None, 'section', node, test=test)
         self.copy_to_orig = copy_to_orig
         self.name = 'main-section'
@@ -59,6 +73,7 @@ class Image(section.Entry_section):
         self.fdtmap_data = None
         self.allow_repack = False
         self._ignore_missing = ignore_missing
+        self.use_expanded = use_expanded
         if not test:
             self.ReadNode()
 
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 17/27] binman: Automatically expand phase binaries into sections
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (15 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 16/27] binman: Plumb expanded entries through fully Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 18/27] Makefile: Pass new entry args to binman Simon Glass
                   ` (35 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

When creating an entry, check for an expanded version of that entry, then
use it instead. This allows, for example use of:

   u-boot {
   };

instead of having to write out in full:

   u-boot {
      type = "section";

      u-boot-nodtb {
      };

      u-boot-dtb {
      };
   };

Add an implementaion of this and associated documentation.

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

Changes in v3:
- Update sizes for new behaviour

 tools/binman/README                       |  77 ++++++++++
 tools/binman/README.entries               |  96 +++++++++++-
 tools/binman/etype/blob_phase.py          |  51 +++++++
 tools/binman/etype/u_boot.py              |   8 +-
 tools/binman/etype/u_boot_expanded.py     |  24 +++
 tools/binman/etype/u_boot_nodtb.py        |   4 +-
 tools/binman/etype/u_boot_spl.py          |   3 +
 tools/binman/etype/u_boot_spl_expanded.py |  45 ++++++
 tools/binman/etype/u_boot_spl_nodtb.py    |   5 +-
 tools/binman/etype/u_boot_tpl.py          |   3 +
 tools/binman/etype/u_boot_tpl_expanded.py |  45 ++++++
 tools/binman/etype/u_boot_tpl_nodtb.py    |   5 +-
 tools/binman/ftest.py                     | 174 ++++++++++++++++++++++
 tools/binman/state.py                     |  19 ++-
 tools/binman/test/194_fdt_incl.dts        |  17 +++
 tools/binman/test/195_fdt_incl_tpl.dts    |  13 ++
 16 files changed, 571 insertions(+), 18 deletions(-)
 create mode 100644 tools/binman/etype/blob_phase.py
 create mode 100644 tools/binman/etype/u_boot_expanded.py
 create mode 100644 tools/binman/etype/u_boot_spl_expanded.py
 create mode 100644 tools/binman/etype/u_boot_tpl_expanded.py
 create mode 100644 tools/binman/test/194_fdt_incl.dts
 create mode 100644 tools/binman/test/195_fdt_incl_tpl.dts

diff --git a/tools/binman/README b/tools/binman/README
index 45f0a0c2cd3..1de703cc653 100644
--- a/tools/binman/README
+++ b/tools/binman/README
@@ -840,6 +840,83 @@ of the image) can be used to point to the FDT map. See fdtmap and image-header
 entries for more information.
 
 
+Expanded entries
+----------------
+
+Binman automatically replaces 'u-boot' with an expanded version of that, i.e.
+'u-boot-expanded'. This means that when you write:
+
+    u-boot {
+    };
+
+you actually get:
+
+    u-boot {
+        type = "u-boot-expanded';
+    };
+
+which in turn expands to:
+
+    u-boot {
+        type = "section";
+
+        u-boot-nodtb {
+        };
+
+        u-boot-dtb {
+        };
+    };
+
+U-Boot's various phase binaries actually comprise two or three pieces.
+For example, u-boot.bin has the executable followed by a devicetree.
+
+With binman we want to be able to update that devicetree with full image
+information so that it is accessible to the executable. This is tricky
+if it is not clear where the devicetree starts.
+
+The above feature ensures that the devicetree is clearly separated from the
+U-Boot executable and can be updated separately by binman as needed. It can be
+disabled with the --no-expanded flag if required.
+
+The same applies for u-boot-spl and u-boot-spl. In those cases, the expansion
+includes the BSS padding, so for example:
+
+    spl {
+        type = "u-boot-spl"
+    };
+
+you actually get:
+
+    spl {
+        type = "u-boot-expanded';
+    };
+
+which in turn expands to:
+
+    spl {
+        type = "section";
+
+        u-boot-spl-nodtb {
+        };
+
+        u-boot-spl-bss-pad {
+        };
+
+        u-boot-spl-dtb {
+        };
+    };
+
+
+Of course we should not expand SPL if it has no devicetree. Also if the BSS
+padding is not needed (because BSS is in RAM as with CONFIG_SPL_SEPARATE_BSS),
+the 'u-boot-spl-bss-pad' subnode should not be created. The use of the expaned
+entry type is controlled by the UseExpanded() method. In the SPL case it checks
+the 'spl-dtb' entry arg, which is 'y' or '1' if SPL has a devicetree.
+
+For the BSS case, a 'spl-bss-pad' entry arg controls whether it is present. All
+entry args are provided by the U-Boot Makefile.
+
+
 Compression
 -----------
 
diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 368c976497d..0d9105e41cf 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -87,6 +87,15 @@ See cros_ec_rw for an example of this.
 
 
 
+Entry: blob-phase: Section that holds a phase binary
+----------------------------------------------------
+
+This is a base class that should not normally be used directly. It is used
+when converting a 'u-boot' entry automatically into a 'u-boot-expanded'
+entry; similarly for SPL.
+
+
+
 Entry: cbfs: Entry containing a Coreboot Filesystem (CBFS)
 ----------------------------------------------------------
 
@@ -840,8 +849,7 @@ Properties / Entry arguments:
 
 This is the U-Boot binary, containing relocation information to allow it
 to relocate itself at runtime. The binary typically includes a device tree
-blob at the end of it. Use u-boot-nodtb if you want to package the device
-tree separately.
+blob at the end of it.
 
 U-Boot can access binman symbols at runtime. See:
 
@@ -849,6 +857,9 @@ U-Boot can access binman symbols at runtime. See:
 
 in the binman README for more information.
 
+Note that this entry is automatically replaced with u-boot-expanded unless
+--no-expanded is used.
+
 
 
 Entry: u-boot-dtb: U-Boot device tree
@@ -902,6 +913,21 @@ Properties / Entry arguments:
 
 
 
+Entry: u-boot-expanded: U-Boot flat binary broken out into its component parts
+------------------------------------------------------------------------------
+
+This is a section containing the U-Boot binary and a devicetree. Using this
+entry type automatically creates this section, with the following entries
+in it:
+
+   u-boot-nodtb
+   u-boot-dtb
+
+Having the devicetree separate allows binman to update it in the final
+image, so that the entries positions are provided to the running U-Boot.
+
+
+
 Entry: u-boot-img: U-Boot legacy image
 --------------------------------------
 
@@ -925,8 +951,8 @@ Properties / Entry arguments:
 This is the U-Boot binary, containing relocation information to allow it
 to relocate itself at runtime. It does not include a device tree blob at
 the end of it so normally cannot work without it. You can add a u-boot-dtb
-entry after this one, or use a u-boot entry instead (which contains both
-U-Boot and the device tree).
+entry after this one, or use a u-boot entry instead, normally expands to a
+section containing u-boot and u-boot-dtb
 
 
 
@@ -952,6 +978,9 @@ in the binman README for more information.
 The ELF file 'spl/u-boot-spl' must also be available for this to work, since
 binman uses that to look up symbols to write into the SPL binary.
 
+Note that this entry is automatically replaced with u-boot-spl-expanded
+unless --no-expanded is used.
+
 
 
 Entry: u-boot-spl-bss-pad: U-Boot SPL binary padded with a BSS region
@@ -999,6 +1028,29 @@ be relocated to any address for execution.
 
 
 
+Entry: u-boot-spl-expanded: U-Boot SPL flat binary broken out into its component parts
+--------------------------------------------------------------------------------------
+
+Properties / Entry arguments:
+    - spl-dtb: Controls whether this entry is selected (set to 'y' or '1' to
+        select)
+
+This is a section containing the U-Boot binary, BSS padding if needed and a
+devicetree. Using this entry type automatically creates this section, with
+the following entries in it:
+
+   u-boot-spl-nodtb
+   u-boot-spl-bss-pad
+   u-boot-dtb
+
+Having the devicetree separate allows binman to update it in the final
+image, so that the entries positions are provided to the running U-Boot.
+
+This entry is selected based on the value of the 'spl-dtb' entryarg. If
+this is non-empty (and not 'n' or '0') then this expanded entry is selected.
+
+
+
 Entry: u-boot-spl-nodtb: SPL binary without device tree appended
 ----------------------------------------------------------------
 
@@ -1008,8 +1060,9 @@ Properties / Entry arguments:
 This is the U-Boot SPL binary, It does not include a device tree blob at
 the end of it so may not be able to work without it, assuming SPL needs
 a device tree to operate on your platform. You can add a u-boot-spl-dtb
-entry after this one, or use a u-boot-spl entry instead (which contains
-both SPL and the device tree).
+entry after this one, or use a u-boot-spl entry instead' which normally
+expands to a section containing u-boot-spl-dtb, u-boot-spl-bss-pad and
+u-boot-spl-dtb
 
 SPL can access binman symbols at runtime. See:
 
@@ -1054,6 +1107,9 @@ in the binman README for more information.
 The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since
 binman uses that to look up symbols to write into the TPL binary.
 
+Note that this entry is automatically replaced with u-boot-tpl-expanded
+unless --no-expanded is used.
+
 
 
 Entry: u-boot-tpl-bss-pad: U-Boot TPL binary padded with a BSS region
@@ -1111,6 +1167,29 @@ be relocated to any address for execution.
 
 
 
+Entry: u-boot-tpl-expanded: U-Boot TPL flat binary broken out into its component parts
+--------------------------------------------------------------------------------------
+
+Properties / Entry arguments:
+    - tpl-dtb: Controls whether this entry is selected (set to 'y' or '1' to
+        select)
+
+This is a section containing the U-Boot binary, BSS padding if needed and a
+devicetree. Using this entry type automatically creates this section, with
+the following entries in it:
+
+   u-boot-tpl-nodtb
+   u-boot-tpl-bss-pad
+   u-boot-dtb
+
+Having the devicetree separate allows binman to update it in the final
+image, so that the entries positions are provided to the running U-Boot.
+
+This entry is selected based on the value of the 'tpl-dtb' entryarg. If
+this is non-empty (and not 'n' or '0') then this expanded entry is selected.
+
+
+
 Entry: u-boot-tpl-nodtb: TPL binary without device tree appended
 ----------------------------------------------------------------
 
@@ -1120,8 +1199,9 @@ Properties / Entry arguments:
 This is the U-Boot TPL binary, It does not include a device tree blob at
 the end of it so may not be able to work without it, assuming TPL needs
 a device tree to operate on your platform. You can add a u-boot-tpl-dtb
-entry after this one, or use a u-boot-tpl entry instead (which contains
-both TPL and the device tree).
+entry after this one, or use a u-boot-tpl entry instead, which normally
+expands to a section containing u-boot-tpl-dtb, u-boot-tpl-bss-pad and
+u-boot-tpl-dtb
 
 TPL can access binman symbols at runtime. See:
 
diff --git a/tools/binman/etype/blob_phase.py b/tools/binman/etype/blob_phase.py
new file mode 100644
index 00000000000..54ca54c50c1
--- /dev/null
+++ b/tools/binman/etype/blob_phase.py
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2021 Google LLC
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type base class for U-Boot or SPL binary with devicetree
+#
+
+from binman.etype.section import Entry_section
+
+class Entry_blob_phase(Entry_section):
+    """Section that holds a phase binary
+
+    This is a base class that should not normally be used directly. It is used
+    when converting a 'u-boot' entry automatically into a 'u-boot-expanded'
+    entry; similarly for SPL.
+    """
+    def __init__(self, section, etype, node, root_fname, dtb_file, bss_pad):
+        """Set up a new blob for a phase
+
+        This holds an executable for a U-Boot phase, optional BSS padding and
+        a devicetree
+
+        Args:
+            section: entry_Section object for this entry's parent
+            etype: Type of object
+            node: Node defining this entry
+            root_fname: Root filename for the binary ('u-boot',
+                'spl/u-boot-spl', etc.)
+            dtb_file: Name of devicetree file ('u-boot.dtb', u-boot-spl.dtb',
+                etc.)
+            bss_pad: True to add BSS padding before the devicetree
+        """
+        # Put this here to allow entry-docs and help to work without libfdt
+        global state
+        from binman import state
+
+        super().__init__(section, etype, node)
+        self.root_fname = root_fname
+        self.dtb_file = dtb_file
+        self.bss_pad = bss_pad
+
+    def ExpandEntries(self):
+        """Create the subnodes"""
+        names = [self.root_fname + '-nodtb', self.root_fname + '-dtb']
+        if self.bss_pad:
+            names.insert(1, self.root_fname + '-bss-pad')
+        for name in names:
+            subnode = state.AddSubnode(self._node, name)
+
+        # Read entries again, now that we have some
+        self._ReadEntries()
diff --git a/tools/binman/etype/u_boot.py b/tools/binman/etype/u_boot.py
index de783b26772..d2eaba6d4aa 100644
--- a/tools/binman/etype/u_boot.py
+++ b/tools/binman/etype/u_boot.py
@@ -2,7 +2,7 @@
 # Copyright (c) 2016 Google, Inc
 # Written by Simon Glass <sjg@chromium.org>
 #
-# Entry-type module for U-Boot binary
+# Entry-type module for the expanded U-Boot binary
 #
 
 from binman.entry import Entry
@@ -16,14 +16,16 @@ class Entry_u_boot(Entry_blob):
 
     This is the U-Boot binary, containing relocation information to allow it
     to relocate itself at runtime. The binary typically includes a device tree
-    blob at the end of it. Use u-boot-nodtb if you want to package the device
-    tree separately.
+    blob at the end of it.
 
     U-Boot can access binman symbols at runtime. See:
 
         'Access to binman entry offsets at run time (fdt)'
 
     in the binman README for more information.
+
+    Note that this entry is automatically replaced with u-boot-expanded unless
+    --no-expanded is used.
     """
     def __init__(self, section, etype, node):
         super().__init__(section, etype, node)
diff --git a/tools/binman/etype/u_boot_expanded.py b/tools/binman/etype/u_boot_expanded.py
new file mode 100644
index 00000000000..8797824c9f0
--- /dev/null
+++ b/tools/binman/etype/u_boot_expanded.py
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2021 Google LLC
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for U-Boot binary
+#
+
+from binman.etype.blob_phase import Entry_blob_phase
+
+class Entry_u_boot_expanded(Entry_blob_phase):
+    """U-Boot flat binary broken out into its component parts
+
+    This is a section containing the U-Boot binary and a devicetree. Using this
+    entry type automatically creates this section, with the following entries
+    in it:
+
+       u-boot-nodtb
+       u-boot-dtb
+
+    Having the devicetree separate allows binman to update it in the final
+    image, so that the entries positions are provided to the running U-Boot.
+    """
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node, 'u-boot', 'u-boot-dtb', False)
diff --git a/tools/binman/etype/u_boot_nodtb.py b/tools/binman/etype/u_boot_nodtb.py
index 289b24fa6c6..347ba7dc697 100644
--- a/tools/binman/etype/u_boot_nodtb.py
+++ b/tools/binman/etype/u_boot_nodtb.py
@@ -17,8 +17,8 @@ class Entry_u_boot_nodtb(Entry_blob):
     This is the U-Boot binary, containing relocation information to allow it
     to relocate itself at runtime. It does not include a device tree blob at
     the end of it so normally cannot work without it. You can add a u-boot-dtb
-    entry after this one, or use a u-boot entry instead (which contains both
-    U-Boot and the device tree).
+    entry after this one, or use a u-boot entry instead, normally expands to a
+    section containing u-boot and u-boot-dtb
     """
     def __init__(self, section, etype, node):
         super().__init__(section, etype, node)
diff --git a/tools/binman/etype/u_boot_spl.py b/tools/binman/etype/u_boot_spl.py
index d66e46140be..1c39f982519 100644
--- a/tools/binman/etype/u_boot_spl.py
+++ b/tools/binman/etype/u_boot_spl.py
@@ -30,6 +30,9 @@ class Entry_u_boot_spl(Entry_blob):
 
     The ELF file 'spl/u-boot-spl' must also be available for this to work, since
     binman uses that to look up symbols to write into the SPL binary.
+
+    Note that this entry is automatically replaced with u-boot-spl-expanded
+    unless --no-expanded is used.
     """
     def __init__(self, section, etype, node):
         super().__init__(section, etype, node)
diff --git a/tools/binman/etype/u_boot_spl_expanded.py b/tools/binman/etype/u_boot_spl_expanded.py
new file mode 100644
index 00000000000..8e138e6a624
--- /dev/null
+++ b/tools/binman/etype/u_boot_spl_expanded.py
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2021 Google LLC
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for expanded U-Boot SPL binary
+#
+
+from patman import tout
+
+from binman import state
+from binman.etype.blob_phase import Entry_blob_phase
+
+class Entry_u_boot_spl_expanded(Entry_blob_phase):
+    """U-Boot SPL flat binary broken out into its component parts
+
+    Properties / Entry arguments:
+        - spl-dtb: Controls whether this entry is selected (set to 'y' or '1' to
+            select)
+
+    This is a section containing the U-Boot binary, BSS padding if needed and a
+    devicetree. Using this entry type automatically creates this section, with
+    the following entries in it:
+
+       u-boot-spl-nodtb
+       u-boot-spl-bss-pad
+       u-boot-dtb
+
+    Having the devicetree separate allows binman to update it in the final
+    image, so that the entries positions are provided to the running U-Boot.
+
+    This entry is selected based on the value of the 'spl-dtb' entryarg. If
+    this is non-empty (and not 'n' or '0') then this expanded entry is selected.
+    """
+    def __init__(self, section, etype, node):
+        bss_pad = state.GetEntryArgBool('spl-bss-pad')
+        super().__init__(section, etype, node, 'u-boot-spl', 'u-boot-spl-dtb',
+                         bss_pad)
+
+    @classmethod
+    def UseExpanded(cls, node, etype, new_etype):
+        val = state.GetEntryArgBool('spl-dtb')
+        tout.DoOutput(tout.INFO if val else tout.DETAIL,
+                      "Node '%s': etype '%s': %s %sselected" %
+                      (node.path, etype, new_etype, '' if val else 'not '))
+        return val
diff --git a/tools/binman/etype/u_boot_spl_nodtb.py b/tools/binman/etype/u_boot_spl_nodtb.py
index dbf2f12743a..316b38172ef 100644
--- a/tools/binman/etype/u_boot_spl_nodtb.py
+++ b/tools/binman/etype/u_boot_spl_nodtb.py
@@ -18,8 +18,9 @@ class Entry_u_boot_spl_nodtb(Entry_blob):
     This is the U-Boot SPL binary, It does not include a device tree blob at
     the end of it so may not be able to work without it, assuming SPL needs
     a device tree to operate on your platform. You can add a u-boot-spl-dtb
-    entry after this one, or use a u-boot-spl entry instead (which contains
-    both SPL and the device tree).
+    entry after this one, or use a u-boot-spl entry instead' which normally
+    expands to a section containing u-boot-spl-dtb, u-boot-spl-bss-pad and
+    u-boot-spl-dtb
 
     SPL can access binman symbols at runtime. See:
 
diff --git a/tools/binman/etype/u_boot_tpl.py b/tools/binman/etype/u_boot_tpl.py
index 02287ab3275..95d9bd6b20e 100644
--- a/tools/binman/etype/u_boot_tpl.py
+++ b/tools/binman/etype/u_boot_tpl.py
@@ -30,6 +30,9 @@ class Entry_u_boot_tpl(Entry_blob):
 
     The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since
     binman uses that to look up symbols to write into the TPL binary.
+
+    Note that this entry is automatically replaced with u-boot-tpl-expanded
+    unless --no-expanded is used.
     """
     def __init__(self, section, etype, node):
         super().__init__(section, etype, node)
diff --git a/tools/binman/etype/u_boot_tpl_expanded.py b/tools/binman/etype/u_boot_tpl_expanded.py
new file mode 100644
index 00000000000..15cdac46556
--- /dev/null
+++ b/tools/binman/etype/u_boot_tpl_expanded.py
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2021 Google LLC
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for expanded U-Boot TPL binary
+#
+
+from patman import tout
+
+from binman import state
+from binman.etype.blob_phase import Entry_blob_phase
+
+class Entry_u_boot_tpl_expanded(Entry_blob_phase):
+    """U-Boot TPL flat binary broken out into its component parts
+
+    Properties / Entry arguments:
+        - tpl-dtb: Controls whether this entry is selected (set to 'y' or '1' to
+            select)
+
+    This is a section containing the U-Boot binary, BSS padding if needed and a
+    devicetree. Using this entry type automatically creates this section, with
+    the following entries in it:
+
+       u-boot-tpl-nodtb
+       u-boot-tpl-bss-pad
+       u-boot-dtb
+
+    Having the devicetree separate allows binman to update it in the final
+    image, so that the entries positions are provided to the running U-Boot.
+
+    This entry is selected based on the value of the 'tpl-dtb' entryarg. If
+    this is non-empty (and not 'n' or '0') then this expanded entry is selected.
+    """
+    def __init__(self, section, etype, node):
+        bss_pad = state.GetEntryArgBool('tpl-bss-pad')
+        super().__init__(section, etype, node, 'u-boot-tpl', 'u-boot-tpl-dtb',
+                         bss_pad)
+
+    @classmethod
+    def UseExpanded(cls, node, etype, new_etype):
+        val = state.GetEntryArgBool('tpl-dtb')
+        tout.DoOutput(tout.INFO if val else tout.DETAIL,
+                      "Node '%s': etype '%s': %s %sselected" %
+                      (node.path, etype, new_etype, '' if val else 'not '))
+        return val
diff --git a/tools/binman/etype/u_boot_tpl_nodtb.py b/tools/binman/etype/u_boot_tpl_nodtb.py
index 9a47f599bf1..98f3853f457 100644
--- a/tools/binman/etype/u_boot_tpl_nodtb.py
+++ b/tools/binman/etype/u_boot_tpl_nodtb.py
@@ -18,8 +18,9 @@ class Entry_u_boot_tpl_nodtb(Entry_blob):
     This is the U-Boot TPL binary, It does not include a device tree blob at
     the end of it so may not be able to work without it, assuming TPL needs
     a device tree to operate on your platform. You can add a u-boot-tpl-dtb
-    entry after this one, or use a u-boot-tpl entry instead (which contains
-    both TPL and the device tree).
+    entry after this one, or use a u-boot-tpl entry instead, which normally
+    expands to a section containing u-boot-tpl-dtb, u-boot-tpl-bss-pad and
+    u-boot-tpl-dtb
 
     TPL can access binman symbols at runtime. See:
 
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 91825844178..432c463b58b 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -4285,6 +4285,180 @@ class TestFunctional(unittest.TestCase):
         self.assertIn('Expected __bss_size symbol in tpl/u-boot-tpl',
                       str(e.exception))
 
+    def checkDtbSizes(self, data, pad_len, start):
+        """Check the size arguments in a dtb embedded in an image
+
+        Args:
+            data: The image data
+            pad_len: Length of the pad section in the image, in bytes
+            start: Start offset of the devicetree to examine, within the image
+
+        Returns:
+            Size of the devicetree in bytes
+        """
+        dtb_data = data[start:]
+        dtb = fdt.Fdt.FromData(dtb_data)
+        fdt_size = dtb.GetFdtObj().totalsize()
+        dtb.Scan()
+        props = self._GetPropTree(dtb, 'size')
+        self.assertEqual({
+            'size': len(data),
+            'u-boot-spl/u-boot-spl-bss-pad:size': pad_len,
+            'u-boot-spl/u-boot-spl-dtb:size': 801,
+            'u-boot-spl/u-boot-spl-nodtb:size': len(U_BOOT_SPL_NODTB_DATA),
+            'u-boot-spl:size': 860,
+            'u-boot-tpl:size': len(U_BOOT_TPL_DATA),
+            'u-boot/u-boot-dtb:size': 781,
+            'u-boot/u-boot-nodtb:size': len(U_BOOT_NODTB_DATA),
+            'u-boot:size': 827,
+            }, props)
+        return fdt_size
+
+    def testExpanded(self):
+        """Test that an expanded entry type is selected when needed"""
+        self._SetupSplElf()
+        self._SetupTplElf()
+
+        # SPL has a devicetree, TPL does not
+        entry_args = {
+            'spl-dtb': '1',
+            'spl-bss-pad': 'y',
+            'tpl-dtb': '',
+        }
+        self._DoReadFileDtb('194_fdt_incl.dts', use_expanded=True,
+                            entry_args=entry_args)
+        image = control.images['image']
+        entries = image.GetEntries()
+        self.assertEqual(3, len(entries))
+
+        # First, u-boot, which should be expanded into u-boot-nodtb and dtb
+        self.assertIn('u-boot', entries)
+        entry = entries['u-boot']
+        self.assertEqual('u-boot-expanded', entry.etype)
+        subent = entry.GetEntries()
+        self.assertEqual(2, len(subent))
+        self.assertIn('u-boot-nodtb', subent)
+        self.assertIn('u-boot-dtb', subent)
+
+        # Second, u-boot-spl, which should be expanded into three parts
+        self.assertIn('u-boot-spl', entries)
+        entry = entries['u-boot-spl']
+        self.assertEqual('u-boot-spl-expanded', entry.etype)
+        subent = entry.GetEntries()
+        self.assertEqual(3, len(subent))
+        self.assertIn('u-boot-spl-nodtb', subent)
+        self.assertIn('u-boot-spl-bss-pad', subent)
+        self.assertIn('u-boot-spl-dtb', subent)
+
+        # Third, u-boot-tpl, which should be not be expanded, since TPL has no
+        # devicetree
+        self.assertIn('u-boot-tpl', entries)
+        entry = entries['u-boot-tpl']
+        self.assertEqual('u-boot-tpl', entry.etype)
+        self.assertEqual(None, entry.GetEntries())
+
+    def testExpandedTpl(self):
+        """Test that an expanded entry type is selected for TPL when needed"""
+        self._SetupTplElf()
+
+        entry_args = {
+            'tpl-bss-pad': 'y',
+            'tpl-dtb': 'y',
+        }
+        self._DoReadFileDtb('195_fdt_incl_tpl.dts', use_expanded=True,
+                            entry_args=entry_args)
+        image = control.images['image']
+        entries = image.GetEntries()
+        self.assertEqual(1, len(entries))
+
+        # We only have u-boot-tpl, which be expanded
+        self.assertIn('u-boot-tpl', entries)
+        entry = entries['u-boot-tpl']
+        self.assertEqual('u-boot-tpl-expanded', entry.etype)
+        subent = entry.GetEntries()
+        self.assertEqual(3, len(subent))
+        self.assertIn('u-boot-tpl-nodtb', subent)
+        self.assertIn('u-boot-tpl-bss-pad', subent)
+        self.assertIn('u-boot-tpl-dtb', subent)
+
+    def testExpandedNoPad(self):
+        """Test an expanded entry without BSS pad enabled"""
+        self._SetupSplElf()
+        self._SetupTplElf()
+
+        # SPL has a devicetree, TPL does not
+        entry_args = {
+            'spl-dtb': 'something',
+            'spl-bss-pad': 'n',
+            'tpl-dtb': '',
+        }
+        self._DoReadFileDtb('194_fdt_incl.dts', use_expanded=True,
+                            entry_args=entry_args)
+        image = control.images['image']
+        entries = image.GetEntries()
+
+        # Just check u-boot-spl, which should be expanded into two parts
+        self.assertIn('u-boot-spl', entries)
+        entry = entries['u-boot-spl']
+        self.assertEqual('u-boot-spl-expanded', entry.etype)
+        subent = entry.GetEntries()
+        self.assertEqual(2, len(subent))
+        self.assertIn('u-boot-spl-nodtb', subent)
+        self.assertIn('u-boot-spl-dtb', subent)
+
+    def testExpandedTplNoPad(self):
+        """Test that an expanded entry type with padding disabled in TPL"""
+        self._SetupTplElf()
+
+        entry_args = {
+            'tpl-bss-pad': '',
+            'tpl-dtb': 'y',
+        }
+        self._DoReadFileDtb('195_fdt_incl_tpl.dts', use_expanded=True,
+                            entry_args=entry_args)
+        image = control.images['image']
+        entries = image.GetEntries()
+        self.assertEqual(1, len(entries))
+
+        # We only have u-boot-tpl, which be expanded
+        self.assertIn('u-boot-tpl', entries)
+        entry = entries['u-boot-tpl']
+        self.assertEqual('u-boot-tpl-expanded', entry.etype)
+        subent = entry.GetEntries()
+        self.assertEqual(2, len(subent))
+        self.assertIn('u-boot-tpl-nodtb', subent)
+        self.assertIn('u-boot-tpl-dtb', subent)
+
+    def testFdtInclude(self):
+        """Test that an Fdt is update within all binaries"""
+        self._SetupSplElf()
+        self._SetupTplElf()
+
+        # SPL has a devicetree, TPL does not
+        self.maxDiff = None
+        entry_args = {
+            'spl-dtb': '1',
+            'spl-bss-pad': 'y',
+            'tpl-dtb': '',
+        }
+        # Build the image. It includes two separate devicetree binaries, each
+        # with their own contents, but all contain the binman definition.
+        data = self._DoReadFileDtb(
+            '194_fdt_incl.dts', use_real_dtb=True, use_expanded=True,
+            update_dtb=True, entry_args=entry_args)[0]
+        pad_len = 10
+
+        # Check the U-Boot dtb
+        start = len(U_BOOT_NODTB_DATA)
+        fdt_size = self.checkDtbSizes(data, pad_len, start)
+
+        # Now check SPL
+        start += fdt_size + len(U_BOOT_SPL_NODTB_DATA) + pad_len
+        fdt_size = self.checkDtbSizes(data, pad_len, start)
+
+        # TPL has no devicetree
+        start += fdt_size + len(U_BOOT_TPL_DATA)
+        self.assertEqual(len(data), start)
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/state.py b/tools/binman/state.py
index 84f606b1885..dfb17604554 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -141,12 +141,16 @@ def SetEntryArgs(args):
     global entry_args
 
     entry_args = {}
+    tout.Debug('Processing entry args:')
     if args:
         for arg in args:
             m = re.match('([^=]*)=(.*)', arg)
             if not m:
                 raise ValueError("Invalid entry arguemnt '%s'" % arg)
-            entry_args[m.group(1)] = m.group(2)
+            name, value = m.groups()
+            tout.Debug('   %20s = %s' % (name, value))
+            entry_args[name] = value
+    tout.Debug('Processing entry args done')
 
 def GetEntryArg(name):
     """Get the value of an entry argument
@@ -159,6 +163,19 @@ def GetEntryArg(name):
     """
     return entry_args.get(name)
 
+def GetEntryArgBool(name):
+    """Get the value of an entry argument as a boolean
+
+    Args:
+        name: Name of argument to retrieve
+
+    Returns:
+        False if the entry argument is consider False (empty, '0' or 'n'), else
+            True
+    """
+    val = GetEntryArg(name)
+    return val and val not in ['n', '0']
+
 def Prepare(images, dtb):
     """Get device tree files ready for use
 
diff --git a/tools/binman/test/194_fdt_incl.dts b/tools/binman/test/194_fdt_incl.dts
new file mode 100644
index 00000000000..b14c8ff8f52
--- /dev/null
+++ b/tools/binman/test/194_fdt_incl.dts
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		u-boot {
+		};
+		u-boot-spl {
+		};
+		u-boot-tpl {
+		};
+	};
+};
diff --git a/tools/binman/test/195_fdt_incl_tpl.dts b/tools/binman/test/195_fdt_incl_tpl.dts
new file mode 100644
index 00000000000..3756ac4fc47
--- /dev/null
+++ b/tools/binman/test/195_fdt_incl_tpl.dts
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		u-boot-tpl {
+		};
+	};
+};
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 18/27] Makefile: Pass new entry args to binman
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (16 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 17/27] binman: Automatically expand phase binaries into sections Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 19/27] x86: Make use of binman expanded entries Simon Glass
                   ` (34 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

To support the use of 'expanded' entries, binman needs to be told whether
SPL and TPL have a devicetree and whether they need BSS padding. Add these
to the Makefile.

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

(no changes since v1)

 Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Makefile b/Makefile
index f0101dce407..c6df83ec5a2 100644
--- a/Makefile
+++ b/Makefile
@@ -1336,6 +1336,11 @@ u-boot.ldr:	u-boot
 # Use 'make BINMAN_DEBUG=1' to enable debugging
 # Use 'make BINMAN_VERBOSE=3' to set vebosity level
 default_dt := $(if $(DEVICE_TREE),$(DEVICE_TREE),$(CONFIG_DEFAULT_DEVICE_TREE))
+
+# Tell binman whether we have a devicetree for SPL and TPL
+have_spl_dt := $(if $(CONFIG_SPL_OF_PLATDATA),,$(CONFIG_SPL_OF_CONTROL))
+have_tpl_dt := $(if $(CONFIG_TPL_OF_PLATDATA),,$(CONFIG_TPL_OF_CONTROL))
+
 quiet_cmd_binman = BINMAN  $@
 cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
                 --toolpath $(objtree)/tools \
@@ -1346,6 +1351,9 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
 		-a atf-bl31-path=${BL31} \
 		-a default-dt=$(default_dt) \
 		-a scp-path=$(SCP) \
+		-a spl-bss-pad=$(if $(CONFIG_SPL_SEPARATE_BSS),,1) \
+		-a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \
+		-a spl-dtb=$(have_spl_dt) -a tpl-dtb=$(have_tpl_dt) \
 		$(BINMAN_$(@F))
 
 OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 19/27] x86: Make use of binman expanded entries
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (17 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 18/27] Makefile: Pass new entry args to binman Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 20/27] x86: dts: Drop unused CONFIG_SPL Simon Glass
                   ` (33 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

We don't need to spell out the separate pieces of U-Boot phase binaries
anymore. Revert to using the simple entry and let binman do the expansion
itself as needed.

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

(no changes since v1)

 arch/x86/dts/u-boot.dtsi | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/arch/x86/dts/u-boot.dtsi b/arch/x86/dts/u-boot.dtsi
index bf92f45f2d3..50134b2fe00 100644
--- a/arch/x86/dts/u-boot.dtsi
+++ b/arch/x86/dts/u-boot.dtsi
@@ -38,20 +38,11 @@
 	};
 #endif
 	spl {
-		type = "section";
+		type = "u-boot-spl";
 		offset = <CONFIG_X86_OFFSET_SPL>;
-		u-boot-spl {
-		};
-		u-boot-spl-dtb {
-		};
 	};
 	u-boot {
-		type = "section";
 		offset = <CONFIG_X86_OFFSET_U_BOOT>;
-		u-boot-nodtb {
-		};
-		u-boot-dtb {
-		};
 	};
 #elif defined(CONFIG_SPL)
 	u-boot-spl-with-ucode-ptr {
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 20/27] x86: dts: Drop unused CONFIG_SPL
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (18 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 19/27] x86: Make use of binman expanded entries Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 21/27] doc: Move UEFI under develop/ Simon Glass
                   ` (32 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

This cannot be used since the previous #elif has already dealt with SPL.
Drop it.

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

(no changes since v1)

 arch/x86/dts/u-boot.dtsi | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/x86/dts/u-boot.dtsi b/arch/x86/dts/u-boot.dtsi
index 50134b2fe00..ca84d18ad90 100644
--- a/arch/x86/dts/u-boot.dtsi
+++ b/arch/x86/dts/u-boot.dtsi
@@ -55,11 +55,7 @@
 		offset = <CONFIG_X86_OFFSET_U_BOOT>;
 	};
 #else
-# ifdef CONFIG_SPL
-	u-boot {
-		offset = <CONFIG_SYS_TEXT_BASE>;
-	};
-# elif defined(CONFIG_HAVE_MICROCODE)
+# ifdef CONFIG_HAVE_MICROCODE
 	/* If there is no SPL then we need to put microcode in U-Boot */
 	u-boot-with-ucode-ptr {
 		offset = <CONFIG_X86_OFFSET_U_BOOT>;
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 21/27] doc: Move UEFI under develop/
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (19 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 20/27] x86: dts: Drop unused CONFIG_SPL Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  9:23   ` Heinrich Schuchardt
  2021-03-19 23:52   ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 22/27] doc: Move driver model docs " Simon Glass
                   ` (31 subsequent siblings)
  52 siblings, 2 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

Much of the content here is useful only for development. Move it under
that section.

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

Changes in v3:
- Fix x86 docs which refer to this

Changes in v2:
- Move UEFI under develop/ instead

 doc/arch/x86.rst                         |  4 ++--
 doc/develop/index.rst                    |  1 +
 doc/{ => develop}/uefi/index.rst         |  4 ++++
 doc/{ => develop}/uefi/iscsi.rst         |  0
 doc/{ => develop}/uefi/u-boot_on_efi.rst |  0
 doc/{ => develop}/uefi/uefi.rst          |  0
 doc/index.rst                            | 12 ------------
 7 files changed, 7 insertions(+), 14 deletions(-)
 rename doc/{ => develop}/uefi/index.rst (51%)
 rename doc/{ => develop}/uefi/iscsi.rst (100%)
 rename doc/{ => develop}/uefi/u-boot_on_efi.rst (100%)
 rename doc/{ => develop}/uefi/uefi.rst (100%)

diff --git a/doc/arch/x86.rst b/doc/arch/x86.rst
index cc307aa8d5e..2ebfed871bd 100644
--- a/doc/arch/x86.rst
+++ b/doc/arch/x86.rst
@@ -709,8 +709,8 @@ to load a 'u-boot-payload.efi', see below test logs on QEMU.
   No controllers found
   Hit any key to stop autoboot:  0
 
-See :doc:`../uefi/u-boot_on_efi` and :doc:`../uefi/uefi` for details of
-EFI support in U-Boot.
+See :doc:`../develop/uefi/u-boot_on_efi` and :doc:`../develop/uefi/uefi` for
+details of EFI support in U-Boot.
 
 Chain-loading
 -------------
diff --git a/doc/develop/index.rst b/doc/develop/index.rst
index 41c0ba1ebd9..84914bb47bf 100644
--- a/doc/develop/index.rst
+++ b/doc/develop/index.rst
@@ -13,6 +13,7 @@ Implementation
    global_data
    logging
    menus
+   uefi/index
    version
 
 Debugging
diff --git a/doc/uefi/index.rst b/doc/develop/uefi/index.rst
similarity index 51%
rename from doc/uefi/index.rst
rename to doc/develop/uefi/index.rst
index b790a91f174..7e65dbc5d5e 100644
--- a/doc/uefi/index.rst
+++ b/doc/develop/uefi/index.rst
@@ -3,6 +3,10 @@
 Unified Extensible Firmware (UEFI)
 ==================================
 
+U-Boot provides an implementation of the UEFI API allowing to run UEFI
+compliant software like Linux, GRUB, and iPXE. Furthermore U-Boot itself
+can be run an UEFI payload.
+
 .. toctree::
    :maxdepth: 2
 
diff --git a/doc/uefi/iscsi.rst b/doc/develop/uefi/iscsi.rst
similarity index 100%
rename from doc/uefi/iscsi.rst
rename to doc/develop/uefi/iscsi.rst
diff --git a/doc/uefi/u-boot_on_efi.rst b/doc/develop/uefi/u-boot_on_efi.rst
similarity index 100%
rename from doc/uefi/u-boot_on_efi.rst
rename to doc/develop/uefi/u-boot_on_efi.rst
diff --git a/doc/uefi/uefi.rst b/doc/develop/uefi/uefi.rst
similarity index 100%
rename from doc/uefi/uefi.rst
rename to doc/develop/uefi/uefi.rst
diff --git a/doc/index.rst b/doc/index.rst
index 4c44955d67f..366963813ac 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -38,18 +38,6 @@ want to contribute to U-Boot.
 
    develop/index
 
-Unified Extensible Firmware (UEFI)
-----------------------------------
-
-U-Boot provides an implementation of the UEFI API allowing to run UEFI
-compliant software like Linux, GRUB, and iPXE. Furthermore U-Boot itself
-can be run an UEFI payload.
-
-.. toctree::
-   :maxdepth: 2
-
-   uefi/index
-
 Driver-Model documentation
 --------------------------
 
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 22/27] doc: Move driver model docs under develop/
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (20 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 21/27] doc: Move UEFI under develop/ Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 23/27] binman: doc: Add documentation to htmldocs Simon Glass
                   ` (30 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

These docs are useful for developers, not users. Move them under that
section.

Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v2)

Changes in v2:
- Add new patch to move driver model docs under develop/

 doc/{ => develop}/driver-model/bind.rst               |  0
 doc/{ => develop}/driver-model/debugging.rst          |  0
 doc/{ => develop}/driver-model/design.rst             |  0
 doc/{ => develop}/driver-model/ethernet.rst           |  0
 doc/{ => develop}/driver-model/fdt-fixup.rst          |  0
 doc/{ => develop}/driver-model/fs_firmware_loader.rst |  0
 doc/{ => develop}/driver-model/i2c-howto.rst          |  0
 doc/{ => develop}/driver-model/index.rst              |  4 ++++
 doc/{ => develop}/driver-model/livetree.rst           |  0
 doc/{ => develop}/driver-model/migration.rst          |  0
 doc/{ => develop}/driver-model/of-plat.rst            |  0
 doc/{ => develop}/driver-model/pci-info.rst           |  0
 doc/{ => develop}/driver-model/pmic-framework.rst     |  0
 .../driver-model/remoteproc-framework.rst             |  0
 doc/{ => develop}/driver-model/serial-howto.rst       |  0
 doc/{ => develop}/driver-model/soc-framework.rst      |  0
 doc/{ => develop}/driver-model/spi-howto.rst          |  0
 doc/{ => develop}/driver-model/usb-info.rst           |  0
 doc/develop/index.rst                                 |  1 +
 doc/index.rst                                         | 11 -----------
 20 files changed, 5 insertions(+), 11 deletions(-)
 rename doc/{ => develop}/driver-model/bind.rst (100%)
 rename doc/{ => develop}/driver-model/debugging.rst (100%)
 rename doc/{ => develop}/driver-model/design.rst (100%)
 rename doc/{ => develop}/driver-model/ethernet.rst (100%)
 rename doc/{ => develop}/driver-model/fdt-fixup.rst (100%)
 rename doc/{ => develop}/driver-model/fs_firmware_loader.rst (100%)
 rename doc/{ => develop}/driver-model/i2c-howto.rst (100%)
 rename doc/{ => develop}/driver-model/index.rst (68%)
 rename doc/{ => develop}/driver-model/livetree.rst (100%)
 rename doc/{ => develop}/driver-model/migration.rst (100%)
 rename doc/{ => develop}/driver-model/of-plat.rst (100%)
 rename doc/{ => develop}/driver-model/pci-info.rst (100%)
 rename doc/{ => develop}/driver-model/pmic-framework.rst (100%)
 rename doc/{ => develop}/driver-model/remoteproc-framework.rst (100%)
 rename doc/{ => develop}/driver-model/serial-howto.rst (100%)
 rename doc/{ => develop}/driver-model/soc-framework.rst (100%)
 rename doc/{ => develop}/driver-model/spi-howto.rst (100%)
 rename doc/{ => develop}/driver-model/usb-info.rst (100%)

diff --git a/doc/driver-model/bind.rst b/doc/develop/driver-model/bind.rst
similarity index 100%
rename from doc/driver-model/bind.rst
rename to doc/develop/driver-model/bind.rst
diff --git a/doc/driver-model/debugging.rst b/doc/develop/driver-model/debugging.rst
similarity index 100%
rename from doc/driver-model/debugging.rst
rename to doc/develop/driver-model/debugging.rst
diff --git a/doc/driver-model/design.rst b/doc/develop/driver-model/design.rst
similarity index 100%
rename from doc/driver-model/design.rst
rename to doc/develop/driver-model/design.rst
diff --git a/doc/driver-model/ethernet.rst b/doc/develop/driver-model/ethernet.rst
similarity index 100%
rename from doc/driver-model/ethernet.rst
rename to doc/develop/driver-model/ethernet.rst
diff --git a/doc/driver-model/fdt-fixup.rst b/doc/develop/driver-model/fdt-fixup.rst
similarity index 100%
rename from doc/driver-model/fdt-fixup.rst
rename to doc/develop/driver-model/fdt-fixup.rst
diff --git a/doc/driver-model/fs_firmware_loader.rst b/doc/develop/driver-model/fs_firmware_loader.rst
similarity index 100%
rename from doc/driver-model/fs_firmware_loader.rst
rename to doc/develop/driver-model/fs_firmware_loader.rst
diff --git a/doc/driver-model/i2c-howto.rst b/doc/develop/driver-model/i2c-howto.rst
similarity index 100%
rename from doc/driver-model/i2c-howto.rst
rename to doc/develop/driver-model/i2c-howto.rst
diff --git a/doc/driver-model/index.rst b/doc/develop/driver-model/index.rst
similarity index 68%
rename from doc/driver-model/index.rst
rename to doc/develop/driver-model/index.rst
index c9faf0a5910..fd4575db9b7 100644
--- a/doc/driver-model/index.rst
+++ b/doc/develop/driver-model/index.rst
@@ -3,6 +3,10 @@
 Driver Model
 ============
 
+The following holds information on the U-Boot device driver framework:
+driver-model, including the design details of itself and several driver
+subsystems
+
 .. toctree::
    :maxdepth: 2
 
diff --git a/doc/driver-model/livetree.rst b/doc/develop/driver-model/livetree.rst
similarity index 100%
rename from doc/driver-model/livetree.rst
rename to doc/develop/driver-model/livetree.rst
diff --git a/doc/driver-model/migration.rst b/doc/develop/driver-model/migration.rst
similarity index 100%
rename from doc/driver-model/migration.rst
rename to doc/develop/driver-model/migration.rst
diff --git a/doc/driver-model/of-plat.rst b/doc/develop/driver-model/of-plat.rst
similarity index 100%
rename from doc/driver-model/of-plat.rst
rename to doc/develop/driver-model/of-plat.rst
diff --git a/doc/driver-model/pci-info.rst b/doc/develop/driver-model/pci-info.rst
similarity index 100%
rename from doc/driver-model/pci-info.rst
rename to doc/develop/driver-model/pci-info.rst
diff --git a/doc/driver-model/pmic-framework.rst b/doc/develop/driver-model/pmic-framework.rst
similarity index 100%
rename from doc/driver-model/pmic-framework.rst
rename to doc/develop/driver-model/pmic-framework.rst
diff --git a/doc/driver-model/remoteproc-framework.rst b/doc/develop/driver-model/remoteproc-framework.rst
similarity index 100%
rename from doc/driver-model/remoteproc-framework.rst
rename to doc/develop/driver-model/remoteproc-framework.rst
diff --git a/doc/driver-model/serial-howto.rst b/doc/develop/driver-model/serial-howto.rst
similarity index 100%
rename from doc/driver-model/serial-howto.rst
rename to doc/develop/driver-model/serial-howto.rst
diff --git a/doc/driver-model/soc-framework.rst b/doc/develop/driver-model/soc-framework.rst
similarity index 100%
rename from doc/driver-model/soc-framework.rst
rename to doc/develop/driver-model/soc-framework.rst
diff --git a/doc/driver-model/spi-howto.rst b/doc/develop/driver-model/spi-howto.rst
similarity index 100%
rename from doc/driver-model/spi-howto.rst
rename to doc/develop/driver-model/spi-howto.rst
diff --git a/doc/driver-model/usb-info.rst b/doc/develop/driver-model/usb-info.rst
similarity index 100%
rename from doc/driver-model/usb-info.rst
rename to doc/develop/driver-model/usb-info.rst
diff --git a/doc/develop/index.rst b/doc/develop/index.rst
index 84914bb47bf..444df679578 100644
--- a/doc/develop/index.rst
+++ b/doc/develop/index.rst
@@ -10,6 +10,7 @@ Implementation
    :maxdepth: 1
 
    commands
+   driver-model/index
    global_data
    logging
    menus
diff --git a/doc/index.rst b/doc/index.rst
index 366963813ac..f7aada966b0 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -38,17 +38,6 @@ want to contribute to U-Boot.
 
    develop/index
 
-Driver-Model documentation
---------------------------
-
-The following holds information on the U-Boot device driver framework:
-driver-model, including the design details of itself and several driver
-subsystems.
-
-.. toctree::
-   :maxdepth: 2
-
-   driver-model/index
 
 U-Boot API documentation
 ------------------------
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 23/27] binman: doc: Add documentation to htmldocs
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (21 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 22/27] doc: Move driver model docs " Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 24/27] binman: Rearrange documentation into headings Simon Glass
                   ` (29 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

Add a link to binman's documentation and adjust the files so that it is
accessible. Use the name README.rst so it is easy to discover when binman
is installed without U-Boot.

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

(no changes since v2)

Changes in v2:
- Put binman docs in doc/develop and FIT in doc/usage
- Rename README.rst to binman.rst and use a symlink

 doc/develop/index.rst               |   8 +
 doc/develop/package/binman.rst      |   1 +
 doc/develop/package/index.rst       |  19 ++
 doc/usage/fit.rst                   |   8 +
 doc/usage/index.rst                 |   1 +
 tools/binman/README.rst             |   1 +
 tools/binman/{README => binman.rst} | 484 ++++++++++++++--------------
 tools/binman/control.py             |   2 +-
 tools/binman/ftest.py               |   4 +-
 tools/binman/index.rst              |   9 +
 tools/binman/setup.py               |   2 +-
 11 files changed, 294 insertions(+), 245 deletions(-)
 create mode 120000 doc/develop/package/binman.rst
 create mode 100644 doc/develop/package/index.rst
 create mode 100644 doc/usage/fit.rst
 create mode 120000 tools/binman/README.rst
 rename tools/binman/{README => binman.rst} (73%)
 create mode 100644 tools/binman/index.rst

diff --git a/doc/develop/index.rst b/doc/develop/index.rst
index 444df679578..3edffbc6373 100644
--- a/doc/develop/index.rst
+++ b/doc/develop/index.rst
@@ -26,6 +26,14 @@ Debugging
    crash_dumps
    trace
 
+Packaging
+---------
+
+.. toctree::
+   :maxdepth: 1
+
+   package/index
+
 Testing
 -------
 
diff --git a/doc/develop/package/binman.rst b/doc/develop/package/binman.rst
new file mode 120000
index 00000000000..2e26e84b7d2
--- /dev/null
+++ b/doc/develop/package/binman.rst
@@ -0,0 +1 @@
+../../../tools/binman/binman.rst
\ No newline at end of file
diff --git a/doc/develop/package/index.rst b/doc/develop/package/index.rst
new file mode 100644
index 00000000000..9374be2e62c
--- /dev/null
+++ b/doc/develop/package/index.rst
@@ -0,0 +1,19 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Package U-Boot
+==============
+
+U-Boot uses Flat Image Tree (FIT) as a standard file format for packaging
+images that it it reads and boots. Documentation about FIT is available at
+doc/uImage.FIT
+
+U-Boot also provides binman for cases not covered by FIT. Examples include
+initial execution (since FIT itself does not have an executable header) and
+dealing with device boundaries, such as the read-only/read-write separation in
+SPI flash.
+
+
+.. toctree::
+   :maxdepth: 2
+
+   binman
diff --git a/doc/usage/fit.rst b/doc/usage/fit.rst
new file mode 100644
index 00000000000..70374340577
--- /dev/null
+++ b/doc/usage/fit.rst
@@ -0,0 +1,8 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Flat Image Tree (FIT)
+=====================
+
+U-Boot uses Flat Image Tree (FIT) as a standard file format for packaging
+images that it it reads and boots. Documentation about FIT is available at
+doc/uImage.FIT
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index f7b706f9166..a79032dc287 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -5,6 +5,7 @@ Use U-Boot
    :maxdepth: 1
 
    fdt_overlays
+   fit
    netconsole
    partitions
 
diff --git a/tools/binman/README.rst b/tools/binman/README.rst
new file mode 120000
index 00000000000..b734f544b73
--- /dev/null
+++ b/tools/binman/README.rst
@@ -0,0 +1 @@
+binman.rst
\ No newline at end of file
diff --git a/tools/binman/README b/tools/binman/binman.rst
similarity index 73%
rename from tools/binman/README
rename to tools/binman/binman.rst
index 1de703cc653..fd6308b6e42 100644
--- a/tools/binman/README
+++ b/tools/binman/binman.rst
@@ -1,5 +1,5 @@
-# SPDX-License-Identifier: GPL-2.0+
-# Copyright (c) 2016 Google, Inc
+.. SPDX-License-Identifier: GPL-2.0+
+.. Copyright (c) 2016 Google, Inc
 
 Introduction
 ------------
@@ -67,18 +67,19 @@ standard format, we can support making valid images for any board without
 manual effort, lots of READMEs, etc.
 
 Benefits:
-- Each binary can have its own build system and tool chain without creating
-any dependencies between them
-- Avoids the need for a single-shot build: individual parts can be updated
-and brought in as needed
-- Provides for a standard image description available in the build and at
-run-time
-- SoC-specific image-signing tools can be accommodated
-- Avoids cluttering the U-Boot build system with image-building code
-- The image description is automatically available at run-time in U-Boot,
-SPL. It can be made available to other software also
-- The image description is easily readable (it's a text file in device-tree
-format) and permits flexible packing of binaries
+
+  - Each binary can have its own build system and tool chain without creating
+    any dependencies between them
+  - Avoids the need for a single-shot build: individual parts can be updated
+    and brought in as needed
+  - Provides for a standard image description available in the build and at
+    run-time
+  - SoC-specific image-signing tools can be accommodated
+  - Avoids cluttering the U-Boot build system with image-building code
+  - The image description is automatically available at run-time in U-Boot,
+    SPL. It can be made available to other software also
+  - The image description is easily readable (it's a text file in device-tree
+    format) and permits flexible packing of binaries
 
 
 Terminology
@@ -144,14 +145,14 @@ build system.
 
 Consider sunxi. It has the following steps:
 
-1. It uses a custom mksunxiboot tool to build an SPL image called
-sunxi-spl.bin. This should probably move into mkimage.
+  #. It uses a custom mksunxiboot tool to build an SPL image called
+     sunxi-spl.bin. This should probably move into mkimage.
 
-2. It uses mkimage to package U-Boot into a legacy image file (so that it can
-hold the load and execution address) called u-boot.img.
+  #. It uses mkimage to package U-Boot into a legacy image file (so that it can
+     hold the load and execution address) called u-boot.img.
 
-3. It builds a final output image called u-boot-sunxi-with-spl.bin which
-consists of sunxi-spl.bin, some padding and u-boot.img.
+  #. It builds a final output image called u-boot-sunxi-with-spl.bin which
+     consists of sunxi-spl.bin, some padding and u-boot.img.
 
 Binman is intended to replace the last step. The U-Boot build system builds
 u-boot.bin and sunxi-spl.bin. Binman can then take over creation of
@@ -180,22 +181,22 @@ the configuration of the Intel-format descriptor.
 Running binman
 --------------
 
-First install prerequisites, e.g.
+First install prerequisites, e.g::
 
-	sudo apt-get install python-pyelftools python3-pyelftools lzma-alone \
-		liblz4-tool
+    sudo apt-get install python-pyelftools python3-pyelftools lzma-alone \
+        liblz4-tool
 
-Type:
+Type::
 
-	binman build -b <board_name>
+    binman build -b <board_name>
 
 to build an image for a board. The board name is the same name used when
 configuring U-Boot (e.g. for sandbox_defconfig the board name is 'sandbox').
 Binman assumes that the input files for the build are in ../b/<board_name>.
 
-Or you can specify this explicitly:
+Or you can specify this explicitly::
 
-	binman build -I <build_path>
+    binman build -I <build_path>
 
 where <build_path> is the build directory containing the output of the U-Boot
 build.
@@ -212,12 +213,12 @@ Enabling binman for a board
 ---------------------------
 
 At present binman is invoked from a rule in the main Makefile. Typically you
-will have a rule like:
+will have a rule like::
 
-ifneq ($(CONFIG_ARCH_<something>),)
-u-boot-<your_suffix>.bin: <input_file_1> <input_file_2> checkbinman FORCE
-	$(call if_changed,binman)
-endif
+    ifneq ($(CONFIG_ARCH_<something>),)
+    u-boot-<your_suffix>.bin: <input_file_1> <input_file_2> checkbinman FORCE
+        $(call if_changed,binman)
+    endif
 
 This assumes that u-boot-<your_suffix>.bin is a target, and is the final file
 that you need to produce. You can make it a target by adding it to INPUTS-y
@@ -233,18 +234,18 @@ Image description format
 ------------------------
 
 The binman node is called 'binman'. An example image description is shown
-below:
+below::
 
-	binman {
-		filename = "u-boot-sunxi-with-spl.bin";
-		pad-byte = <0xff>;
-		blob {
-			filename = "spl/sunxi-spl.bin";
-		};
-		u-boot {
-			offset = <CONFIG_SPL_PAD_TO>;
-		};
-	};
+    binman {
+        filename = "u-boot-sunxi-with-spl.bin";
+        pad-byte = <0xff>;
+        blob {
+            filename = "spl/sunxi-spl.bin";
+        };
+        u-boot {
+            offset = <CONFIG_SPL_PAD_TO>;
+        };
+    };
 
 
 This requests binman to create an image file called u-boot-sunxi-with-spl.bin
@@ -270,184 +271,184 @@ use any unique name, with the 'type' property providing the type.
 The attributes supported for entries are described below.
 
 offset:
-	This sets the offset of an entry within the image or section containing
-	it. The first byte of the image is normally at offset 0. If 'offset' is
-	not provided, binman sets it to the end of the previous region, or the
-	start of the image's entry area (normally 0) if there is no previous
-	region.
+    This sets the offset of an entry within the image or section containing
+    it. The first byte of the image is normally at offset 0. If 'offset' is
+    not provided, binman sets it to the end of the previous region, or the
+    start of the image's entry area (normally 0) if there is no previous
+    region.
 
 align:
-	This sets the alignment of the entry. The entry offset is adjusted
-	so that the entry starts on an aligned boundary within the containing
-	section or image. For example 'align = <16>' means that the entry will
-	start on a 16-byte boundary. This may mean that padding is added before
-	the entry. The padding is part of the containing section but is not
-	included in the entry, meaning that an empty space may be created before
-	the entry starts. Alignment should be a power of 2. If 'align' is not
-	provided, no alignment is performed.
+    This sets the alignment of the entry. The entry offset is adjusted
+    so that the entry starts on an aligned boundary within the containing
+    section or image. For example 'align = <16>' means that the entry will
+    start on a 16-byte boundary. This may mean that padding is added before
+    the entry. The padding is part of the containing section but is not
+    included in the entry, meaning that an empty space may be created before
+    the entry starts. Alignment should be a power of 2. If 'align' is not
+    provided, no alignment is performed.
 
 size:
-	This sets the size of the entry. The contents will be padded out to
-	this size. If this is not provided, it will be set to the size of the
-	contents.
+    This sets the size of the entry. The contents will be padded out to
+    this size. If this is not provided, it will be set to the size of the
+    contents.
 
 pad-before:
-	Padding before the contents of the entry. Normally this is 0, meaning
-	that the contents start at the beginning of the entry. This can be used
-	to offset the entry contents a little. While this does not affect the
-	contents of the entry within binman itself (the padding is performed
-	only when its parent section is assembled), the end result will be that
-	the entry starts with the padding bytes, so may grow. Defaults to 0.
+    Padding before the contents of the entry. Normally this is 0, meaning
+    that the contents start at the beginning of the entry. This can be used
+    to offset the entry contents a little. While this does not affect the
+    contents of the entry within binman itself (the padding is performed
+    only when its parent section is assembled), the end result will be that
+    the entry starts with the padding bytes, so may grow. Defaults to 0.
 
 pad-after:
-	Padding after the contents of the entry. Normally this is 0, meaning
-	that the entry ends at the last byte of content (unless adjusted by
-	other properties). This allows room to be created in the image for
-	this entry to expand later. While this does not affect the contents of
-	the entry within binman itself (the padding is performed only when its
-	parent section is assembled), the end result will be that the entry ends
-	with the padding bytes, so may grow. Defaults to 0.
+    Padding after the contents of the entry. Normally this is 0, meaning
+    that the entry ends at the last byte of content (unless adjusted by
+    other properties). This allows room to be created in the image for
+    this entry to expand later. While this does not affect the contents of
+    the entry within binman itself (the padding is performed only when its
+    parent section is assembled), the end result will be that the entry ends
+    with the padding bytes, so may grow. Defaults to 0.
 
 align-size:
-	This sets the alignment of the entry size. For example, to ensure
-	that the size of an entry is a multiple of 64 bytes, set this to 64.
-	While this does not affect the contents of the entry within binman
-	itself (the padding is performed only when its parent section is
-	assembled), the end result is that the entry ends with the padding
-	bytes, so may grow. If 'align-size' is not provided, no alignment is
-	performed.
+    This sets the alignment of the entry size. For example, to ensure
+    that the size of an entry is a multiple of 64 bytes, set this to 64.
+    While this does not affect the contents of the entry within binman
+    itself (the padding is performed only when its parent section is
+    assembled), the end result is that the entry ends with the padding
+    bytes, so may grow. If 'align-size' is not provided, no alignment is
+    performed.
 
 align-end:
-	This sets the alignment of the end of an entry with respect to the
-	containing section. Some entries require that they end on an alignment
-	boundary, regardless of where they start. This does not move the start
-	of the entry, so the contents of the entry will still start at the
-	beginning. But there may be padding at the end. While this does not
-	affect the contents of the entry within binman itself (the padding is
-	performed only when its parent section is assembled), the end result
-	is that the entry ends with the padding bytes, so may grow.
-	If 'align-end' is not provided, no alignment is performed.
+    This sets the alignment of the end of an entry with respect to the
+    containing section. Some entries require that they end on an alignment
+    boundary, regardless of where they start. This does not move the start
+    of the entry, so the contents of the entry will still start at the
+    beginning. But there may be padding at the end. While this does not
+    affect the contents of the entry within binman itself (the padding is
+    performed only when its parent section is assembled), the end result
+    is that the entry ends with the padding bytes, so may grow.
+    If 'align-end' is not provided, no alignment is performed.
 
 filename:
-	For 'blob' types this provides the filename containing the binary to
-	put into the entry. If binman knows about the entry type (like
-	u-boot-bin), then there is no need to specify this.
+    For 'blob' types this provides the filename containing the binary to
+    put into the entry. If binman knows about the entry type (like
+    u-boot-bin), then there is no need to specify this.
 
 type:
-	Sets the type of an entry. This defaults to the entry name, but it is
-	possible to use any name, and then add (for example) 'type = "u-boot"'
-	to specify the type.
+    Sets the type of an entry. This defaults to the entry name, but it is
+    possible to use any name, and then add (for example) 'type = "u-boot"'
+    to specify the type.
 
 offset-unset:
-	Indicates that the offset of this entry should not be set by placing
-	it immediately after the entry before. Instead, is set by another
-	entry which knows where this entry should go. When this boolean
-	property is present, binman will give an error if another entry does
-	not set the offset (with the GetOffsets() method).
+    Indicates that the offset of this entry should not be set by placing
+    it immediately after the entry before. Instead, is set by another
+    entry which knows where this entry should go. When this boolean
+    property is present, binman will give an error if another entry does
+    not set the offset (with the GetOffsets() method).
 
 image-pos:
-	This cannot be set on entry (or at least it is ignored if it is), but
-	with the -u option, binman will set it to the absolute image position
-	for each entry. This makes it easy to find out exactly where the entry
-	ended up in the image, regardless of parent sections, etc.
+    This cannot be set on entry (or at least it is ignored if it is), but
+    with the -u option, binman will set it to the absolute image position
+    for each entry. This makes it easy to find out exactly where the entry
+    ended up in the image, regardless of parent sections, etc.
 
 expand-size:
-	Expand the size of this entry to fit available space. This space is only
-	limited by the size of the image/section and the position of the next
-	entry.
+    Expand the size of this entry to fit available space. This space is only
+    limited by the size of the image/section and the position of the next
+    entry.
 
 compress:
-	Sets the compression algortihm to use (for blobs only). See the entry
-	documentation for details.
+    Sets the compression algortihm to use (for blobs only). See the entry
+    documentation for details.
 
 missing-msg:
-	Sets the tag of the message to show if this entry is missing. This is
-	used for external blobs. When they are missing it is helpful to show
-	information about what needs to be fixed. See missing-blob-help for the
-	message for each tag.
+    Sets the tag of the message to show if this entry is missing. This is
+    used for external blobs. When they are missing it is helpful to show
+    information about what needs to be fixed. See missing-blob-help for the
+    message for each tag.
 
 The attributes supported for images and sections are described below. Several
 are similar to those for entries.
 
 size:
-	Sets the image size in bytes, for example 'size = <0x100000>' for a
-	1MB image.
+    Sets the image size in bytes, for example 'size = <0x100000>' for a
+    1MB image.
 
 offset:
-	This is similar to 'offset' in entries, setting the offset of a section
-	within the image or section containing it. The first byte of the section
-	is normally at offset 0. If 'offset' is not provided, binman sets it to
-	the end of the previous region, or the start of the image's entry area
-	(normally 0) if there is no previous region.
+    This is similar to 'offset' in entries, setting the offset of a section
+    within the image or section containing it. The first byte of the section
+    is normally at offset 0. If 'offset' is not provided, binman sets it to
+    the end of the previous region, or the start of the image's entry area
+    (normally 0) if there is no previous region.
 
 align-size:
-	This sets the alignment of the image size. For example, to ensure
-	that the image ends on a 512-byte boundary, use 'align-size = <512>'.
-	If 'align-size' is not provided, no alignment is performed.
+    This sets the alignment of the image size. For example, to ensure
+    that the image ends on a 512-byte boundary, use 'align-size = <512>'.
+    If 'align-size' is not provided, no alignment is performed.
 
 pad-before:
-	This sets the padding before the image entries. The first entry will
-	be positioned after the padding. This defaults to 0.
+    This sets the padding before the image entries. The first entry will
+    be positioned after the padding. This defaults to 0.
 
 pad-after:
-	This sets the padding after the image entries. The padding will be
-	placed after the last entry. This defaults to 0.
+    This sets the padding after the image entries. The padding will be
+    placed after the last entry. This defaults to 0.
 
 pad-byte:
-	This specifies the pad byte to use when padding in the image. It
-	defaults to 0. To use 0xff, you would add 'pad-byte = <0xff>'.
+    This specifies the pad byte to use when padding in the image. It
+    defaults to 0. To use 0xff, you would add 'pad-byte = <0xff>'.
 
 filename:
-	This specifies the image filename. It defaults to 'image.bin'.
+    This specifies the image filename. It defaults to 'image.bin'.
 
 sort-by-offset:
-	This causes binman to reorder the entries as needed to make sure they
-	are in increasing positional order. This can be used when your entry
-	order may not match the positional order. A common situation is where
-	the 'offset' properties are set by CONFIG options, so their ordering is
-	not known a priori.
+    This causes binman to reorder the entries as needed to make sure they
+    are in increasing positional order. This can be used when your entry
+    order may not match the positional order. A common situation is where
+    the 'offset' properties are set by CONFIG options, so their ordering is
+    not known a priori.
 
-	This is a boolean property so needs no value. To enable it, add a
-	line 'sort-by-offset;' to your description.
+    This is a boolean property so needs no value. To enable it, add a
+    line 'sort-by-offset;' to your description.
 
 multiple-images:
-	Normally only a single image is generated. To create more than one
-	image, put this property in the binman node. For example, this will
-	create image1.bin containing u-boot.bin, and image2.bin containing
-	both spl/u-boot-spl.bin and u-boot.bin:
-
-	binman {
-		multiple-images;
-		image1 {
-			u-boot {
-			};
-		};
-
-		image2 {
-			spl {
-			};
-			u-boot {
-			};
-		};
-	};
+    Normally only a single image is generated. To create more than one
+    image, put this property in the binman node. For example, this will
+    create image1.bin containing u-boot.bin, and image2.bin containing
+    both spl/u-boot-spl.bin and u-boot.bin::
+
+        binman {
+            multiple-images;
+            image1 {
+                u-boot {
+                };
+            };
+
+            image2 {
+                spl {
+                };
+                u-boot {
+                };
+            };
+        };
 
 end-at-4gb:
-	For x86 machines the ROM offsets start just before 4GB and extend
-	up so that the image finished at the 4GB boundary. This boolean
-	option can be enabled to support this. The image size must be
-	provided so that binman knows when the image should start. For an
-	8MB ROM, the offset of the first entry would be 0xfff80000 with
-	this option, instead of 0 without this option.
+    For x86 machines the ROM offsets start just before 4GB and extend
+    up so that the image finished at the 4GB boundary. This boolean
+    option can be enabled to support this. The image size must be
+    provided so that binman knows when the image should start. For an
+    8MB ROM, the offset of the first entry would be 0xfff80000 with
+    this option, instead of 0 without this option.
 
 skip-at-start:
-	This property specifies the entry offset of the first entry.
+    This property specifies the entry offset of the first entry.
 
-	For PowerPC mpc85xx based CPU, CONFIG_SYS_TEXT_BASE is the entry
-	offset of the first entry. It can be 0xeff40000 or 0xfff40000 for
-	nor flash boot, 0x201000 for sd boot etc.
+    For PowerPC mpc85xx based CPU, CONFIG_SYS_TEXT_BASE is the entry
+    offset of the first entry. It can be 0xeff40000 or 0xfff40000 for
+    nor flash boot, 0x201000 for sd boot etc.
 
-	'end-at-4gb' property is not applicable where CONFIG_SYS_TEXT_BASE +
-	Image size != 4gb.
+    'end-at-4gb' property is not applicable where CONFIG_SYS_TEXT_BASE +
+    Image size != 4gb.
 
 Examples of the above options can be found in the tests. See the
 tools/binman/test directory.
@@ -470,23 +471,23 @@ This feature provides a way of creating hierarchical images. For example here
 is an example image with two copies of U-Boot. One is read-only (ro), intended
 to be written only in the factory. Another is read-write (rw), so that it can be
 upgraded in the field. The sizes are fixed so that the ro/rw boundary is known
-and can be programmed:
-
-	binman {
-		section at 0 {
-			read-only;
-			name-prefix = "ro-";
-			size = <0x100000>;
-			u-boot {
-			};
-		};
-		section at 1 {
-			name-prefix = "rw-";
-			size = <0x100000>;
-			u-boot {
-			};
-		};
-	};
+and can be programmed::
+
+    binman {
+        section at 0 {
+            read-only;
+            name-prefix = "ro-";
+            size = <0x100000>;
+            u-boot {
+            };
+        };
+        section at 1 {
+            name-prefix = "rw-";
+            size = <0x100000>;
+            u-boot {
+            };
+        };
+    };
 
 This image could be placed into a SPI flash chip, with the protection boundary
 set at 1MB.
@@ -494,14 +495,14 @@ set at 1MB.
 A few special properties are provided for sections:
 
 read-only:
-	Indicates that this section is read-only. This has no impact on binman's
-	operation, but his property can be read at run time.
+    Indicates that this section is read-only. This has no impact on binman's
+    operation, but his property can be read at run time.
 
 name-prefix:
-	This string is prepended to all the names of the binaries in the
-	section. In the example above, the 'u-boot' binaries which actually be
-	renamed to 'ro-u-boot' and 'rw-u-boot'. This can be useful to
-	distinguish binaries with otherwise identical names.
+    This string is prepended to all the names of the binaries in the
+    section. In the example above, the 'u-boot' binaries which actually be
+    renamed to 'ro-u-boot' and 'rw-u-boot'. This can be useful to
+    distinguish binaries with otherwise identical names.
 
 
 Image Properties
@@ -510,21 +511,21 @@ Image Properties
 Image nodes act like sections but also have a few extra properties:
 
 filename:
-	Output filename for the image. This defaults to image.bin (or in the
-	case of multiple images <nodename>.bin where <nodename> is the name of
-	the image node.
+    Output filename for the image. This defaults to image.bin (or in the
+    case of multiple images <nodename>.bin where <nodename> is the name of
+    the image node.
 
 allow-repack:
-	Create an image that can be repacked. With this option it is possible
-	to change anything in the image after it is created, including updating
-	the position and size of image components. By default this is not
-	permitted since it is not possibly to know whether this might violate a
-	constraint in the image description. For example, if a section has to
-	increase in size to hold a larger binary, that might cause the section
-	to fall out of its allow region (e.g. read-only portion of flash).
+    Create an image that can be repacked. With this option it is possible
+    to change anything in the image after it is created, including updating
+    the position and size of image components. By default this is not
+    permitted since it is not possibly to know whether this might violate a
+    constraint in the image description. For example, if a section has to
+    increase in size to hold a larger binary, that might cause the section
+    to fall out of its allow region (e.g. read-only portion of flash).
 
-	Adding this property causes the original offset and size values in the
-	image description to be stored in the FDT and fdtmap.
+    Adding this property causes the original offset and size values in the
+    image description to be stored in the FDT and fdtmap.
 
 
 Entry Documentation
@@ -533,14 +534,14 @@ Entry Documentation
 For details on the various entry types supported by binman and how to use them,
 see README.entries. This is generated from the source code using:
 
-	binman entry-docs >tools/binman/README.entries
+    binman entry-docs >tools/binman/README.entries
 
 
 Listing images
 --------------
 
 It is possible to list the entries in an existing firmware image created by
-binman, provided that there is an 'fdtmap' entry in the image. For example:
+binman, provided that there is an 'fdtmap' entry in the image. For example::
 
     $ binman ls -i image.bin
     Name              Image-pos  Size  Entry-type    Offset  Uncomp-size
@@ -559,7 +560,7 @@ This shows the hierarchy of the image, the position, size and type of each
 entry, the offset of each entry within its parent and the uncompressed size if
 the entry is compressed.
 
-It is also possible to list just some files in an image, e.g.
+It is also possible to list just some files in an image, e.g.::
 
     $ binman ls -i image.bin section/cbfs
     Name              Image-pos  Size  Entry-type  Offset  Uncomp-size
@@ -568,7 +569,7 @@ It is also possible to list just some files in an image, e.g.
           u-boot            138     4  u-boot          38
           u-boot-dtb        180   108  u-boot-dtb      80          3b5
 
-or with wildcards:
+or with wildcards::
 
     $ binman ls -i image.bin "*cb*" "*head*"
     Name              Image-pos  Size  Entry-type    Offset  Uncomp-size
@@ -583,22 +584,22 @@ Extracting files from images
 ----------------------------
 
 You can extract files from an existing firmware image created by binman,
-provided that there is an 'fdtmap' entry in the image. For example:
+provided that there is an 'fdtmap' entry in the image. For example::
 
     $ binman extract -i image.bin section/cbfs/u-boot
 
 which will write the uncompressed contents of that entry to the file 'u-boot' in
 the current directory. You can also extract to a particular file, in this case
-u-boot.bin:
+u-boot.bin::
 
     $ binman extract -i image.bin section/cbfs/u-boot -f u-boot.bin
 
 It is possible to extract all files into a destination directory, which will
-put files in subdirectories matching the entry hierarchy:
+put files in subdirectories matching the entry hierarchy::
 
     $ binman extract -i image.bin -O outdir
 
-or just a selection:
+or just a selection::
 
     $ binman extract -i image.bin "*u-boot*" -O outdir
 
@@ -616,18 +617,18 @@ to the that entry, compressing if necessary. If the entry size changes, you must
 add the 'allow-repack' property to the original image before generating it (see
 above), otherwise you will get an error.
 
-You can also use a particular file, in this case u-boot.bin:
+You can also use a particular file, in this case u-boot.bin::
 
     $ binman replace -i image.bin section/cbfs/u-boot -f u-boot.bin
 
 It is possible to replace all files from a source directory which uses the same
-hierarchy as the entries:
+hierarchy as the entries::
 
     $ binman replace -i image.bin -I indir
 
 Files that are missing will generate a warning.
 
-You can also replace just a selection of entries:
+You can also replace just a selection of entries::
 
     $ binman replace -i image.bin "*u-boot*" -I indir
 
@@ -656,15 +657,15 @@ Hashing Entries
 ---------------
 
 It is possible to ask binman to hash the contents of an entry and write that
-value back to the device-tree node. For example:
+value back to the device-tree node. For example::
 
-	binman {
-		u-boot {
-			hash {
-				algo = "sha256";
-			};
-		};
-	};
+    binman {
+        u-boot {
+            hash {
+                algo = "sha256";
+            };
+        };
+    };
 
 Here, a new 'value' property will be written to the 'hash' node containing
 the hash of the 'u-boot' entry. Only SHA256 is supported at present. Whole
@@ -759,7 +760,7 @@ a common header. You can then put the binman node (and anything else that is
 specific to U-Boot, such as u-boot,dm-pre-reloc properies) in that header
 file.
 
-Binman will search for the following files in arch/<arch>/dts:
+Binman will search for the following files in arch/<arch>/dts::
 
    <dts>-u-boot.dtsi where <dts> is the base name of the .dts file
    <CONFIG_SYS_SOC>-u-boot.dtsi
@@ -770,7 +771,7 @@ Binman will search for the following files in arch/<arch>/dts:
 U-Boot will only use the first one that it finds. If you need to include a
 more general file you can do that from the more specific file using #include.
 If you are having trouble figuring out what is going on, you can uncomment
-the 'warning' line in scripts/Makefile.lib to see what it has found:
+the 'warning' line in scripts/Makefile.lib to see what it has found::
 
    # Uncomment for debugging
    # This shows all the files that were considered and the one that we chose.
@@ -786,13 +787,13 @@ is useful to be able to find the location of U-Boot so that it can be executed
 when SPL is finished.
 
 Binman allows you to declare symbols in the SPL image which are filled in
-with their correct values during the build. For example:
+with their correct values during the build. For example::
 
     binman_sym_declare(ulong, u_boot_any, image_pos);
 
 declares a ulong value which will be assigned to the image-pos of any U-Boot
 image (u-boot.bin, u-boot.img, u-boot-nodtb.bin) that is present in the image.
-You can access this value with something like:
+You can access this value with something like::
 
     ulong u_boot_offset = binman_sym(ulong, u_boot_any, image_pos);
 
@@ -844,18 +845,18 @@ Expanded entries
 ----------------
 
 Binman automatically replaces 'u-boot' with an expanded version of that, i.e.
-'u-boot-expanded'. This means that when you write:
+'u-boot-expanded'. This means that when you write::
 
     u-boot {
     };
 
-you actually get:
+you actually get::
 
     u-boot {
         type = "u-boot-expanded';
     };
 
-which in turn expands to:
+which in turn expands to::
 
     u-boot {
         type = "section";
@@ -879,19 +880,19 @@ U-Boot executable and can be updated separately by binman as needed. It can be
 disabled with the --no-expanded flag if required.
 
 The same applies for u-boot-spl and u-boot-spl. In those cases, the expansion
-includes the BSS padding, so for example:
+includes the BSS padding, so for example::
 
     spl {
         type = "u-boot-spl"
     };
 
-you actually get:
+you actually get::
 
     spl {
         type = "u-boot-expanded';
     };
 
-which in turn expands to:
+which in turn expands to::
 
     spl {
         type = "section";
@@ -921,7 +922,7 @@ Compression
 -----------
 
 Binman support compression for 'blob' entries (those of type 'blob' and
-derivatives). To enable this for an entry, add a 'compress' property:
+derivatives). To enable this for an entry, add a 'compress' property::
 
     blob {
         filename = "datafile";
@@ -946,7 +947,7 @@ Map files
 ---------
 
 The -m option causes binman to output a .map file for each image that it
-generates. This shows the offset and size of each entry. For example:
+generates. This shows the offset and size of each entry. For example::
 
       Offset      Size  Name
     00000000  00000028  main-section
@@ -969,11 +970,11 @@ Sometimes it is useful to pass binman the value of an entry property from the
 command line. For example some entries need access to files and it is not
 always convenient to put these filenames in the image definition (device tree).
 
-The-a option supports this:
+The-a option supports this::
 
     -a<prop>=<value>
 
-where
+where::
 
     <prop> is the property to set
     <value> is the value to set it to
@@ -1004,7 +1005,7 @@ Code coverage
 Binman is a critical tool and is designed to be very testable. Entry
 implementations target 100% test coverage. Run 'binman test -T' to check this.
 
-To enable Python test coverage on Debian-type distributions (e.g. Ubuntu):
+To enable Python test coverage on Debian-type distributions (e.g. Ubuntu)::
 
    $ sudo apt-get install python-coverage python3-coverage python-pytest
 
@@ -1015,7 +1016,7 @@ Concurrent tests
 Binman tries to run tests concurrently. This means that the tests make use of
 all available CPUs to run.
 
- To enable this:
+ To enable this::
 
    $ sudo apt-get install python-subunit python3-subunit
 
@@ -1038,11 +1039,11 @@ Binman's tests have been written under the assumption that they'll be run on a
 x86-like host and there hasn't been an attempt to make them portable yet.
 However, it's possible to run the tests by cross-compiling to x86.
 
-To install an x86 cross-compiler on Debian-type distributions (e.g. Ubuntu):
+To install an x86 cross-compiler on Debian-type distributions (e.g. Ubuntu)::
 
   $ sudo apt-get install gcc-x86-64-linux-gnu
 
-Then, you can run the tests under cross-compilation:
+Then, you can run the tests under cross-compilation::
 
   $ CROSS_COMPILE=x86_64-linux-gnu- binman test -T
 
@@ -1078,13 +1079,13 @@ the DTC environment variable. This can be useful when the system dtc is too
 old.
 
 To enable a full backtrace and other debugging features in binman, pass
-BINMAN_DEBUG=1 to your build:
+BINMAN_DEBUG=1 to your build::
 
    make qemu-x86_defconfig
    make BINMAN_DEBUG=1
 
 To enable verbose logging from binman, base BINMAN_VERBOSE to your build, which
-adds a -v<level> option to the call to binman:
+adds a -v<level> option to the call to binman::
 
    make qemu-x86_defconfig
    make BINMAN_VERBOSE=5
@@ -1124,6 +1125,7 @@ To do
 -----
 
 Some ideas:
+
 - Use of-platdata to make the information available to code that is unable
   to use device tree (such as a very small SPL image)
 - Allow easy building of images by specifying just the board name
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 9709aa9a2b2..f57e34daaaa 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -569,7 +569,7 @@ def Binman(args):
         if not pager:
             pager = 'more'
         fname = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
-                            'README')
+                            'README.rst')
         command.Run(pager, fname)
         return 0
 
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 432c463b58b..81c213a908a 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -631,7 +631,7 @@ class TestFunctional(unittest.TestCase):
     def testFullHelp(self):
         """Test that the full help is displayed with -H"""
         result = self._RunBinman('-H')
-        help_file = os.path.join(self._binman_dir, 'README')
+        help_file = os.path.join(self._binman_dir, 'README.rst')
         # Remove possible extraneous strings
         extra = '::::::::::::::\n' + help_file + '\n::::::::::::::\n'
         gothelp = result.stdout.replace(extra, '')
@@ -644,7 +644,7 @@ class TestFunctional(unittest.TestCase):
         try:
             command.test_result = command.CommandResult()
             result = self._DoBinman('-H')
-            help_file = os.path.join(self._binman_dir, 'README')
+            help_file = os.path.join(self._binman_dir, 'README.rst')
         finally:
             command.test_result = None
 
diff --git a/tools/binman/index.rst b/tools/binman/index.rst
new file mode 100644
index 00000000000..6eef7b5d050
--- /dev/null
+++ b/tools/binman/index.rst
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Binman
+======
+
+.. toctree::
+   :maxdepth: 2
+
+   README
diff --git a/tools/binman/setup.py b/tools/binman/setup.py
index fe408ed6911..2dad43d4937 100644
--- a/tools/binman/setup.py
+++ b/tools/binman/setup.py
@@ -7,6 +7,6 @@ setup(name='binman',
       scripts=['binman'],
       packages=['binman', 'binman.etype'],
       package_dir={'binman': ''},
-      package_data={'binman': ['README', 'README.entries']},
+      package_data={'binman': ['README.rst', 'README.entries']},
       classifiers=['Environment :: Console',
                    'Topic :: Software Development :: Embedded Systems'])
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 24/27] binman: Rearrange documentation into headings
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (22 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 23/27] binman: doc: Add documentation to htmldocs Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 25/27] binman: Incorporate entry documentation Simon Glass
                   ` (28 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

Collect the material into different top-level headings to make it easier
to read.

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

(no changes since v1)

 tools/binman/binman.rst | 523 ++++++++++++++++++++--------------------
 1 file changed, 266 insertions(+), 257 deletions(-)

diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index fd6308b6e42..1cdc9de752a 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -2,7 +2,7 @@
 .. Copyright (c) 2016 Google, Inc
 
 Introduction
-------------
+============
 
 Firmware often consists of several components which must be packaged together.
 For example, we may have SPL, U-Boot, a device tree and an environment area
@@ -137,6 +137,9 @@ the boundaries between building input files (mkimage) and packaging then
 into a final image (binman).
 
 
+Using binman
+============
+
 Example use of binman in U-Boot
 -------------------------------
 
@@ -230,8 +233,111 @@ You can use other, more specific CONFIG options - see 'Automatic .dtsi
 inclusion' below.
 
 
+Access to binman entry offsets at run time (symbols)
+----------------------------------------------------
+
+Binman assembles images and determines where each entry is placed in the image.
+This information may be useful to U-Boot at run time. For example, in SPL it
+is useful to be able to find the location of U-Boot so that it can be executed
+when SPL is finished.
+
+Binman allows you to declare symbols in the SPL image which are filled in
+with their correct values during the build. For example::
+
+    binman_sym_declare(ulong, u_boot_any, image_pos);
+
+declares a ulong value which will be assigned to the image-pos of any U-Boot
+image (u-boot.bin, u-boot.img, u-boot-nodtb.bin) that is present in the image.
+You can access this value with something like::
+
+    ulong u_boot_offset = binman_sym(ulong, u_boot_any, image_pos);
+
+Thus u_boot_offset will be set to the image-pos of U-Boot in memory, assuming
+that the whole image has been loaded, or is available in flash. You can then
+jump to that address to start U-Boot.
+
+At present this feature is only supported in SPL and TPL. In principle it is
+possible to fill in such symbols in U-Boot proper, as well, but a future C
+library is planned for this instead, to read from the device tree.
+
+As well as image-pos, it is possible to read the size of an entry and its
+offset (which is the start position of the entry within its parent).
+
+A small technical note: Binman automatically adds the base address of the image
+(i.e. __image_copy_start) to the value of the image-pos symbol, so that when the
+image is loaded to its linked address, the value will be correct and actually
+point into the image.
+
+For example, say SPL is at the start of the image and linked to start at address
+80108000. If U-Boot's image-pos is 0x8000 then binman will write an image-pos
+for U-Boot of 80110000 into the SPL binary, since it assumes the image is loaded
+to 80108000, with SPL at 80108000 and U-Boot at 80110000.
+
+For x86 devices (with the end-at-4gb property) this base address is not added
+since it is assumed that images are XIP and the offsets already include the
+address.
+
+
+Access to binman entry offsets at run time (fdt)
+------------------------------------------------
+
+Binman can update the U-Boot FDT to include the final position and size of
+each entry in the images it processes. The option to enable this is -u and it
+causes binman to make sure that the 'offset', 'image-pos' and 'size' properties
+are set correctly for every entry. Since it is not necessary to specify these in
+the image definition, binman calculates the final values and writes these to
+the device tree. These can be used by U-Boot at run-time to find the location
+of each entry.
+
+Alternatively, an FDT map entry can be used to add a special FDT containing
+just the information about the image. This is preceded by a magic string so can
+be located anywhere in the image. An image header (typically at the start or end
+of the image) can be used to point to the FDT map. See fdtmap and image-header
+entries for more information.
+
+
+Map files
+---------
+
+The -m option causes binman to output a .map file for each image that it
+generates. This shows the offset and size of each entry. For example::
+
+      Offset      Size  Name
+    00000000  00000028  main-section
+     00000000  00000010  section at 0
+      00000000  00000004  u-boot
+     00000010  00000010  section at 1
+      00000000  00000004  u-boot
+
+This shows a hierarchical image with two sections, each with a single entry. The
+offsets of the sections are absolute hex byte offsets within the image. The
+offsets of the entries are relative to their respective sections. The size of
+each entry is also shown, in bytes (hex). The indentation shows the entries
+nested inside their sections.
+
+
+Passing command-line arguments to entries
+-----------------------------------------
+
+Sometimes it is useful to pass binman the value of an entry property from the
+command line. For example some entries need access to files and it is not
+always convenient to put these filenames in the image definition (device tree).
+
+The-a option supports this::
+
+    -a<prop>=<value>
+
+where::
+
+    <prop> is the property to set
+    <value> is the value to set it to
+
+Not all properties can be provided this way. Only some entries support it,
+typically for filenames.
+
+
 Image description format
-------------------------
+========================
 
 The binman node is called 'binman'. An example image description is shown
 below::
@@ -528,6 +634,157 @@ allow-repack:
     image description to be stored in the FDT and fdtmap.
 
 
+Hashing Entries
+---------------
+
+It is possible to ask binman to hash the contents of an entry and write that
+value back to the device-tree node. For example::
+
+    binman {
+        u-boot {
+            hash {
+                algo = "sha256";
+            };
+        };
+    };
+
+Here, a new 'value' property will be written to the 'hash' node containing
+the hash of the 'u-boot' entry. Only SHA256 is supported at present. Whole
+sections can be hased if desired, by adding the 'hash' node to the section.
+
+The has value can be chcked at runtime by hashing the data actually read and
+comparing this has to the value in the device tree.
+
+
+Expanded entries
+----------------
+
+Binman automatically replaces 'u-boot' with an expanded version of that, i.e.
+'u-boot-expanded'. This means that when you write::
+
+    u-boot {
+    };
+
+you actually get::
+
+    u-boot {
+        type = "u-boot-expanded';
+    };
+
+which in turn expands to::
+
+    u-boot {
+        type = "section";
+
+        u-boot-nodtb {
+        };
+
+        u-boot-dtb {
+        };
+    };
+
+U-Boot's various phase binaries actually comprise two or three pieces.
+For example, u-boot.bin has the executable followed by a devicetree.
+
+With binman we want to be able to update that devicetree with full image
+information so that it is accessible to the executable. This is tricky
+if it is not clear where the devicetree starts.
+
+The above feature ensures that the devicetree is clearly separated from the
+U-Boot executable and can be updated separately by binman as needed. It can be
+disabled with the --no-expanded flag if required.
+
+The same applies for u-boot-spl and u-boot-spl. In those cases, the expansion
+includes the BSS padding, so for example::
+
+    spl {
+        type = "u-boot-spl"
+    };
+
+you actually get::
+
+    spl {
+        type = "u-boot-expanded';
+    };
+
+which in turn expands to::
+
+    spl {
+        type = "section";
+
+        u-boot-spl-nodtb {
+        };
+
+        u-boot-spl-bss-pad {
+        };
+
+        u-boot-spl-dtb {
+        };
+    };
+
+Of course we should not expand SPL if it has no devicetree. Also if the BSS
+padding is not needed (because BSS is in RAM as with CONFIG_SPL_SEPARATE_BSS),
+the 'u-boot-spl-bss-pad' subnode should not be created. The use of the expaned
+entry type is controlled by the UseExpanded() method. In the SPL case it checks
+the 'spl-dtb' entry arg, which is 'y' or '1' if SPL has a devicetree.
+
+For the BSS case, a 'spl-bss-pad' entry arg controls whether it is present. All
+entry args are provided by the U-Boot Makefile.
+
+
+Compression
+-----------
+
+Binman support compression for 'blob' entries (those of type 'blob' and
+derivatives). To enable this for an entry, add a 'compress' property::
+
+    blob {
+        filename = "datafile";
+        compress = "lz4";
+    };
+
+The entry will then contain the compressed data, using the 'lz4' compression
+algorithm. Currently this is the only one that is supported. The uncompressed
+size is written to the node in an 'uncomp-size' property, if -u is used.
+
+Compression is also supported for sections. In that case the entire section is
+compressed in one block, including all its contents. This means that accessing
+an entry from the section required decompressing the entire section. Also, the
+size of a section indicates the space that it consumes in its parent section
+(and typically the image). With compression, the section may contain more data,
+and the uncomp-size property indicates that, as above. The contents of the
+section is compressed first, before any padding is added. This ensures that the
+padding itself is not compressed, which would be a waste of time.
+
+
+Automatic .dtsi inclusion
+-------------------------
+
+It is sometimes inconvenient to add a 'binman' node to the .dts file for each
+board. This can be done by using #include to bring in a common file. Another
+approach supported by the U-Boot build system is to automatically include
+a common header. You can then put the binman node (and anything else that is
+specific to U-Boot, such as u-boot,dm-pre-reloc properies) in that header
+file.
+
+Binman will search for the following files in arch/<arch>/dts::
+
+   <dts>-u-boot.dtsi where <dts> is the base name of the .dts file
+   <CONFIG_SYS_SOC>-u-boot.dtsi
+   <CONFIG_SYS_CPU>-u-boot.dtsi
+   <CONFIG_SYS_VENDOR>-u-boot.dtsi
+   u-boot.dtsi
+
+U-Boot will only use the first one that it finds. If you need to include a
+more general file you can do that from the more specific file using #include.
+If you are having trouble figuring out what is going on, you can uncomment
+the 'warning' line in scripts/Makefile.lib to see what it has found::
+
+   # Uncomment for debugging
+   # This shows all the files that were considered and the one that we chose.
+   # u_boot_dtsi_options_debug = $(u_boot_dtsi_options_raw)
+
+
 Entry Documentation
 -------------------
 
@@ -537,6 +794,9 @@ see README.entries. This is generated from the source code using:
     binman entry-docs >tools/binman/README.entries
 
 
+Managing images
+===============
+
 Listing images
 --------------
 
@@ -653,27 +913,9 @@ by increasing the -v/--verbosity from the default of 1:
 
 You can use BINMAN_VERBOSE=5 (for example) when building to select this.
 
-Hashing Entries
----------------
-
-It is possible to ask binman to hash the contents of an entry and write that
-value back to the device-tree node. For example::
-
-    binman {
-        u-boot {
-            hash {
-                algo = "sha256";
-            };
-        };
-    };
-
-Here, a new 'value' property will be written to the 'hash' node containing
-the hash of the 'u-boot' entry. Only SHA256 is supported at present. Whole
-sections can be hased if desired, by adding the 'hash' node to the section.
-
-The has value can be chcked at runtime by hashing the data actually read and
-comparing this has to the value in the device tree.
 
+Technical details
+=================
 
 Order of image creation
 -----------------------
@@ -750,239 +992,6 @@ what happens in this stage.
 final step.
 
 
-Automatic .dtsi inclusion
--------------------------
-
-It is sometimes inconvenient to add a 'binman' node to the .dts file for each
-board. This can be done by using #include to bring in a common file. Another
-approach supported by the U-Boot build system is to automatically include
-a common header. You can then put the binman node (and anything else that is
-specific to U-Boot, such as u-boot,dm-pre-reloc properies) in that header
-file.
-
-Binman will search for the following files in arch/<arch>/dts::
-
-   <dts>-u-boot.dtsi where <dts> is the base name of the .dts file
-   <CONFIG_SYS_SOC>-u-boot.dtsi
-   <CONFIG_SYS_CPU>-u-boot.dtsi
-   <CONFIG_SYS_VENDOR>-u-boot.dtsi
-   u-boot.dtsi
-
-U-Boot will only use the first one that it finds. If you need to include a
-more general file you can do that from the more specific file using #include.
-If you are having trouble figuring out what is going on, you can uncomment
-the 'warning' line in scripts/Makefile.lib to see what it has found::
-
-   # Uncomment for debugging
-   # This shows all the files that were considered and the one that we chose.
-   # u_boot_dtsi_options_debug = $(u_boot_dtsi_options_raw)
-
-
-Access to binman entry offsets at run time (symbols)
-----------------------------------------------------
-
-Binman assembles images and determines where each entry is placed in the image.
-This information may be useful to U-Boot at run time. For example, in SPL it
-is useful to be able to find the location of U-Boot so that it can be executed
-when SPL is finished.
-
-Binman allows you to declare symbols in the SPL image which are filled in
-with their correct values during the build. For example::
-
-    binman_sym_declare(ulong, u_boot_any, image_pos);
-
-declares a ulong value which will be assigned to the image-pos of any U-Boot
-image (u-boot.bin, u-boot.img, u-boot-nodtb.bin) that is present in the image.
-You can access this value with something like::
-
-    ulong u_boot_offset = binman_sym(ulong, u_boot_any, image_pos);
-
-Thus u_boot_offset will be set to the image-pos of U-Boot in memory, assuming
-that the whole image has been loaded, or is available in flash. You can then
-jump to that address to start U-Boot.
-
-At present this feature is only supported in SPL and TPL. In principle it is
-possible to fill in such symbols in U-Boot proper, as well, but a future C
-library is planned for this instead, to read from the device tree.
-
-As well as image-pos, it is possible to read the size of an entry and its
-offset (which is the start position of the entry within its parent).
-
-A small technical note: Binman automatically adds the base address of the image
-(i.e. __image_copy_start) to the value of the image-pos symbol, so that when the
-image is loaded to its linked address, the value will be correct and actually
-point into the image.
-
-For example, say SPL is at the start of the image and linked to start at address
-80108000. If U-Boot's image-pos is 0x8000 then binman will write an image-pos
-for U-Boot of 80110000 into the SPL binary, since it assumes the image is loaded
-to 80108000, with SPL at 80108000 and U-Boot at 80110000.
-
-For x86 devices (with the end-at-4gb property) this base address is not added
-since it is assumed that images are XIP and the offsets already include the
-address.
-
-
-Access to binman entry offsets at run time (fdt)
-------------------------------------------------
-
-Binman can update the U-Boot FDT to include the final position and size of
-each entry in the images it processes. The option to enable this is -u and it
-causes binman to make sure that the 'offset', 'image-pos' and 'size' properties
-are set correctly for every entry. Since it is not necessary to specify these in
-the image definition, binman calculates the final values and writes these to
-the device tree. These can be used by U-Boot at run-time to find the location
-of each entry.
-
-Alternatively, an FDT map entry can be used to add a special FDT containing
-just the information about the image. This is preceded by a magic string so can
-be located anywhere in the image. An image header (typically at the start or end
-of the image) can be used to point to the FDT map. See fdtmap and image-header
-entries for more information.
-
-
-Expanded entries
-----------------
-
-Binman automatically replaces 'u-boot' with an expanded version of that, i.e.
-'u-boot-expanded'. This means that when you write::
-
-    u-boot {
-    };
-
-you actually get::
-
-    u-boot {
-        type = "u-boot-expanded';
-    };
-
-which in turn expands to::
-
-    u-boot {
-        type = "section";
-
-        u-boot-nodtb {
-        };
-
-        u-boot-dtb {
-        };
-    };
-
-U-Boot's various phase binaries actually comprise two or three pieces.
-For example, u-boot.bin has the executable followed by a devicetree.
-
-With binman we want to be able to update that devicetree with full image
-information so that it is accessible to the executable. This is tricky
-if it is not clear where the devicetree starts.
-
-The above feature ensures that the devicetree is clearly separated from the
-U-Boot executable and can be updated separately by binman as needed. It can be
-disabled with the --no-expanded flag if required.
-
-The same applies for u-boot-spl and u-boot-spl. In those cases, the expansion
-includes the BSS padding, so for example::
-
-    spl {
-        type = "u-boot-spl"
-    };
-
-you actually get::
-
-    spl {
-        type = "u-boot-expanded';
-    };
-
-which in turn expands to::
-
-    spl {
-        type = "section";
-
-        u-boot-spl-nodtb {
-        };
-
-        u-boot-spl-bss-pad {
-        };
-
-        u-boot-spl-dtb {
-        };
-    };
-
-
-Of course we should not expand SPL if it has no devicetree. Also if the BSS
-padding is not needed (because BSS is in RAM as with CONFIG_SPL_SEPARATE_BSS),
-the 'u-boot-spl-bss-pad' subnode should not be created. The use of the expaned
-entry type is controlled by the UseExpanded() method. In the SPL case it checks
-the 'spl-dtb' entry arg, which is 'y' or '1' if SPL has a devicetree.
-
-For the BSS case, a 'spl-bss-pad' entry arg controls whether it is present. All
-entry args are provided by the U-Boot Makefile.
-
-
-Compression
------------
-
-Binman support compression for 'blob' entries (those of type 'blob' and
-derivatives). To enable this for an entry, add a 'compress' property::
-
-    blob {
-        filename = "datafile";
-        compress = "lz4";
-    };
-
-The entry will then contain the compressed data, using the 'lz4' compression
-algorithm. Currently this is the only one that is supported. The uncompressed
-size is written to the node in an 'uncomp-size' property, if -u is used.
-
-Compression is also supported for sections. In that case the entire section is
-compressed in one block, including all its contents. This means that accessing
-an entry from the section required decompressing the entire section. Also, the
-size of a section indicates the space that it consumes in its parent section
-(and typically the image). With compression, the section may contain more data,
-and the uncomp-size property indicates that, as above. The contents of the
-section is compressed first, before any padding is added. This ensures that the
-padding itself is not compressed, which would be a waste of time.
-
-
-Map files
----------
-
-The -m option causes binman to output a .map file for each image that it
-generates. This shows the offset and size of each entry. For example::
-
-      Offset      Size  Name
-    00000000  00000028  main-section
-     00000000  00000010  section at 0
-      00000000  00000004  u-boot
-     00000010  00000010  section at 1
-      00000000  00000004  u-boot
-
-This shows a hierarchical image with two sections, each with a single entry. The
-offsets of the sections are absolute hex byte offsets within the image. The
-offsets of the entries are relative to their respective sections. The size of
-each entry is also shown, in bytes (hex). The indentation shows the entries
-nested inside their sections.
-
-
-Passing command-line arguments to entries
------------------------------------------
-
-Sometimes it is useful to pass binman the value of an entry property from the
-command line. For example some entries need access to files and it is not
-always convenient to put these filenames in the image definition (device tree).
-
-The-a option supports this::
-
-    -a<prop>=<value>
-
-where::
-
-    <prop> is the property to set
-    <value> is the value to set it to
-
-Not all properties can be provided this way. Only some entries support it,
-typically for filenames.
-
-
 External tools
 --------------
 
@@ -1050,8 +1059,8 @@ Then, you can run the tests under cross-compilation::
 You can also use gcc-i686-linux-gnu similar to the above.
 
 
-Advanced Features / Technical docs
-----------------------------------
+Writing new entries and debugging
+---------------------------------
 
 The behaviour of entries is defined by the Entry class. All other entries are
 a subclass of this. An important subclass is Entry_blob which takes binary
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 25/27] binman: Incorporate entry documentation
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (23 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 24/27] binman: Rearrange documentation into headings Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 26/27] binman: Drop repetitive heading for each entry Simon Glass
                   ` (27 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

Update this to avoid sphinx warnings and incorporate it into the new
documentaiton tree.

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

(no changes since v1)

 tools/binman/cmdline.py                      |  2 +-
 tools/binman/{README.entries => entries.rst} | 79 +++++++++++---------
 tools/binman/etype/cbfs.py                   | 10 +--
 tools/binman/etype/fdtmap.py                 | 30 ++++----
 tools/binman/etype/fit.py                    | 19 +++--
 tools/binman/etype/intel_ifwi.py             |  8 +-
 tools/binman/etype/mkimage.py                |  2 +-
 tools/binman/etype/section.py                |  6 +-
 tools/binman/etype/text.py                   |  6 +-
 tools/binman/setup.py                        |  2 +-
 10 files changed, 87 insertions(+), 77 deletions(-)
 rename tools/binman/{README.entries => entries.rst} (97%)

diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py
index 0c0f48951f6..95f9ba27fbd 100644
--- a/tools/binman/cmdline.py
+++ b/tools/binman/cmdline.py
@@ -69,7 +69,7 @@ controlled by a description in the board device tree.'''
         default=False, help='Update the binman node with offset/size info')
 
     entry_parser = subparsers.add_parser('entry-docs',
-        help='Write out entry documentation (see README.entries)')
+        help='Write out entry documentation (see entries.rst)')
 
     list_parser = subparsers.add_parser('ls', help='List files in an image')
     list_parser.add_argument('-i', '--image', type=str, required=True,
diff --git a/tools/binman/README.entries b/tools/binman/entries.rst
similarity index 97%
rename from tools/binman/README.entries
rename to tools/binman/entries.rst
index 0d9105e41cf..2d79850c641 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/entries.rst
@@ -106,7 +106,7 @@ is not used, it supports compression and storing ELF files.
 
 CBFS is used by coreboot as its way of orgnanising SPI-flash contents.
 
-The contents of the CBFS are defined by subnodes of the cbfs entry, e.g.:
+The contents of the CBFS are defined by subnodes of the cbfs entry, e.g.::
 
     cbfs {
         size = <0x100000>;
@@ -122,7 +122,7 @@ This creates a CBFS 1MB in size two files in it: u-boot.bin and u-boot.dtb.
 Note that the size is required since binman does not support calculating it.
 The contents of each entry is just what binman would normally provide if it
 were not a CBFS node. A blob type can be used to import arbitrary files as
-with the second subnode below:
+with the second subnode below::
 
     cbfs {
         size = <0x100000>;
@@ -168,7 +168,7 @@ cbfs-type:
         This is an ELF file that has been loaded (i.e. mapped to memory), so
         appears in the CBFS as a flat binary. The input file must be an ELF
         image, for example this puts "u-boot" (the ELF image) into a 'stage'
-        entry:
+        entry::
 
             cbfs {
                 size = <0x100000>;
@@ -178,7 +178,7 @@ cbfs-type:
                 };
             };
 
-        You can use your own ELF file with something like:
+        You can use your own ELF file with something like::
 
             cbfs {
                 size = <0x100000>;
@@ -211,7 +211,7 @@ not support other file types (e.g. payload), adding multiple files (like the
 particular offset in the CBFS and a few other things.
 
 Of course binman can create images containing multiple CBFSs, simply by
-defining these in the binman config:
+defining these in the binman config::
 
 
     binman {
@@ -279,24 +279,24 @@ sizes are included.
 Note that the -u option must be provided to ensure that binman updates the
 FDT with the position of each entry.
 
-Example output for a simple image with U-Boot and an FDT map:
+Example output for a simple image with U-Boot and an FDT map::
 
-/ {
-    image-name = "binman";
-    size = <0x00000112>;
-    image-pos = <0x00000000>;
-    offset = <0x00000000>;
-    u-boot {
-        size = <0x00000004>;
+    / {
+        image-name = "binman";
+        size = <0x00000112>;
         image-pos = <0x00000000>;
         offset = <0x00000000>;
+        u-boot {
+            size = <0x00000004>;
+            image-pos = <0x00000000>;
+            offset = <0x00000000>;
+        };
+        fdtmap {
+            size = <0x0000010e>;
+            image-pos = <0x00000004>;
+            offset = <0x00000004>;
+        };
     };
-    fdtmap {
-        size = <0x0000010e>;
-        image-pos = <0x00000004>;
-        offset = <0x00000004>;
-    };
-};
 
 If allow-repack is used then 'orig-offset' and 'orig-size' properties are
 added as necessary. See the binman README.
@@ -344,7 +344,7 @@ input provided.
 Nodes for the FIT should be written out in the binman configuration just as
 they would be in a file passed to mkimage.
 
-For example, this creates an image containing a FIT with U-Boot SPL:
+For example, this creates an image containing a FIT with U-Boot SPL::
 
     binman {
         fit {
@@ -374,7 +374,7 @@ 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.
 If the property is missing you will get an error.
 
-Then add a 'generator node', a node with a name starting with '@':
+Then add a 'generator node', a node with a name starting with '@'::
 
     images {
         @fdt-SEQ {
@@ -389,7 +389,7 @@ 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:
+You can create config nodes in a similar way::
 
     configurations {
         default = "@config-DEFAULT-SEQ";
@@ -406,8 +406,10 @@ 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')
+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 devicetree files are provided (with '-a of-list' as above)
 then no nodes will be generated.
@@ -416,10 +418,11 @@ The 'default' property, if present, will be automatically set to the name
 if of configuration whose devicetree matches the 'default-dt' entry
 argument, e.g. with '-a default-dt=sun50i-a64-pine64-lts'.
 
-Available substitutions for '@' property values are:
+Available substitutions for '@' property values are
 
-    DEFAULT-SEQ  Sequence number of the default fdt,as provided by the
-                 'default-dt' entry argument
+DEFAULT-SEQ:
+    Sequence number of the default fdt,as provided by the 'default-dt' entry
+    argument
 
 Properties (in the 'fit' node itself):
     fit,external-offset: Indicates that the contents of the FIT are external
@@ -633,10 +636,10 @@ Each subnode describes an entry which is placed into the IFWFI with a given
 sub-partition (and optional entry name).
 
 Properties for subnodes:
-    ifwi-subpart - sub-parition to put this entry into, e.g. "IBBP"
-    ifwi-entry - entry name t use, e.g. "IBBL"
-    ifwi-replace - if present, indicates that the item should be replaced
-        in the IFWI. Otherwise it is added.
+    - ifwi-subpart: sub-parition to put this entry into, e.g. "IBBP"
+    - ifwi-entry: entry name t use, e.g. "IBBL"
+    - ifwi-replace: if present, indicates that the item should be replaced
+      in the IFWI. Otherwise it is added.
 
 See README.x86 for information about x86 binary blobs.
 
@@ -726,7 +729,7 @@ Properties / Entry arguments:
     - args: Other arguments to pass
 
 The data passed to mkimage is collected from subnodes of the mkimage node,
-e.g.:
+e.g.::
 
     mkimage {
         args = "-n test -T imximage";
@@ -766,11 +769,13 @@ This entry holds firmware for an external platform-specific coprocessor.
 Entry: section: Entry that contains other entries
 -------------------------------------------------
 
-Properties / Entry arguments: (see binman README for more information)
+Properties / Entry arguments: (see binman README for more information):
     pad-byte: Pad byte to use when padding
     sort-by-offset: True if entries should be sorted by offset, False if
-        they must be in-order in the device tree description
+    they must be in-order in the device tree description
+
     end-at-4gb: Used to build an x86 ROM which ends at 4GB (2^32)
+
     skip-at-start: Number of bytes before the first entry starts. These
         effectively adjust the starting offset of entries. For example,
         if this is 16, then the first entry would start at 16. An entry
@@ -808,7 +813,7 @@ Properties / Entry arguments:
     <text>: The text to place in the entry (overrides the above mechanism).
         This is useful when the text is constant.
 
-Example node:
+Example node::
 
     text {
         size = <50>;
@@ -821,7 +826,7 @@ You can then use:
 
 and binman will insert that string into the entry.
 
-It is also possible to put the string directly in the node:
+It is also possible to put the string directly in the node::
 
     text {
         size = <8>;
@@ -829,7 +834,7 @@ It is also possible to put the string directly in the node:
         message = "a message directly in the node"
     };
 
-or just:
+or just::
 
     text {
         size = <8>;
diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py
index 6cdbaa085f5..baf9c3e45b7 100644
--- a/tools/binman/etype/cbfs.py
+++ b/tools/binman/etype/cbfs.py
@@ -22,7 +22,7 @@ class Entry_cbfs(Entry):
 
     CBFS is used by coreboot as its way of orgnanising SPI-flash contents.
 
-    The contents of the CBFS are defined by subnodes of the cbfs entry, e.g.:
+    The contents of the CBFS are defined by subnodes of the cbfs entry, e.g.::
 
         cbfs {
             size = <0x100000>;
@@ -38,7 +38,7 @@ class Entry_cbfs(Entry):
     Note that the size is required since binman does not support calculating it.
     The contents of each entry is just what binman would normally provide if it
     were not a CBFS node. A blob type can be used to import arbitrary files as
-    with the second subnode below:
+    with the second subnode below::
 
         cbfs {
             size = <0x100000>;
@@ -84,7 +84,7 @@ class Entry_cbfs(Entry):
             This is an ELF file that has been loaded (i.e. mapped to memory), so
             appears in the CBFS as a flat binary. The input file must be an ELF
             image, for example this puts "u-boot" (the ELF image) into a 'stage'
-            entry:
+            entry::
 
                 cbfs {
                     size = <0x100000>;
@@ -94,7 +94,7 @@ class Entry_cbfs(Entry):
                     };
                 };
 
-            You can use your own ELF file with something like:
+            You can use your own ELF file with something like::
 
                 cbfs {
                     size = <0x100000>;
@@ -127,7 +127,7 @@ class Entry_cbfs(Entry):
     particular offset in the CBFS and a few other things.
 
     Of course binman can create images containing multiple CBFSs, simply by
-    defining these in the binman config:
+    defining these in the binman config::
 
 
         binman {
diff --git a/tools/binman/etype/fdtmap.py b/tools/binman/etype/fdtmap.py
index 6ca88a100e5..2339feeba8d 100644
--- a/tools/binman/etype/fdtmap.py
+++ b/tools/binman/etype/fdtmap.py
@@ -53,24 +53,24 @@ class Entry_fdtmap(Entry):
     Note that the -u option must be provided to ensure that binman updates the
     FDT with the position of each entry.
 
-    Example output for a simple image with U-Boot and an FDT map:
-
-    / {
-        image-name = "binman";
-        size = <0x00000112>;
-        image-pos = <0x00000000>;
-        offset = <0x00000000>;
-        u-boot {
-            size = <0x00000004>;
+    Example output for a simple image with U-Boot and an FDT map::
+
+        / {
+            image-name = "binman";
+            size = <0x00000112>;
             image-pos = <0x00000000>;
             offset = <0x00000000>;
+            u-boot {
+                size = <0x00000004>;
+                image-pos = <0x00000000>;
+                offset = <0x00000000>;
+            };
+            fdtmap {
+                size = <0x0000010e>;
+                image-pos = <0x00000004>;
+                offset = <0x00000004>;
+            };
         };
-        fdtmap {
-            size = <0x0000010e>;
-            image-pos = <0x00000004>;
-            offset = <0x00000004>;
-        };
-    };
 
     If allow-repack is used then 'orig-offset' and 'orig-size' properties are
     added as necessary. See the binman README.
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index 1a7cbd7cec7..c4fa711b850 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -22,7 +22,7 @@ class Entry_fit(Entry):
     Nodes for the FIT should be written out in the binman configuration just as
     they would be in a file passed to mkimage.
 
-    For example, this creates an image containing a FIT with U-Boot SPL:
+    For example, this creates an image containing a FIT with U-Boot SPL::
 
         binman {
             fit {
@@ -52,7 +52,7 @@ class Entry_fit(Entry):
     The fit,fdt-list property (see above) indicates that of-list should be used.
     If the property is missing you will get an error.
 
-    Then add a 'generator node', a node with a name starting with '@':
+    Then add a 'generator node', a node with a name starting with '@'::
 
         images {
             @fdt-SEQ {
@@ -67,7 +67,7 @@ class Entry_fit(Entry):
     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:
+    You can create config nodes in a similar way::
 
         configurations {
             default = "@config-DEFAULT-SEQ";
@@ -84,8 +84,10 @@ class Entry_fit(Entry):
 
     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')
+    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 devicetree files are provided (with '-a of-list' as above)
     then no nodes will be generated.
@@ -94,10 +96,11 @@ class Entry_fit(Entry):
     if of configuration whose devicetree matches the 'default-dt' entry
     argument, e.g. with '-a default-dt=sun50i-a64-pine64-lts'.
 
-    Available substitutions for '@' property values are:
+    Available substitutions for '@' property values are
 
-        DEFAULT-SEQ  Sequence number of the default fdt,as provided by the
-                     'default-dt' entry argument
+    DEFAULT-SEQ:
+        Sequence number of the default fdt,as provided by the 'default-dt' entry
+        argument
 
     Properties (in the 'fit' node itself):
         fit,external-offset: Indicates that the contents of the FIT are external
diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py
index 1a0e481c198..c2ede641aa5 100644
--- a/tools/binman/etype/intel_ifwi.py
+++ b/tools/binman/etype/intel_ifwi.py
@@ -37,10 +37,10 @@ class Entry_intel_ifwi(Entry_blob_ext):
     sub-partition (and optional entry name).
 
     Properties for subnodes:
-        ifwi-subpart - sub-parition to put this entry into, e.g. "IBBP"
-        ifwi-entry - entry name t use, e.g. "IBBL"
-        ifwi-replace - if present, indicates that the item should be replaced
-            in the IFWI. Otherwise it is added.
+        - ifwi-subpart: sub-parition to put this entry into, e.g. "IBBP"
+        - ifwi-entry: entry name t use, e.g. "IBBL"
+        - ifwi-replace: if present, indicates that the item should be replaced
+          in the IFWI. Otherwise it is added.
 
     See README.x86 for information about x86 binary blobs.
     """
diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index 8fddc881187..f8c491d5d0a 100644
--- a/tools/binman/etype/mkimage.py
+++ b/tools/binman/etype/mkimage.py
@@ -19,7 +19,7 @@ class Entry_mkimage(Entry):
         - args: Other arguments to pass
 
     The data passed to mkimage is collected from subnodes of the mkimage node,
-    e.g.:
+    e.g.::
 
         mkimage {
             args = "-n test -T imximage";
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 2f862bddf0f..cce1500b4e5 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -22,11 +22,13 @@ from patman.tools import ToHexSize
 class Entry_section(Entry):
     """Entry that contains other entries
 
-    Properties / Entry arguments: (see binman README for more information)
+    Properties / Entry arguments: (see binman README for more information):
         pad-byte: Pad byte to use when padding
         sort-by-offset: True if entries should be sorted by offset, False if
-            they must be in-order in the device tree description
+        they must be in-order in the device tree description
+
         end-at-4gb: Used to build an x86 ROM which ends at 4GB (2^32)
+
         skip-at-start: Number of bytes before the first entry starts. These
             effectively adjust the starting offset of entries. For example,
             if this is 16, then the first entry would start at 16. An entry
diff --git a/tools/binman/etype/text.py b/tools/binman/etype/text.py
index a69c2a4ec48..45dfcc401e4 100644
--- a/tools/binman/etype/text.py
+++ b/tools/binman/etype/text.py
@@ -25,7 +25,7 @@ class Entry_text(Entry):
         <text>: The text to place in the entry (overrides the above mechanism).
             This is useful when the text is constant.
 
-    Example node:
+    Example node::
 
         text {
             size = <50>;
@@ -38,7 +38,7 @@ class Entry_text(Entry):
 
     and binman will insert that string into the entry.
 
-    It is also possible to put the string directly in the node:
+    It is also possible to put the string directly in the node::
 
         text {
             size = <8>;
@@ -46,7 +46,7 @@ class Entry_text(Entry):
             message = "a message directly in the node"
         };
 
-    or just:
+    or just::
 
         text {
             size = <8>;
diff --git a/tools/binman/setup.py b/tools/binman/setup.py
index 2dad43d4937..5ed94abdaf9 100644
--- a/tools/binman/setup.py
+++ b/tools/binman/setup.py
@@ -7,6 +7,6 @@ setup(name='binman',
       scripts=['binman'],
       packages=['binman', 'binman.etype'],
       package_dir={'binman': ''},
-      package_data={'binman': ['README.rst', 'README.entries']},
+      package_data={'binman': ['README.rst', 'entries.rst']},
       classifiers=['Environment :: Console',
                    'Topic :: Software Development :: Embedded Systems'])
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 26/27] binman: Drop repetitive heading for each entry
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (24 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 25/27] binman: Incorporate entry documentation Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-18  7:25 ` [PATCH v3 27/27] binman: Update various pieces of the documentation Simon Glass
                   ` (26 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

Many entries start 'Entry containing a'. This looks fine in the source
code but is annoying when viewed in the htmldocs table of contents. Drop
these unnecessary words.

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

Changes in v3:
- Update entry docs

 tools/binman/entries.rst            | 76 ++++++++++++++---------------
 tools/binman/etype/atf_bl31.py      |  2 +-
 tools/binman/etype/blob.py          |  2 +-
 tools/binman/etype/blob_ext.py      |  2 +-
 tools/binman/etype/cbfs.py          |  2 +-
 tools/binman/etype/files.py         |  2 +-
 tools/binman/etype/fit.py           |  2 +-
 tools/binman/etype/intel_cmc.py     |  2 +-
 tools/binman/etype/intel_fsp.py     |  2 +-
 tools/binman/etype/intel_fsp_m.py   |  2 +-
 tools/binman/etype/intel_fsp_s.py   |  2 +-
 tools/binman/etype/intel_fsp_t.py   |  2 +-
 tools/binman/etype/intel_ifwi.py    |  2 +-
 tools/binman/etype/intel_me.py      |  2 +-
 tools/binman/etype/intel_mrc.py     |  2 +-
 tools/binman/etype/intel_refcode.py |  2 +-
 tools/binman/etype/intel_vbt.py     |  2 +-
 tools/binman/etype/intel_vga.py     |  2 +-
 tools/binman/etype/mkimage.py       |  2 +-
 tools/binman/etype/scp.py           |  2 +-
 20 files changed, 57 insertions(+), 57 deletions(-)

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index 2d79850c641..f6faa15562f 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -11,8 +11,8 @@ features to produce new behaviours.
 
 
 
-Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF) BL31 blob
--------------------------------------------------------------------------
+Entry: atf-bl31: ARM Trusted Firmware (ATF) BL31 blob
+-----------------------------------------------------
 
 Properties / Entry arguments:
     - atf-bl31-path: Filename of file to read into entry. This is typically
@@ -25,8 +25,8 @@ about ATF.
 
 
 
-Entry: blob: Entry containing an arbitrary binary blob
-------------------------------------------------------
+Entry: blob: Arbitrary binary blob
+----------------------------------
 
 Note: This should not be used by itself. It is normally used as a parent
 class by other entry types.
@@ -56,8 +56,8 @@ obtained from the list of available device-tree files, managed by the
 
 
 
-Entry: blob-ext: Entry containing an externally built binary blob
------------------------------------------------------------------
+Entry: blob-ext: Externally built binary blob
+---------------------------------------------
 
 Note: This should not be used by itself. It is normally used as a parent
 class by other entry types.
@@ -96,8 +96,8 @@ entry; similarly for SPL.
 
 
 
-Entry: cbfs: Entry containing a Coreboot Filesystem (CBFS)
-----------------------------------------------------------
+Entry: cbfs: Coreboot Filesystem (CBFS)
+---------------------------------------
 
 A CBFS provides a way to group files into a group. It has a simple directory
 structure and allows the position of individual files to be set, since it is
@@ -303,8 +303,8 @@ added as necessary. See the binman README.
 
 
 
-Entry: files: Entry containing a set of files
----------------------------------------------
+Entry: files: A set of files arranged in a section
+--------------------------------------------------
 
 Properties / Entry arguments:
     - pattern: Filename pattern to match the files to include
@@ -335,8 +335,8 @@ byte value of a region.
 
 
 
-Entry: fit: Entry containing a FIT
-----------------------------------
+Entry: fit: Flat Image Tree (FIT)
+---------------------------------
 
 This calls mkimage to create a FIT (U-Boot Flat Image Tree) based on the
 input provided.
@@ -491,8 +491,8 @@ first/last in the entry list.
 
 
 
-Entry: intel-cmc: Entry containing an Intel Chipset Micro Code (CMC) file
--------------------------------------------------------------------------
+Entry: intel-cmc: Intel Chipset Micro Code (CMC) file
+-----------------------------------------------------
 
 Properties / Entry arguments:
     - filename: Filename of file to read into entry
@@ -544,8 +544,8 @@ This entry contains a pointer to the FIT. It is required to be at address
 
 
 
-Entry: intel-fsp: Entry containing an Intel Firmware Support Package (FSP) file
--------------------------------------------------------------------------------
+Entry: intel-fsp: Intel Firmware Support Package (FSP) file
+-----------------------------------------------------------
 
 Properties / Entry arguments:
     - filename: Filename of file to read into entry
@@ -561,8 +561,8 @@ See README.x86 for information about x86 binary blobs.
 
 
 
-Entry: intel-fsp-m: Entry containing Intel Firmware Support Package (FSP) memory init
--------------------------------------------------------------------------------------
+Entry: intel-fsp-m: Intel Firmware Support Package (FSP) memory init
+--------------------------------------------------------------------
 
 Properties / Entry arguments:
     - filename: Filename of file to read into entry
@@ -578,8 +578,8 @@ See README.x86 for information about x86 binary blobs.
 
 
 
-Entry: intel-fsp-s: Entry containing Intel Firmware Support Package (FSP) silicon init
---------------------------------------------------------------------------------------
+Entry: intel-fsp-s: Intel Firmware Support Package (FSP) silicon init
+---------------------------------------------------------------------
 
 Properties / Entry arguments:
     - filename: Filename of file to read into entry
@@ -595,8 +595,8 @@ See README.x86 for information about x86 binary blobs.
 
 
 
-Entry: intel-fsp-t: Entry containing Intel Firmware Support Package (FSP) temp ram init
----------------------------------------------------------------------------------------
+Entry: intel-fsp-t: Intel Firmware Support Package (FSP) temp ram init
+----------------------------------------------------------------------
 
 Properties / Entry arguments:
     - filename: Filename of file to read into entry
@@ -611,8 +611,8 @@ See README.x86 for information about x86 binary blobs.
 
 
 
-Entry: intel-ifwi: Entry containing an Intel Integrated Firmware Image (IFWI) file
-----------------------------------------------------------------------------------
+Entry: intel-ifwi: Intel Integrated Firmware Image (IFWI) file
+--------------------------------------------------------------
 
 Properties / Entry arguments:
     - filename: Filename of file to read into entry. This is either the
@@ -645,8 +645,8 @@ See README.x86 for information about x86 binary blobs.
 
 
 
-Entry: intel-me: Entry containing an Intel Management Engine (ME) file
-----------------------------------------------------------------------
+Entry: intel-me: Intel Management Engine (ME) file
+--------------------------------------------------
 
 Properties / Entry arguments:
     - filename: Filename of file to read into entry
@@ -665,8 +665,8 @@ See README.x86 for information about x86 binary blobs.
 
 
 
-Entry: intel-mrc: Entry containing an Intel Memory Reference Code (MRC) file
-----------------------------------------------------------------------------
+Entry: intel-mrc: Intel Memory Reference Code (MRC) file
+--------------------------------------------------------
 
 Properties / Entry arguments:
     - filename: Filename of file to read into entry
@@ -679,8 +679,8 @@ See README.x86 for information about x86 binary blobs.
 
 
 
-Entry: intel-refcode: Entry containing an Intel Reference Code file
--------------------------------------------------------------------
+Entry: intel-refcode: Intel Reference Code file
+-----------------------------------------------
 
 Properties / Entry arguments:
     - filename: Filename of file to read into entry
@@ -693,8 +693,8 @@ See README.x86 for information about x86 binary blobs.
 
 
 
-Entry: intel-vbt: Entry containing an Intel Video BIOS Table (VBT) file
------------------------------------------------------------------------
+Entry: intel-vbt: Intel Video BIOS Table (VBT) file
+---------------------------------------------------
 
 Properties / Entry arguments:
     - filename: Filename of file to read into entry
@@ -706,8 +706,8 @@ See README.x86 for information about Intel binary blobs.
 
 
 
-Entry: intel-vga: Entry containing an Intel Video Graphics Adaptor (VGA) file
------------------------------------------------------------------------------
+Entry: intel-vga: Intel Video Graphics Adaptor (VGA) file
+---------------------------------------------------------
 
 Properties / Entry arguments:
     - filename: Filename of file to read into entry
@@ -721,8 +721,8 @@ See README.x86 for information about Intel binary blobs.
 
 
 
-Entry: mkimage: Entry containing a binary produced by mkimage
--------------------------------------------------------------
+Entry: mkimage: Binary produced by mkimage
+------------------------------------------
 
 Properties / Entry arguments:
     - datafile: Filename for -d argument
@@ -756,8 +756,8 @@ placed at offset 'RESET_VECTOR_ADDRESS - 0xffc'.
 
 
 
-Entry: scp: Entry containing a System Control Processor (SCP) firmware blob
----------------------------------------------------------------------------
+Entry: scp: System Control Processor (SCP) firmware blob
+--------------------------------------------------------
 
 Properties / Entry arguments:
     - scp-path: Filename of file to read into the entry, typically scp.bin
diff --git a/tools/binman/etype/atf_bl31.py b/tools/binman/etype/atf_bl31.py
index 195adc714b5..163d7141840 100644
--- a/tools/binman/etype/atf_bl31.py
+++ b/tools/binman/etype/atf_bl31.py
@@ -8,7 +8,7 @@
 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
+    """ARM Trusted Firmware (ATF) BL31 blob
 
     Properties / Entry arguments:
         - atf-bl31-path: Filename of file to read into entry. This is typically
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index e609a8b253f..018f8c9a319 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -11,7 +11,7 @@ from patman import tools
 from patman import tout
 
 class Entry_blob(Entry):
-    """Entry containing an arbitrary binary blob
+    """Arbitrary binary blob
 
     Note: This should not be used by itself. It is normally used as a parent
     class by other entry types.
diff --git a/tools/binman/etype/blob_ext.py b/tools/binman/etype/blob_ext.py
index e372445f300..d6b0ca17c3f 100644
--- a/tools/binman/etype/blob_ext.py
+++ b/tools/binman/etype/blob_ext.py
@@ -13,7 +13,7 @@ from patman import tools
 from patman import tout
 
 class Entry_blob_ext(Entry_blob):
-    """Entry containing an externally built binary blob
+    """Externally built binary blob
 
     Note: This should not be used by itself. It is normally used as a parent
     class by other entry types.
diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py
index baf9c3e45b7..1daddeb8229 100644
--- a/tools/binman/etype/cbfs.py
+++ b/tools/binman/etype/cbfs.py
@@ -13,7 +13,7 @@ from binman.entry import Entry
 from dtoc import fdt_util
 
 class Entry_cbfs(Entry):
-    """Entry containing a Coreboot Filesystem (CBFS)
+    """Coreboot Filesystem (CBFS)
 
     A CBFS provides a way to group files into a group. It has a simple directory
     structure and allows the position of individual files to be set, since it is
diff --git a/tools/binman/etype/files.py b/tools/binman/etype/files.py
index 1feebd0510e..5db36abef0b 100644
--- a/tools/binman/etype/files.py
+++ b/tools/binman/etype/files.py
@@ -15,7 +15,7 @@ from patman import tools
 
 
 class Entry_files(Entry_section):
-    """Entry containing a set of files
+    """A set of files arranged in a section
 
     Properties / Entry arguments:
         - pattern: Filename pattern to match the files to include
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index c4fa711b850..6936f5736a6 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -14,7 +14,7 @@ from dtoc.fdt import Fdt
 from patman import tools
 
 class Entry_fit(Entry):
-    """Entry containing a FIT
+    """Flat Image Tree (FIT)
 
     This calls mkimage to create a FIT (U-Boot Flat Image Tree) based on the
     input provided.
diff --git a/tools/binman/etype/intel_cmc.py b/tools/binman/etype/intel_cmc.py
index 644fa421d3f..494d43c9cf9 100644
--- a/tools/binman/etype/intel_cmc.py
+++ b/tools/binman/etype/intel_cmc.py
@@ -8,7 +8,7 @@
 from binman.etype.blob_ext import Entry_blob_ext
 
 class Entry_intel_cmc(Entry_blob_ext):
-    """Entry containing an Intel Chipset Micro Code (CMC) file
+    """Intel Chipset Micro Code (CMC) file
 
     Properties / Entry arguments:
         - filename: Filename of file to read into entry
diff --git a/tools/binman/etype/intel_fsp.py b/tools/binman/etype/intel_fsp.py
index 2ac012bce19..326cb7d09b3 100644
--- a/tools/binman/etype/intel_fsp.py
+++ b/tools/binman/etype/intel_fsp.py
@@ -8,7 +8,7 @@
 from binman.etype.blob_ext import Entry_blob_ext
 
 class Entry_intel_fsp(Entry_blob_ext):
-    """Entry containing an Intel Firmware Support Package (FSP) file
+    """Intel Firmware Support Package (FSP) file
 
     Properties / Entry arguments:
         - filename: Filename of file to read into entry
diff --git a/tools/binman/etype/intel_fsp_m.py b/tools/binman/etype/intel_fsp_m.py
index 434b0f1856e..9bcac790ed9 100644
--- a/tools/binman/etype/intel_fsp_m.py
+++ b/tools/binman/etype/intel_fsp_m.py
@@ -8,7 +8,7 @@
 from binman.etype.blob_ext import Entry_blob_ext
 
 class Entry_intel_fsp_m(Entry_blob_ext):
-    """Entry containing Intel Firmware Support Package (FSP) memory init
+    """Intel Firmware Support Package (FSP) memory init
 
     Properties / Entry arguments:
         - filename: Filename of file to read into entry
diff --git a/tools/binman/etype/intel_fsp_s.py b/tools/binman/etype/intel_fsp_s.py
index 564e1228bba..1d5046d452b 100644
--- a/tools/binman/etype/intel_fsp_s.py
+++ b/tools/binman/etype/intel_fsp_s.py
@@ -8,7 +8,7 @@
 from binman.etype.blob_ext import Entry_blob_ext
 
 class Entry_intel_fsp_s(Entry_blob_ext):
-    """Entry containing Intel Firmware Support Package (FSP) silicon init
+    """Intel Firmware Support Package (FSP) silicon init
 
     Properties / Entry arguments:
         - filename: Filename of file to read into entry
diff --git a/tools/binman/etype/intel_fsp_t.py b/tools/binman/etype/intel_fsp_t.py
index df0c5fbee0f..80d95cc6f9c 100644
--- a/tools/binman/etype/intel_fsp_t.py
+++ b/tools/binman/etype/intel_fsp_t.py
@@ -8,7 +8,7 @@
 from binman.etype.blob_ext import Entry_blob_ext
 
 class Entry_intel_fsp_t(Entry_blob_ext):
-    """Entry containing Intel Firmware Support Package (FSP) temp ram init
+    """Intel Firmware Support Package (FSP) temp ram init
 
     Properties / Entry arguments:
         - filename: Filename of file to read into entry
diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py
index c2ede641aa5..903d39bdbeb 100644
--- a/tools/binman/etype/intel_ifwi.py
+++ b/tools/binman/etype/intel_ifwi.py
@@ -13,7 +13,7 @@ from dtoc import fdt_util
 from patman import tools
 
 class Entry_intel_ifwi(Entry_blob_ext):
-    """Entry containing an Intel Integrated Firmware Image (IFWI) file
+    """Intel Integrated Firmware Image (IFWI) file
 
     Properties / Entry arguments:
         - filename: Filename of file to read into entry. This is either the
diff --git a/tools/binman/etype/intel_me.py b/tools/binman/etype/intel_me.py
index a6fe5427f31..b93ebabdc9e 100644
--- a/tools/binman/etype/intel_me.py
+++ b/tools/binman/etype/intel_me.py
@@ -8,7 +8,7 @@
 from binman.etype.blob_ext import Entry_blob_ext
 
 class Entry_intel_me(Entry_blob_ext):
-    """Entry containing an Intel Management Engine (ME) file
+    """Intel Management Engine (ME) file
 
     Properties / Entry arguments:
         - filename: Filename of file to read into entry
diff --git a/tools/binman/etype/intel_mrc.py b/tools/binman/etype/intel_mrc.py
index ccbb046519d..bb8b26ff686 100644
--- a/tools/binman/etype/intel_mrc.py
+++ b/tools/binman/etype/intel_mrc.py
@@ -8,7 +8,7 @@
 from binman.etype.blob_ext import Entry_blob_ext
 
 class Entry_intel_mrc(Entry_blob_ext):
-    """Entry containing an Intel Memory Reference Code (MRC) file
+    """Intel Memory Reference Code (MRC) file
 
     Properties / Entry arguments:
         - filename: Filename of file to read into entry
diff --git a/tools/binman/etype/intel_refcode.py b/tools/binman/etype/intel_refcode.py
index 5ead08b2be4..9112730a9a4 100644
--- a/tools/binman/etype/intel_refcode.py
+++ b/tools/binman/etype/intel_refcode.py
@@ -8,7 +8,7 @@
 from binman.etype.blob_ext import Entry_blob_ext
 
 class Entry_intel_refcode(Entry_blob_ext):
-    """Entry containing an Intel Reference Code file
+    """Intel Reference Code file
 
     Properties / Entry arguments:
         - filename: Filename of file to read into entry
diff --git a/tools/binman/etype/intel_vbt.py b/tools/binman/etype/intel_vbt.py
index 2a98c123688..8afd576600c 100644
--- a/tools/binman/etype/intel_vbt.py
+++ b/tools/binman/etype/intel_vbt.py
@@ -7,7 +7,7 @@
 from binman.etype.blob_ext import Entry_blob_ext
 
 class Entry_intel_vbt(Entry_blob_ext):
-    """Entry containing an Intel Video BIOS Table (VBT) file
+    """Intel Video BIOS Table (VBT) file
 
     Properties / Entry arguments:
         - filename: Filename of file to read into entry
diff --git a/tools/binman/etype/intel_vga.py b/tools/binman/etype/intel_vga.py
index a103f1ce0ee..51e6465f0d0 100644
--- a/tools/binman/etype/intel_vga.py
+++ b/tools/binman/etype/intel_vga.py
@@ -8,7 +8,7 @@
 from binman.etype.blob_ext import Entry_blob_ext
 
 class Entry_intel_vga(Entry_blob_ext):
-    """Entry containing an Intel Video Graphics Adaptor (VGA) file
+    """Intel Video Graphics Adaptor (VGA) file
 
     Properties / Entry arguments:
         - filename: Filename of file to read into entry
diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index f8c491d5d0a..e9f82729ab4 100644
--- a/tools/binman/etype/mkimage.py
+++ b/tools/binman/etype/mkimage.py
@@ -12,7 +12,7 @@ from dtoc import fdt_util
 from patman import tools
 
 class Entry_mkimage(Entry):
-    """Entry containing a binary produced by mkimage
+    """Binary produced by mkimage
 
     Properties / Entry arguments:
         - datafile: Filename for -d argument
diff --git a/tools/binman/etype/scp.py b/tools/binman/etype/scp.py
index 93f8787d2d7..a9bee3ce8bc 100644
--- a/tools/binman/etype/scp.py
+++ b/tools/binman/etype/scp.py
@@ -7,7 +7,7 @@
 from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
 
 class Entry_scp(Entry_blob_named_by_arg):
-    """Entry containing a System Control Processor (SCP) firmware blob
+    """System Control Processor (SCP) firmware blob
 
     Properties / Entry arguments:
         - scp-path: Filename of file to read into the entry, typically scp.bin
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 27/27] binman: Update various pieces of the documentation
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (25 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 26/27] binman: Drop repetitive heading for each entry Simon Glass
@ 2021-03-18  7:25 ` Simon Glass
  2021-03-19 23:52 ` Simon Glass
                   ` (25 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-18  7:25 UTC (permalink / raw)
  To: u-boot

A few sections are a little out of date now. Update them.

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

Changes in v3:
- Make a symlink to the entry docs

 doc/develop/package/entries.rst |  1 +
 tools/binman/binman.rst         | 83 +++++++++++++++++----------------
 2 files changed, 45 insertions(+), 39 deletions(-)
 create mode 120000 doc/develop/package/entries.rst

diff --git a/doc/develop/package/entries.rst b/doc/develop/package/entries.rst
new file mode 120000
index 00000000000..ecedcebaad4
--- /dev/null
+++ b/doc/develop/package/entries.rst
@@ -0,0 +1 @@
+../../../tools/binman/entries.rst
\ No newline at end of file
diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index 1cdc9de752a..15314d19586 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -9,39 +9,43 @@ For example, we may have SPL, U-Boot, a device tree and an environment area
 grouped together and placed in MMC flash. When the system starts, it must be
 able to find these pieces.
 
-So far U-Boot has not provided a way to handle creating such images in a
-general way. Each SoC does what it needs to build an image, often packing or
-concatenating images in the U-Boot build system.
-
-Binman aims to provide a mechanism for building images, from simple
-SPL + U-Boot combinations, to more complex arrangements with many parts.
+Building firmware should be separate from packaging it. Many of the complexities
+of modern firmware build systems come from trying to do both at once. With
+binman, you build all the pieces that are needed, using whatever assortment of
+projects and build systems are needed, then use binman to stitch everything
+together.
 
 
 What it does
 ------------
 
 Binman reads your board's device tree and finds a node which describes the
-required image layout. It uses this to work out what to place where. The
-output file normally contains the device tree, so it is in principle possible
-to read an image and extract its constituent parts.
+required image layout. It uses this to work out what to place where.
+
+Binman provides a mechanism for building images, from simple SPL + U-Boot
+combinations, to more complex arrangements with many parts. It also allows
+users to inspect images, extract and replace binaries within them, repacking if
+needed.
 
 
 Features
 --------
 
-So far binman is pretty simple. It supports binary blobs, such as 'u-boot',
-'spl' and 'fdt'. It supports empty entries (such as setting to 0xff). It can
-place entries at a fixed location in the image, or fit them together with
-suitable padding and alignment. It provides a way to process binaries before
-they are included, by adding a Python plug-in. The device tree is available
-to U-Boot at run-time so that the images can be interpreted.
+Apart from basic padding, alignment and positioning features, Binman supports
+hierarchical images, compression, hashing and dealing with the binary blobs
+which are a sad trend in open-source firmware at present.
 
-Binman can update the device tree with the final location of everything when it
-is done. Entry positions can be provided to U-Boot SPL as run-time symbols,
-avoiding device-tree code overhead.
+Executable binaries can access the location of other binaries in an image by
+using special linker symbols (zero-overhead but somewhat limited) or by reading
+the devicetree description of the image.
 
-Binman can also support incorporating filesystems in the image if required.
-For example x86 platforms may use CBFS in some cases.
+Binman is designed primarily for use with U-Boot and associated binaries such
+as ARM Trusted Firmware, but it is suitable for use with other projects, such
+as Zephyr. Binman also provides facilities useful in Chromium OS, such as CBFS,
+vblocks and and the like.
+
+Binman provides a way to process binaries before they are included, by adding a
+Python plug-in.
 
 Binman is intended for use with U-Boot but is designed to be general enough
 to be useful in other image-packaging situations.
@@ -50,11 +54,11 @@ to be useful in other image-packaging situations.
 Motivation
 ----------
 
-Packaging of firmware is quite a different task from building the various
-parts. In many cases the various binaries which go into the image come from
-separate build systems. For example, ARM Trusted Firmware is used on ARMv8
-devices but is not built in the U-Boot tree. If a Linux kernel is included
-in the firmware image, it is built elsewhere.
+As mentioned above, packaging of firmware is quite a different task from
+building the various parts. In many cases the various binaries which go into
+the image come from separate build systems. For example, ARM Trusted Firmware
+is used on ARMv8 devices but is not built in the U-Boot tree. If a Linux kernel
+is included in the firmware image, it is built elsewhere.
 
 It is of course possible to add more and more build rules to the U-Boot
 build system to cover these cases. It can shell out to other Makefiles and
@@ -215,17 +219,12 @@ Binman has a few other options which you can see by running 'binman -h'.
 Enabling binman for a board
 ---------------------------
 
-At present binman is invoked from a rule in the main Makefile. Typically you
-will have a rule like::
-
-    ifneq ($(CONFIG_ARCH_<something>),)
-    u-boot-<your_suffix>.bin: <input_file_1> <input_file_2> checkbinman FORCE
-        $(call if_changed,binman)
-    endif
+At present binman is invoked from a rule in the main Makefile. You should be
+able to enable CONFIG_BINMAN to enable this rule.
 
-This assumes that u-boot-<your_suffix>.bin is a target, and is the final file
-that you need to produce. You can make it a target by adding it to INPUTS-y
-either in the main Makefile or in a config.mk file in your arch subdirectory.
+The output file is typically named image.bin and is located in the output
+directory. If input files are needed to you add these to INPUTS-y either in the
+main Makefile or in a config.mk file in your arch subdirectory.
 
 Once binman is executed it will pick up its instructions from a device-tree
 file, typically <soc>-u-boot.dtsi, where <soc> is your CONFIG_SYS_SOC value.
@@ -786,12 +785,17 @@ the 'warning' line in scripts/Makefile.lib to see what it has found::
 
 
 Entry Documentation
--------------------
+===================
 
 For details on the various entry types supported by binman and how to use them,
-see README.entries. This is generated from the source code using:
+see entries.rst which is generated from the source code using:
+
+    binman entry-docs >tools/binman/entries.rst
+
+.. toctree::
+   :maxdepth: 2
 
-    binman entry-docs >tools/binman/README.entries
+   entries
 
 
 Managing images
@@ -1136,7 +1140,8 @@ To do
 Some ideas:
 
 - Use of-platdata to make the information available to code that is unable
-  to use device tree (such as a very small SPL image)
+  to use device tree (such as a very small SPL image). For now, limited info is
+  available via linker symbols
 - Allow easy building of images by specifying just the board name
 - Support building an image for a board (-b) more completely, with a
   configurable build directory
-- 
2.31.0.rc2.261.g7f71774620-goog

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

* [PATCH v3 21/27] doc: Move UEFI under develop/
  2021-03-18  7:25 ` [PATCH v3 21/27] doc: Move UEFI under develop/ Simon Glass
@ 2021-03-18  9:23   ` Heinrich Schuchardt
  2021-03-19 23:52   ` Simon Glass
  1 sibling, 0 replies; 56+ messages in thread
From: Heinrich Schuchardt @ 2021-03-18  9:23 UTC (permalink / raw)
  To: u-boot

On 18.03.21 08:25, Simon Glass wrote:
> Much of the content here is useful only for development. Move it under
> that section.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

The patch cannot be applied independently of patch 20/27.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> ---
>
> Changes in v3:
> - Fix x86 docs which refer to this
>
> Changes in v2:
> - Move UEFI under develop/ instead
>
>  doc/arch/x86.rst                         |  4 ++--
>  doc/develop/index.rst                    |  1 +
>  doc/{ => develop}/uefi/index.rst         |  4 ++++
>  doc/{ => develop}/uefi/iscsi.rst         |  0
>  doc/{ => develop}/uefi/u-boot_on_efi.rst |  0
>  doc/{ => develop}/uefi/uefi.rst          |  0
>  doc/index.rst                            | 12 ------------
>  7 files changed, 7 insertions(+), 14 deletions(-)
>  rename doc/{ => develop}/uefi/index.rst (51%)
>  rename doc/{ => develop}/uefi/iscsi.rst (100%)
>  rename doc/{ => develop}/uefi/u-boot_on_efi.rst (100%)
>  rename doc/{ => develop}/uefi/uefi.rst (100%)
>
> diff --git a/doc/arch/x86.rst b/doc/arch/x86.rst
> index cc307aa8d5e..2ebfed871bd 100644
> --- a/doc/arch/x86.rst
> +++ b/doc/arch/x86.rst
> @@ -709,8 +709,8 @@ to load a 'u-boot-payload.efi', see below test logs on QEMU.
>    No controllers found
>    Hit any key to stop autoboot:  0
>
> -See :doc:`../uefi/u-boot_on_efi` and :doc:`../uefi/uefi` for details of
> -EFI support in U-Boot.
> +See :doc:`../develop/uefi/u-boot_on_efi` and :doc:`../develop/uefi/uefi` for
> +details of EFI support in U-Boot.
>
>  Chain-loading
>  -------------
> diff --git a/doc/develop/index.rst b/doc/develop/index.rst
> index 41c0ba1ebd9..84914bb47bf 100644
> --- a/doc/develop/index.rst
> +++ b/doc/develop/index.rst
> @@ -13,6 +13,7 @@ Implementation
>     global_data
>     logging
>     menus
> +   uefi/index
>     version
>
>  Debugging
> diff --git a/doc/uefi/index.rst b/doc/develop/uefi/index.rst
> similarity index 51%
> rename from doc/uefi/index.rst
> rename to doc/develop/uefi/index.rst
> index b790a91f174..7e65dbc5d5e 100644
> --- a/doc/uefi/index.rst
> +++ b/doc/develop/uefi/index.rst
> @@ -3,6 +3,10 @@
>  Unified Extensible Firmware (UEFI)
>  ==================================
>
> +U-Boot provides an implementation of the UEFI API allowing to run UEFI
> +compliant software like Linux, GRUB, and iPXE. Furthermore U-Boot itself
> +can be run an UEFI payload.
> +
>  .. toctree::
>     :maxdepth: 2
>
> diff --git a/doc/uefi/iscsi.rst b/doc/develop/uefi/iscsi.rst
> similarity index 100%
> rename from doc/uefi/iscsi.rst
> rename to doc/develop/uefi/iscsi.rst
> diff --git a/doc/uefi/u-boot_on_efi.rst b/doc/develop/uefi/u-boot_on_efi.rst
> similarity index 100%
> rename from doc/uefi/u-boot_on_efi.rst
> rename to doc/develop/uefi/u-boot_on_efi.rst
> diff --git a/doc/uefi/uefi.rst b/doc/develop/uefi/uefi.rst
> similarity index 100%
> rename from doc/uefi/uefi.rst
> rename to doc/develop/uefi/uefi.rst
> diff --git a/doc/index.rst b/doc/index.rst
> index 4c44955d67f..366963813ac 100644
> --- a/doc/index.rst
> +++ b/doc/index.rst
> @@ -38,18 +38,6 @@ want to contribute to U-Boot.
>
>     develop/index
>
> -Unified Extensible Firmware (UEFI)
> -----------------------------------
> -
> -U-Boot provides an implementation of the UEFI API allowing to run UEFI
> -compliant software like Linux, GRUB, and iPXE. Furthermore U-Boot itself
> -can be run an UEFI payload.
> -
> -.. toctree::
> -   :maxdepth: 2
> -
> -   uefi/index
> -
>  Driver-Model documentation
>  --------------------------
>
>

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

* [PATCH v3 27/27] binman: Update various pieces of the documentation
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (26 preceding siblings ...)
  2021-03-18  7:25 ` [PATCH v3 27/27] binman: Update various pieces of the documentation Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 26/27] binman: Drop repetitive heading for each entry Simon Glass
                   ` (24 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

A few sections are a little out of date now. Update them.

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

Changes in v3:
- Make a symlink to the entry docs

 doc/develop/package/entries.rst |  1 +
 tools/binman/binman.rst         | 83 +++++++++++++++++----------------
 2 files changed, 45 insertions(+), 39 deletions(-)
 create mode 120000 doc/develop/package/entries.rst

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 26/27] binman: Drop repetitive heading for each entry
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (27 preceding siblings ...)
  2021-03-19 23:52 ` Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 25/27] binman: Incorporate entry documentation Simon Glass
                   ` (23 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

Many entries start 'Entry containing a'. This looks fine in the source
code but is annoying when viewed in the htmldocs table of contents. Drop
these unnecessary words.

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

Changes in v3:
- Update entry docs

 tools/binman/entries.rst            | 76 ++++++++++++++---------------
 tools/binman/etype/atf_bl31.py      |  2 +-
 tools/binman/etype/blob.py          |  2 +-
 tools/binman/etype/blob_ext.py      |  2 +-
 tools/binman/etype/cbfs.py          |  2 +-
 tools/binman/etype/files.py         |  2 +-
 tools/binman/etype/fit.py           |  2 +-
 tools/binman/etype/intel_cmc.py     |  2 +-
 tools/binman/etype/intel_fsp.py     |  2 +-
 tools/binman/etype/intel_fsp_m.py   |  2 +-
 tools/binman/etype/intel_fsp_s.py   |  2 +-
 tools/binman/etype/intel_fsp_t.py   |  2 +-
 tools/binman/etype/intel_ifwi.py    |  2 +-
 tools/binman/etype/intel_me.py      |  2 +-
 tools/binman/etype/intel_mrc.py     |  2 +-
 tools/binman/etype/intel_refcode.py |  2 +-
 tools/binman/etype/intel_vbt.py     |  2 +-
 tools/binman/etype/intel_vga.py     |  2 +-
 tools/binman/etype/mkimage.py       |  2 +-
 tools/binman/etype/scp.py           |  2 +-
 20 files changed, 57 insertions(+), 57 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 25/27] binman: Incorporate entry documentation
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (28 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 26/27] binman: Drop repetitive heading for each entry Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 24/27] binman: Rearrange documentation into headings Simon Glass
                   ` (22 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

Update this to avoid sphinx warnings and incorporate it into the new
documentaiton tree.

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

(no changes since v1)

 tools/binman/cmdline.py                      |  2 +-
 tools/binman/{README.entries => entries.rst} | 79 +++++++++++---------
 tools/binman/etype/cbfs.py                   | 10 +--
 tools/binman/etype/fdtmap.py                 | 30 ++++----
 tools/binman/etype/fit.py                    | 19 +++--
 tools/binman/etype/intel_ifwi.py             |  8 +-
 tools/binman/etype/mkimage.py                |  2 +-
 tools/binman/etype/section.py                |  6 +-
 tools/binman/etype/text.py                   |  6 +-
 tools/binman/setup.py                        |  2 +-
 10 files changed, 87 insertions(+), 77 deletions(-)
 rename tools/binman/{README.entries => entries.rst} (97%)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 24/27] binman: Rearrange documentation into headings
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (29 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 25/27] binman: Incorporate entry documentation Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 23/27] binman: doc: Add documentation to htmldocs Simon Glass
                   ` (21 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

Collect the material into different top-level headings to make it easier
to read.

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

(no changes since v1)

 tools/binman/binman.rst | 523 ++++++++++++++++++++--------------------
 1 file changed, 266 insertions(+), 257 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 23/27] binman: doc: Add documentation to htmldocs
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (30 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 24/27] binman: Rearrange documentation into headings Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 22/27] doc: Move driver model docs under develop/ Simon Glass
                   ` (20 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

Add a link to binman's documentation and adjust the files so that it is
accessible. Use the name README.rst so it is easy to discover when binman
is installed without U-Boot.

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

(no changes since v2)

Changes in v2:
- Put binman docs in doc/develop and FIT in doc/usage
- Rename README.rst to binman.rst and use a symlink

 doc/develop/index.rst               |   8 +
 doc/develop/package/binman.rst      |   1 +
 doc/develop/package/index.rst       |  19 ++
 doc/usage/fit.rst                   |   8 +
 doc/usage/index.rst                 |   1 +
 tools/binman/README.rst             |   1 +
 tools/binman/{README => binman.rst} | 484 ++++++++++++++--------------
 tools/binman/control.py             |   2 +-
 tools/binman/ftest.py               |   4 +-
 tools/binman/index.rst              |   9 +
 tools/binman/setup.py               |   2 +-
 11 files changed, 294 insertions(+), 245 deletions(-)
 create mode 120000 doc/develop/package/binman.rst
 create mode 100644 doc/develop/package/index.rst
 create mode 100644 doc/usage/fit.rst
 create mode 120000 tools/binman/README.rst
 rename tools/binman/{README => binman.rst} (73%)
 create mode 100644 tools/binman/index.rst

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 22/27] doc: Move driver model docs under develop/
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (31 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 23/27] binman: doc: Add documentation to htmldocs Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 20/27] x86: dts: Drop unused CONFIG_SPL Simon Glass
                   ` (19 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

These docs are useful for developers, not users. Move them under that
section.

Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v2)

Changes in v2:
- Add new patch to move driver model docs under develop/

 doc/{ => develop}/driver-model/bind.rst               |  0
 doc/{ => develop}/driver-model/debugging.rst          |  0
 doc/{ => develop}/driver-model/design.rst             |  0
 doc/{ => develop}/driver-model/ethernet.rst           |  0
 doc/{ => develop}/driver-model/fdt-fixup.rst          |  0
 doc/{ => develop}/driver-model/fs_firmware_loader.rst |  0
 doc/{ => develop}/driver-model/i2c-howto.rst          |  0
 doc/{ => develop}/driver-model/index.rst              |  4 ++++
 doc/{ => develop}/driver-model/livetree.rst           |  0
 doc/{ => develop}/driver-model/migration.rst          |  0
 doc/{ => develop}/driver-model/of-plat.rst            |  0
 doc/{ => develop}/driver-model/pci-info.rst           |  0
 doc/{ => develop}/driver-model/pmic-framework.rst     |  0
 .../driver-model/remoteproc-framework.rst             |  0
 doc/{ => develop}/driver-model/serial-howto.rst       |  0
 doc/{ => develop}/driver-model/soc-framework.rst      |  0
 doc/{ => develop}/driver-model/spi-howto.rst          |  0
 doc/{ => develop}/driver-model/usb-info.rst           |  0
 doc/develop/index.rst                                 |  1 +
 doc/index.rst                                         | 11 -----------
 20 files changed, 5 insertions(+), 11 deletions(-)
 rename doc/{ => develop}/driver-model/bind.rst (100%)
 rename doc/{ => develop}/driver-model/debugging.rst (100%)
 rename doc/{ => develop}/driver-model/design.rst (100%)
 rename doc/{ => develop}/driver-model/ethernet.rst (100%)
 rename doc/{ => develop}/driver-model/fdt-fixup.rst (100%)
 rename doc/{ => develop}/driver-model/fs_firmware_loader.rst (100%)
 rename doc/{ => develop}/driver-model/i2c-howto.rst (100%)
 rename doc/{ => develop}/driver-model/index.rst (68%)
 rename doc/{ => develop}/driver-model/livetree.rst (100%)
 rename doc/{ => develop}/driver-model/migration.rst (100%)
 rename doc/{ => develop}/driver-model/of-plat.rst (100%)
 rename doc/{ => develop}/driver-model/pci-info.rst (100%)
 rename doc/{ => develop}/driver-model/pmic-framework.rst (100%)
 rename doc/{ => develop}/driver-model/remoteproc-framework.rst (100%)
 rename doc/{ => develop}/driver-model/serial-howto.rst (100%)
 rename doc/{ => develop}/driver-model/soc-framework.rst (100%)
 rename doc/{ => develop}/driver-model/spi-howto.rst (100%)
 rename doc/{ => develop}/driver-model/usb-info.rst (100%)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 21/27] doc: Move UEFI under develop/
  2021-03-18  7:25 ` [PATCH v3 21/27] doc: Move UEFI under develop/ Simon Glass
  2021-03-18  9:23   ` Heinrich Schuchardt
@ 2021-03-19 23:52   ` Simon Glass
  1 sibling, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

On 18.03.21 08:25, Simon Glass wrote:
> Much of the content here is useful only for development. Move it under
> that section.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

The patch cannot be applied independently of patch 20/27.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> ---
>
> Changes in v3:
> - Fix x86 docs which refer to this
>
> Changes in v2:
> - Move UEFI under develop/ instead
>
>  doc/arch/x86.rst                         |  4 ++--
>  doc/develop/index.rst                    |  1 +
>  doc/{ => develop}/uefi/index.rst         |  4 ++++
>  doc/{ => develop}/uefi/iscsi.rst         |  0
>  doc/{ => develop}/uefi/u-boot_on_efi.rst |  0
>  doc/{ => develop}/uefi/uefi.rst          |  0
>  doc/index.rst                            | 12 ------------
>  7 files changed, 7 insertions(+), 14 deletions(-)
>  rename doc/{ => develop}/uefi/index.rst (51%)
>  rename doc/{ => develop}/uefi/iscsi.rst (100%)
>  rename doc/{ => develop}/uefi/u-boot_on_efi.rst (100%)
>  rename doc/{ => develop}/uefi/uefi.rst (100%)
>
Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 20/27] x86: dts: Drop unused CONFIG_SPL
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (32 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 22/27] doc: Move driver model docs under develop/ Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 19/27] x86: Make use of binman expanded entries Simon Glass
                   ` (18 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

This cannot be used since the previous #elif has already dealt with SPL.
Drop it.

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

(no changes since v1)

 arch/x86/dts/u-boot.dtsi | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 19/27] x86: Make use of binman expanded entries
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (33 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 20/27] x86: dts: Drop unused CONFIG_SPL Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 18/27] Makefile: Pass new entry args to binman Simon Glass
                   ` (17 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

We don't need to spell out the separate pieces of U-Boot phase binaries
anymore. Revert to using the simple entry and let binman do the expansion
itself as needed.

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

(no changes since v1)

 arch/x86/dts/u-boot.dtsi | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 18/27] Makefile: Pass new entry args to binman
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (34 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 19/27] x86: Make use of binman expanded entries Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 17/27] binman: Automatically expand phase binaries into sections Simon Glass
                   ` (16 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

To support the use of 'expanded' entries, binman needs to be told whether
SPL and TPL have a devicetree and whether they need BSS padding. Add these
to the Makefile.

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

(no changes since v1)

 Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 17/27] binman: Automatically expand phase binaries into sections
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (35 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 18/27] Makefile: Pass new entry args to binman Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 16/27] binman: Plumb expanded entries through fully Simon Glass
                   ` (15 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

When creating an entry, check for an expanded version of that entry, then
use it instead. This allows, for example use of:

   u-boot {
   };

instead of having to write out in full:

   u-boot {
      type = "section";

      u-boot-nodtb {
      };

      u-boot-dtb {
      };
   };

Add an implementaion of this and associated documentation.

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

Changes in v3:
- Update sizes for new behaviour

 tools/binman/README                       |  77 ++++++++++
 tools/binman/README.entries               |  96 +++++++++++-
 tools/binman/etype/blob_phase.py          |  51 +++++++
 tools/binman/etype/u_boot.py              |   8 +-
 tools/binman/etype/u_boot_expanded.py     |  24 +++
 tools/binman/etype/u_boot_nodtb.py        |   4 +-
 tools/binman/etype/u_boot_spl.py          |   3 +
 tools/binman/etype/u_boot_spl_expanded.py |  45 ++++++
 tools/binman/etype/u_boot_spl_nodtb.py    |   5 +-
 tools/binman/etype/u_boot_tpl.py          |   3 +
 tools/binman/etype/u_boot_tpl_expanded.py |  45 ++++++
 tools/binman/etype/u_boot_tpl_nodtb.py    |   5 +-
 tools/binman/ftest.py                     | 174 ++++++++++++++++++++++
 tools/binman/state.py                     |  19 ++-
 tools/binman/test/194_fdt_incl.dts        |  17 +++
 tools/binman/test/195_fdt_incl_tpl.dts    |  13 ++
 16 files changed, 571 insertions(+), 18 deletions(-)
 create mode 100644 tools/binman/etype/blob_phase.py
 create mode 100644 tools/binman/etype/u_boot_expanded.py
 create mode 100644 tools/binman/etype/u_boot_spl_expanded.py
 create mode 100644 tools/binman/etype/u_boot_tpl_expanded.py
 create mode 100644 tools/binman/test/194_fdt_incl.dts
 create mode 100644 tools/binman/test/195_fdt_incl_tpl.dts

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 16/27] binman: Plumb expanded entries through fully
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (36 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 17/27] binman: Automatically expand phase binaries into sections Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 15/27] binman: Allow a way to select expanded entries Simon Glass
                   ` (14 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

Add support for this feature in the control, image and section modules, so
that expanded entries will be selected by default. So far there are no
expanded entry types, so this is a nop.

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

(no changes since v1)

 tools/binman/control.py       | 24 ++++++++++++++++++------
 tools/binman/etype/section.py |  3 ++-
 tools/binman/image.py         | 17 ++++++++++++++++-
 3 files changed, 36 insertions(+), 8 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 15/27] binman: Allow a way to select expanded entries
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (37 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 16/27] binman: Plumb expanded entries through fully Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 14/27] binman: Allow using an an 'expanded' entry type Simon Glass
                   ` (13 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

Add a new command-line option to disable expanded entries. This is needed
for most tests, since it is much easier to 'factor out' this function into
a separate test and keep the existing packing tests simple.

Add the option and select it by default from tests.

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

(no changes since v1)

 tools/binman/cmdline.py |  3 +++
 tools/binman/ftest.py   | 19 +++++++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 14/27] binman: Allow using an an 'expanded' entry type
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (38 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 15/27] binman: Allow a way to select expanded entries Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 13/27] binman: Use standard filenames for SPL/TPL devicetree Simon Glass
                   ` (12 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

As the first step in supporting expanded entries, add a way for binman to
automatically select an 'expanded' version of an entry type, if requested.
This is controlled by a class method.

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

(no changes since v1)

 tools/binman/entry.py      | 60 ++++++++++++++++++++++++++++++++------
 tools/binman/entry_test.py | 12 ++++++++
 2 files changed, 63 insertions(+), 9 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 13/27] binman: Use standard filenames for SPL/TPL devicetree
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (39 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 14/27] binman: Allow using an an 'expanded' entry type Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 12/27] binman: Move the comment for GetFdts() to the base class Simon Glass
                   ` (11 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

At present, before any entry expansion is done (such as a 'files' entry
expanding out to individual entries for each file it contains), we check
the binman definition (i.e. '/binman' node) to find out what devicetree
files are used in the images.

This is a pain, since the definition may change during expansion. For
example if there is no u-boot-spl-dtb entry in the definition at the start,
we assume that the SPL devicetree is not used. But if an entry later
expands to include this, then we don't notice.

In fact the flexibility provided by the current approach of checking the
definition is not really useful. We know that we can have SPL and TPL
devicetrees. We know the pathname to each, so we can simply check if the
files are present. If they are present, we can prepare them and update
them regardless of whether they are actually used. If they are not present,
we cannot prepare/update them anyway, i.e. an error will be generated.

Simplify state.Prepare() so it uses a hard-coded list of devicetree files.

Note that state.PrepareFromLoadedData() is left untouched, since in that
case we have a complete definition from the loaded file, but cannot of
course rely on the devicetree files that created it still being present.
So in that case we still check the image defitions.

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

Changes in v3:
- Add new patch to use standard filenames for SPL/TPL devicetree

 tools/binman/state.py | 21 ++++++++++-----------
 tools/patman/tools.py |  8 ++++++--
 2 files changed, 16 insertions(+), 13 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 12/27] binman: Move the comment for GetFdts() to the base class
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (40 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 13/27] binman: Use standard filenames for SPL/TPL devicetree Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 11/27] binman: Drop unnecessary field in output_fdt_info Simon Glass
                   ` (10 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

Like with other methods this comment should be in the base class. Move it.

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

Changes in v3:
- Add new patch to move the comment for GetFdts() to the base class

 tools/binman/entry.py          | 2 +-
 tools/binman/etype/blob_dtb.py | 9 ---------
 2 files changed, 1 insertion(+), 10 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 11/27] binman: Drop unnecessary field in output_fdt_info
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (41 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 12/27] binman: Move the comment for GetFdts() to the base class Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:52 ` [PATCH v3 10/27] binman: Use the fake SPL/TPL only if requested Simon Glass
                   ` (9 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

At present we store an entry as the third field in output_fdt_info[].
This is only used to get the type of the entry. Of course multiple entries
may have this same type. Also the entry type is the key to this dict, so
we can use that instead.

Drop the field and update GetUpdateNodes() to suit. Improve the comment for
output_fdt_info a little while here.

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

Changes in v3:
- Add new patch to drop an unnecessary field in output_fdt_info

 tools/binman/state.py | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 10/27] binman: Use the fake SPL/TPL only if requested
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (42 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 11/27] binman: Drop unnecessary field in output_fdt_info Simon Glass
@ 2021-03-19 23:52 ` Simon Glass
  2021-03-19 23:53 ` [PATCH v3 09/27] binman: Drop unnecessary 'type' property in tests Simon Glass
                   ` (8 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:52 UTC (permalink / raw)
  To: u-boot

At present we always use the main devicetree for SPL/TPL as well when
setting up the state. But this it not needed if there is a real devicetree
for SPL or TPL. In fact it confuses things since we cannot distinguish
between one being provided and using the fake one.

Update the code to create the fakes only when requested. Put the mapping
in a constant so we can use it elsewhere.

Rename 'other_fname' to 'fname' while we are here since there is nothing
'other' about it.

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

Changes in v3:
- Add new patch to use the fake SPL/TPL only if requested

 tools/binman/state.py | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 09/27] binman: Drop unnecessary 'type' property in tests
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (43 preceding siblings ...)
  2021-03-19 23:52 ` [PATCH v3 10/27] binman: Use the fake SPL/TPL only if requested Simon Glass
@ 2021-03-19 23:53 ` Simon Glass
  2021-03-19 23:53 ` [PATCH v3 08/27] binman: Add support for u-boot-tpl-bss-bad Simon Glass
                   ` (7 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:53 UTC (permalink / raw)
  To: u-boot

A few tests declare a type when this can be inferred from the node name.
Drop these lines, since it might cause confusion.

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

Changes in v3:
- Add new patch to drop unnecessary 'type' property in tests

 tools/binman/test/149_symbols_tpl.dts     | 1 -
 tools/binman/test/155_symbols_tpl_x86.dts | 1 -
 2 files changed, 2 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 08/27] binman: Add support for u-boot-tpl-bss-bad
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (44 preceding siblings ...)
  2021-03-19 23:53 ` [PATCH v3 09/27] binman: Drop unnecessary 'type' property in tests Simon Glass
@ 2021-03-19 23:53 ` Simon Glass
  2021-03-19 23:53 ` [PATCH v3 07/27] binman: Add support for u-boot-tpl-nodtb Simon Glass
                   ` (6 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:53 UTC (permalink / raw)
  To: u-boot

This entry holds the padding between the end of of TPL binary and the
end of BSS. This region must be left empty so that the devicetree can be
appended correctly and remain accessible without interfering with BSS.

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

(no changes since v1)

 tools/binman/README.entries              | 22 ++++++++++++
 tools/binman/etype/u_boot_tpl_bss_pad.py | 44 ++++++++++++++++++++++++
 tools/binman/ftest.py                    | 16 +++++++++
 tools/binman/test/193_tpl_bss_pad.dts    | 19 ++++++++++
 4 files changed, 101 insertions(+)
 create mode 100644 tools/binman/etype/u_boot_tpl_bss_pad.py
 create mode 100644 tools/binman/test/193_tpl_bss_pad.dts

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 07/27] binman: Add support for u-boot-tpl-nodtb
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (45 preceding siblings ...)
  2021-03-19 23:53 ` [PATCH v3 08/27] binman: Add support for u-boot-tpl-bss-bad Simon Glass
@ 2021-03-19 23:53 ` Simon Glass
  2021-03-19 23:53 ` [PATCH v3 06/27] binman: Support symbols in u-boot-spl-nodtb Simon Glass
                   ` (5 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:53 UTC (permalink / raw)
  To: u-boot

Allow this entry type to be placed in an image. This is the TPL binary,
without a devicetree appended.

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

(no changes since v1)

 tools/binman/README.entries                | 23 ++++++++++++
 tools/binman/etype/u_boot_tpl_nodtb.py     | 41 ++++++++++++++++++++++
 tools/binman/ftest.py                      |  6 ++++
 tools/binman/test/192_u_boot_tpl_nodtb.dts | 13 +++++++
 4 files changed, 83 insertions(+)
 create mode 100644 tools/binman/etype/u_boot_tpl_nodtb.py
 create mode 100644 tools/binman/test/192_u_boot_tpl_nodtb.dts

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 06/27] binman: Support symbols in u-boot-spl-nodtb
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (46 preceding siblings ...)
  2021-03-19 23:53 ` [PATCH v3 07/27] binman: Add support for u-boot-tpl-nodtb Simon Glass
@ 2021-03-19 23:53 ` Simon Glass
  2021-03-19 23:53 ` [PATCH v3 05/27] binman: Correct the documentation for u-boot-spl-bss-pad Simon Glass
                   ` (4 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:53 UTC (permalink / raw)
  To: u-boot

Since this is an execuable we should be able insert symbol values into it.
Add support for this.

Use common code for this test and the original testSymbols. Use hex
consistently for the values and add some more comments.

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

Changes in v3:
- Add new patch to support symbols in u-boot-spl-nodtb

 tools/binman/README.entries             |  9 +++++
 tools/binman/etype/u_boot_spl_nodtb.py  | 14 +++++++
 tools/binman/ftest.py                   | 49 +++++++++++++++----------
 tools/binman/test/053_symbols.dts       |  2 +-
 tools/binman/test/192_symbols_nodtb.dts | 26 +++++++++++++
 tools/binman/test/u_boot_binman_syms.c  |  2 +-
 6 files changed, 81 insertions(+), 21 deletions(-)
 create mode 100644 tools/binman/test/192_symbols_nodtb.dts

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 05/27] binman: Correct the documentation for u-boot-spl-bss-pad
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (47 preceding siblings ...)
  2021-03-19 23:53 ` [PATCH v3 06/27] binman: Support symbols in u-boot-spl-nodtb Simon Glass
@ 2021-03-19 23:53 ` Simon Glass
  2021-03-19 23:53 ` [PATCH v3 04/27] binman: Tidy up underscores in entry documentation Simon Glass
                   ` (3 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:53 UTC (permalink / raw)
  To: u-boot

The documentation for this entry indicates that the SPL binary is included
along with the padding. It is not, so update it to correct the error.

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

(no changes since v1)

 tools/binman/README.entries              | 17 ++++++++++-------
 tools/binman/etype/u_boot_spl_bss_pad.py | 17 ++++++++++-------
 2 files changed, 20 insertions(+), 14 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 04/27] binman: Tidy up underscores in entry documentation
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (48 preceding siblings ...)
  2021-03-19 23:53 ` [PATCH v3 05/27] binman: Correct the documentation for u-boot-spl-bss-pad Simon Glass
@ 2021-03-19 23:53 ` Simon Glass
  2021-03-19 23:53 ` [PATCH v3 03/27] binman: Update entry help for files-align Simon Glass
                   ` (2 subsequent siblings)
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:53 UTC (permalink / raw)
  To: u-boot

Several entries currently use an underscore in the entry-type name, but in
fact a hyphen is used. Update the docs to fix this as it might be
confusing.

Also simplify the 'filename' comment and fix the 'operation' typo.

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

(no changes since v1)

 tools/binman/README.entries                 | 23 ++++++++++-----------
 tools/binman/etype/blob.py                  |  2 +-
 tools/binman/etype/u_boot.py                |  2 +-
 tools/binman/etype/u_boot_dtb_with_ucode.py |  4 ++--
 tools/binman/etype/u_boot_nodtb.py          |  6 +++---
 tools/binman/etype/u_boot_spl_nodtb.py      |  7 +++----
 tools/binman/etype/u_boot_with_ucode_ptr.py |  2 +-
 7 files changed, 22 insertions(+), 24 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 03/27] binman: Update entry help for files-align
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (49 preceding siblings ...)
  2021-03-19 23:53 ` [PATCH v3 04/27] binman: Tidy up underscores in entry documentation Simon Glass
@ 2021-03-19 23:53 ` Simon Glass
  2021-03-19 23:53 ` [PATCH v3 02/27] binman: Document ExpandEntries() in the base class Simon Glass
  2021-03-19 23:53 ` [PATCH v3 01/27] binman: Allow extracting to current directory Simon Glass
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:53 UTC (permalink / raw)
  To: u-boot

Regenerate the entry documentation, which step was missed when the
files-align feature was added.

Fixes: 6eb9932668f ("binman: Support alignment of files")

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

(no changes since v1)

 tools/binman/README.entries | 1 +
 1 file changed, 1 insertion(+)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 02/27] binman: Document ExpandEntries() in the base class
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (50 preceding siblings ...)
  2021-03-19 23:53 ` [PATCH v3 03/27] binman: Update entry help for files-align Simon Glass
@ 2021-03-19 23:53 ` Simon Glass
  2021-03-19 23:53 ` [PATCH v3 01/27] binman: Allow extracting to current directory Simon Glass
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:53 UTC (permalink / raw)
  To: u-boot

Move the documentation to the base method as it is with other methods.
Also update it a little while we are here.

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

(no changes since v1)

 tools/binman/entry.py         | 11 +++++++++++
 tools/binman/etype/section.py |  6 ------
 2 files changed, 11 insertions(+), 6 deletions(-)

Applied to u-boot-dm/next, thanks!

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

* [PATCH v3 01/27] binman: Allow extracting to current directory
  2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
                   ` (51 preceding siblings ...)
  2021-03-19 23:53 ` [PATCH v3 02/27] binman: Document ExpandEntries() in the base class Simon Glass
@ 2021-03-19 23:53 ` Simon Glass
  52 siblings, 0 replies; 56+ messages in thread
From: Simon Glass @ 2021-03-19 23:53 UTC (permalink / raw)
  To: u-boot

Extracting files to the current directory is not normally a very friendly
thing to do, but it can be warranted, e.g. in a new temporary dir. At
present binman reports an error when such an attempt is made. Fix it.

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

(no changes since v1)

 tools/binman/control.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm/next, thanks!

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

end of thread, other threads:[~2021-03-19 23:53 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
2021-03-18  7:24 ` [PATCH v3 01/27] binman: Allow extracting to current directory Simon Glass
2021-03-18  7:24 ` [PATCH v3 02/27] binman: Document ExpandEntries() in the base class Simon Glass
2021-03-18  7:24 ` [PATCH v3 03/27] binman: Update entry help for files-align Simon Glass
2021-03-18  7:24 ` [PATCH v3 04/27] binman: Tidy up underscores in entry documentation Simon Glass
2021-03-18  7:24 ` [PATCH v3 05/27] binman: Correct the documentation for u-boot-spl-bss-pad Simon Glass
2021-03-18  7:24 ` [PATCH v3 06/27] binman: Support symbols in u-boot-spl-nodtb Simon Glass
2021-03-18  7:24 ` [PATCH v3 07/27] binman: Add support for u-boot-tpl-nodtb Simon Glass
2021-03-18  7:24 ` [PATCH v3 08/27] binman: Add support for u-boot-tpl-bss-bad Simon Glass
2021-03-18  7:24 ` [PATCH v3 09/27] binman: Drop unnecessary 'type' property in tests Simon Glass
2021-03-18  7:25 ` [PATCH v3 10/27] binman: Use the fake SPL/TPL only if requested Simon Glass
2021-03-18  7:25 ` [PATCH v3 11/27] binman: Drop unnecessary field in output_fdt_info Simon Glass
2021-03-18  7:25 ` [PATCH v3 12/27] binman: Move the comment for GetFdts() to the base class Simon Glass
2021-03-18  7:25 ` [PATCH v3 13/27] binman: Use standard filenames for SPL/TPL devicetree Simon Glass
2021-03-18  7:25 ` [PATCH v3 14/27] binman: Allow using an an 'expanded' entry type Simon Glass
2021-03-18  7:25 ` [PATCH v3 15/27] binman: Allow a way to select expanded entries Simon Glass
2021-03-18  7:25 ` [PATCH v3 16/27] binman: Plumb expanded entries through fully Simon Glass
2021-03-18  7:25 ` [PATCH v3 17/27] binman: Automatically expand phase binaries into sections Simon Glass
2021-03-18  7:25 ` [PATCH v3 18/27] Makefile: Pass new entry args to binman Simon Glass
2021-03-18  7:25 ` [PATCH v3 19/27] x86: Make use of binman expanded entries Simon Glass
2021-03-18  7:25 ` [PATCH v3 20/27] x86: dts: Drop unused CONFIG_SPL Simon Glass
2021-03-18  7:25 ` [PATCH v3 21/27] doc: Move UEFI under develop/ Simon Glass
2021-03-18  9:23   ` Heinrich Schuchardt
2021-03-19 23:52   ` Simon Glass
2021-03-18  7:25 ` [PATCH v3 22/27] doc: Move driver model docs " Simon Glass
2021-03-18  7:25 ` [PATCH v3 23/27] binman: doc: Add documentation to htmldocs Simon Glass
2021-03-18  7:25 ` [PATCH v3 24/27] binman: Rearrange documentation into headings Simon Glass
2021-03-18  7:25 ` [PATCH v3 25/27] binman: Incorporate entry documentation Simon Glass
2021-03-18  7:25 ` [PATCH v3 26/27] binman: Drop repetitive heading for each entry Simon Glass
2021-03-18  7:25 ` [PATCH v3 27/27] binman: Update various pieces of the documentation Simon Glass
2021-03-19 23:52 ` Simon Glass
2021-03-19 23:52 ` [PATCH v3 26/27] binman: Drop repetitive heading for each entry Simon Glass
2021-03-19 23:52 ` [PATCH v3 25/27] binman: Incorporate entry documentation Simon Glass
2021-03-19 23:52 ` [PATCH v3 24/27] binman: Rearrange documentation into headings Simon Glass
2021-03-19 23:52 ` [PATCH v3 23/27] binman: doc: Add documentation to htmldocs Simon Glass
2021-03-19 23:52 ` [PATCH v3 22/27] doc: Move driver model docs under develop/ Simon Glass
2021-03-19 23:52 ` [PATCH v3 20/27] x86: dts: Drop unused CONFIG_SPL Simon Glass
2021-03-19 23:52 ` [PATCH v3 19/27] x86: Make use of binman expanded entries Simon Glass
2021-03-19 23:52 ` [PATCH v3 18/27] Makefile: Pass new entry args to binman Simon Glass
2021-03-19 23:52 ` [PATCH v3 17/27] binman: Automatically expand phase binaries into sections Simon Glass
2021-03-19 23:52 ` [PATCH v3 16/27] binman: Plumb expanded entries through fully Simon Glass
2021-03-19 23:52 ` [PATCH v3 15/27] binman: Allow a way to select expanded entries Simon Glass
2021-03-19 23:52 ` [PATCH v3 14/27] binman: Allow using an an 'expanded' entry type Simon Glass
2021-03-19 23:52 ` [PATCH v3 13/27] binman: Use standard filenames for SPL/TPL devicetree Simon Glass
2021-03-19 23:52 ` [PATCH v3 12/27] binman: Move the comment for GetFdts() to the base class Simon Glass
2021-03-19 23:52 ` [PATCH v3 11/27] binman: Drop unnecessary field in output_fdt_info Simon Glass
2021-03-19 23:52 ` [PATCH v3 10/27] binman: Use the fake SPL/TPL only if requested Simon Glass
2021-03-19 23:53 ` [PATCH v3 09/27] binman: Drop unnecessary 'type' property in tests Simon Glass
2021-03-19 23:53 ` [PATCH v3 08/27] binman: Add support for u-boot-tpl-bss-bad Simon Glass
2021-03-19 23:53 ` [PATCH v3 07/27] binman: Add support for u-boot-tpl-nodtb Simon Glass
2021-03-19 23:53 ` [PATCH v3 06/27] binman: Support symbols in u-boot-spl-nodtb Simon Glass
2021-03-19 23:53 ` [PATCH v3 05/27] binman: Correct the documentation for u-boot-spl-bss-pad Simon Glass
2021-03-19 23:53 ` [PATCH v3 04/27] binman: Tidy up underscores in entry documentation Simon Glass
2021-03-19 23:53 ` [PATCH v3 03/27] binman: Update entry help for files-align Simon Glass
2021-03-19 23:53 ` [PATCH v3 02/27] binman: Document ExpandEntries() in the base class Simon Glass
2021-03-19 23:53 ` [PATCH v3 01/27] binman: Allow extracting to current directory 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.