summaryrefslogtreecommitdiff
path: root/tools/binman/etype/fit.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-09-06 19:39:08 +0300
committerSimon Glass <sjg@chromium.org>2020-09-22 21:54:13 +0300
commitc0f1ebe9c1b9745e1cbdc742a11093da2c99a174 (patch)
treea85c305e9f3649c2fc268b586a87726df2b0e72a /tools/binman/etype/fit.py
parent4ec40a7208db0e3294e266aacd23eddbae13c879 (diff)
downloadu-boot-c0f1ebe9c1b9745e1cbdc742a11093da2c99a174.tar.xz
binman: Allow selecting default FIT configuration
Add a new entry argument to the fit entry which allows selection of the default configuration to use. This is the 'default' property in the 'configurations' node. Update the Makefile to pass in the value of DEVICE_TREE or CONFIG_DEFAULT_DEVICE_TREE to provide this information. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'tools/binman/etype/fit.py')
-rw-r--r--tools/binman/etype/fit.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index c291eb26ba..de4745c552 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -90,6 +90,14 @@ class Entry_fit(Entry):
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
@@ -121,6 +129,8 @@ class Entry_fit(Entry):
[EntryArg(self._fit_list_prop.value, str)])
if fdts is not None:
self._fdts = fdts.split()
+ self._fit_default_dt = self.GetEntryArgsOrProps([EntryArg('default-dt',
+ str)])[0]
def ReadNode(self):
self._ReadSubnodes()
@@ -142,6 +152,22 @@ class Entry_fit(Entry):
"""
for pname, prop in node.props.items():
if not pname.startswith('fit,'):
+ if pname == 'default':
+ val = prop.value
+ # Handle the 'default' property
+ if val.startswith('@'):
+ if not self._fdts:
+ continue
+ if not self._fit_default_dt:
+ self.Raise("Generated 'default' node requires default-dt entry argument")
+ if self._fit_default_dt not in self._fdts:
+ self.Raise("default-dt entry argument '%s' not found in fdt list: %s" %
+ (self._fit_default_dt,
+ ', '.join(self._fdts)))
+ seq = self._fdts.index(self._fit_default_dt)
+ val = val[1:].replace('DEFAULT-SEQ', str(seq + 1))
+ fsw.property_string(pname, val)
+ continue
fsw.property(pname, prop.bytes)
rel_path = node.path[len(base_node.path):]