summaryrefslogtreecommitdiff
path: root/tools/binman/state.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-09-14 04:57:24 -0600
committerSimon Glass <sjg@chromium.org>2018-09-28 11:09:01 -0600
commit6ed45ba0a831393ab6c5d3355384238d2b4f47da (patch)
treebed509d46fc12e537b381c813b4020030a68450c /tools/binman/state.py
parent93d174135ac44cbbe81c87ea564488309949e6d4 (diff)
binman: Support updating all device tree files
Binman currently supports updating the main device tree with things like the position of each entry. Extend this support to SPL and TPL as well, since they may need (a subset of) this information. Also adjust DTB output files to have a .out extension since this seems clearer than having a .dtb extension with 'out' in the name somwhere. Also add a few missing comments and update the DT setup code to use ReadFile and WriteFile(). Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/state.py')
-rw-r--r--tools/binman/state.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/binman/state.py b/tools/binman/state.py
index b27eb077a6..09ead442a6 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -59,6 +59,29 @@ def GetFdtPath(fname):
"""
return fdt_files[fname]._fname
+def GetFdtContents(fname):
+ """Looks up the FDT pathname and contents
+
+ This is used to obtain the Fdt pathname and contents when needed by an
+ entry. It supports a 'fake' dtb, allowing tests to substitute test data for
+ the real dtb.
+
+ Args:
+ fname: Filename to look up (e.g. 'u-boot.dtb').
+
+ Returns:
+ tuple:
+ pathname to Fdt
+ Fdt data (as bytes)
+ """
+ if fname in fdt_files and not use_fake_dtb:
+ pathname = GetFdtPath(fname)
+ data = GetFdt(fname).GetContents()
+ else:
+ pathname = tools.GetInputFilename(fname)
+ data = tools.ReadFile(pathname)
+ return pathname, data
+
def SetEntryArgs(args):
"""Set the value of the entry args
@@ -133,6 +156,8 @@ def GetFdts():
Device trees being used (U-Boot proper, SPL, TPL)
"""
yield main_dtb
+ for other_fname in fdt_subset:
+ yield fdt_files[other_fname]
def GetUpdateNodes(node):
"""Yield all the nodes that need to be updated in all device trees
@@ -149,6 +174,11 @@ def GetUpdateNodes(node):
is node, SPL and TPL)
"""
yield node
+ for dtb in fdt_files.values():
+ if dtb != node.GetFdt():
+ other_node = dtb.GetNode(node.path)
+ if other_node:
+ yield other_node
def AddZeroProp(node, prop):
"""Add a new property to affected device trees with an integer value of 0.