summaryrefslogtreecommitdiff
path: root/tools/binman/state.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-09-14 04:57:20 -0600
committerSimon Glass <sjg@chromium.org>2018-09-28 11:09:01 -0600
commit2a72cc72ca29fb14a61dd50a60ffcd096a0be317 (patch)
treef0055eaf05007ba0a97da8ab7a0ff54335e7af9c /tools/binman/state.py
parentc55a50f558f13c6c018c0e5cc0f0d765711a3828 (diff)
downloadu-boot-2a72cc72ca29fb14a61dd50a60ffcd096a0be317.tar.gz
binman: Move state logic into the state module
Rather than reaching into this module from control, move the code that needs this info into state. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/state.py')
-rw-r--r--tools/binman/state.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/binman/state.py b/tools/binman/state.py
index 6bc24ddf8a..9583b3fa5f 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -18,6 +18,15 @@ fdt_files = {}
# Arguments passed to binman to provide arguments to entries
entry_args = {}
+# Set of all device tree files references by images
+fdt_set = Set()
+
+# Same as above, but excluding the main one
+fdt_subset = Set()
+
+# The DTB which contains the full image information
+main_dtb = None
+
def GetFdt(fname):
"""Get the Fdt object for a particular device-tree filename
@@ -75,3 +84,37 @@ def GetEntryArg(name):
String value of argument
"""
return entry_args.get(name)
+
+def Prepare(dtb):
+ """Get device tree files ready for use
+
+ This sets up a set of device tree files that can be retrieved by GetFdts().
+ At present there is only one, that for U-Boot proper.
+
+ Args:
+ dtb: Main dtb
+ """
+ global fdt_set, fdt_subset, fdt_files, main_dtb
+ # Import these here in case libfdt.py is not available, in which case
+ # the above help option still works.
+ import fdt
+ import fdt_util
+
+ # If we are updating the DTBs we need to put these updated versions
+ # where Entry_blob_dtb can find them. We can ignore 'u-boot.dtb'
+ # since it is assumed to be the one passed in with options.dt, and
+ # was handled just above.
+ main_dtb = dtb
+ fdt_files.clear()
+ fdt_files['u-boot.dtb'] = dtb
+ fdt_set = Set()
+ fdt_subset = Set()
+
+def GetFdts():
+ """Yield all device tree files being used by binman
+
+ Yields:
+ Device trees being used (U-Boot proper, SPL, TPL)
+ """
+ yield main_dtb
+