Re: [PATCH 19/24] binman: Allow different operations in FIT generator nodes

2022-02-22 Thread Simon Glass
At present we only support expanding out FDT nodes. Make the operation
into an @operation property, so that others can be supported.

Re-arrange and tidy up the documentation so that it has separate
headings for each topic.

Signed-off-by: Simon Glass 
---

 tools/binman/entries.rst   |  85 +++-
 tools/binman/etype/fit.py  | 136 -
 tools/binman/ftest.py  |   7 ++
 tools/binman/test/220_fit_bad_oper.dts |  27 +
 4 files changed, 206 insertions(+), 49 deletions(-)
 create mode 100644 tools/binman/test/220_fit_bad_oper.dts

Applied to u-boot-dm, thanks!


[PATCH 19/24] binman: Allow different operations in FIT generator nodes

2022-02-08 Thread Simon Glass
At present we only support expanding out FDT nodes. Make the operation
into an @operation property, so that others can be supported.

Re-arrange and tidy up the documentation so that it has separate
headings for each topic.

Signed-off-by: Simon Glass 
---

 tools/binman/entries.rst   |  85 +++-
 tools/binman/etype/fit.py  | 136 -
 tools/binman/ftest.py  |   7 ++
 tools/binman/test/220_fit_bad_oper.dts |  27 +
 4 files changed, 206 insertions(+), 49 deletions(-)
 create mode 100644 tools/binman/test/220_fit_bad_oper.dts

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index d4a1f333dc..d483169712 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -553,6 +553,68 @@ For example, this creates an image containing a FIT with 
U-Boot SPL::
 };
 };
 
+More complex setups can be created, with generated nodes, as described
+below.
+
+Properties (in the 'fit' node itself)
+~
+
+Special properties have a `fit,` prefix, indicating that they should be
+processed but not included in the final FIT.
+
+The top-level 'fit' node supports the following special properties:
+
+fit,external-offset
+Indicates that the contents of the FIT are external and provides the
+external offset. This is passed to mkimage via the -E and -p flags.
+
+fit,fdt-list
+Indicates the entry argument which provides the list of device tree
+files for the gen-fdt-nodes operation (as below). This is often
+`of-list` meaning that `-a of-list="dtb1 dtb2..."` should be passed
+to binman.
+
+Substitutions
+~
+
+Node names and property values support a basic string-substitution feature.
+Available substitutions for '@' nodes (and property values) are:
+
+SEQ:
+Sequence number of the generated fdt (1, 2, ...)
+NAME
+Name of the dtb as provided (i.e. without adding '.dtb')
+
+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 in these nodes are:
+
+DEFAULT-SEQ:
+Sequence number of the default fdt, as provided by the 'default-dt'
+entry argument
+
+Available operations
+
+
+You can add an operation to an '@' node to indicate which operation is
+required::
+
+@fdt-SEQ {
+fit,operation = "gen-fdt-nodes";
+...
+};
+
+Available operations are:
+
+gen-fdt-nodes
+Generate FDT nodes as above. This is the default if there is no
+`fit,operation` property.
+
+Generating nodes from an FDT list (gen-fdt-nodes)
+~
+
 U-Boot supports creating fdt and config nodes automatically. To do this,
 pass an `of-list` property (e.g. `-a of-list=file1 file2`). This tells
 binman that you want to generates nodes for two files: `file1.dtb` and
@@ -590,32 +652,9 @@ You can create config nodes in a similar way::
 This tells binman to create nodes `config-1` and `config-2`, i.e. a config
 for each of your two files.
 
-Available substitutions for '@' nodes are:
-
-SEQ:
-Sequence number of the generated fdt (1, 2, ...)
-NAME
-Name of the dtb as provided (i.e. without adding '.dtb')
-
 Note that if no devicetree files are provided (with '-a of-list' as above)
 then no nodes will be generated.
 
-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
-
-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
-and provides the external offset. This is passsed to mkimage via
-the -E and -p flags.
-
-
 
 
 Entry: fmap: An entry which contains an Fmap section
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index bf84246904..6210deeef7 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -13,6 +13,12 @@ from dtoc import fdt_util
 from dtoc.fdt import Fdt
 from patman import tools
 
+# Supported operations, with the fit,operation property
+OP_GEN_FDT_NODES = range(1)
+OPERATIONS = {
+'gen-fdt-nodes': OP_GEN_FDT_NODES,
+}
+
 class Entry_fit(Entry):
 """Flat Image Tree (FIT)
 
@@ -46,6 +52,68 @@ class Entry_fit(Entry):
 };
 };
 
+More complex setups can be created, with generated nodes, as described
+below.
+
+Properties (in the 'fit' node itself)
+~
+
+Special properties have a `fit,` prefix, indicating that they should be
+processed but not i