summaryrefslogtreecommitdiff
path: root/tools/binman/state.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-07-20 12:24:08 -0600
committerSimon Glass <sjg@chromium.org>2019-07-29 09:38:06 -0600
commitf6e02497ae063b7939b0670153d22a7b17bf4408 (patch)
tree4092ea48dfe2cd52cd9280dad8baf907df9f22a2 /tools/binman/state.py
parent313533018dc175a5552a8ccac9d6bcd780e824df (diff)
binman: Update state when replacing device-tree entries
Since the state module holds references to all the device trees used by binman, it must be updated when the device trees are updated. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/state.py')
-rw-r--r--tools/binman/state.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/binman/state.py b/tools/binman/state.py
index f22cc82d87..d704ed2c7c 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -108,6 +108,22 @@ def GetFdtContents(etype='u-boot-dtb'):
data = tools.ReadFile(pathname)
return pathname, data
+def UpdateFdtContents(etype, data):
+ """Update the contents of a particular device tree
+
+ The device tree is updated and written back to its file. This affects what
+ is returned from future called to GetFdtContents(), etc.
+
+ Args:
+ etype: Entry type (e.g. 'u-boot-dtb')
+ data: Data to replace the DTB with
+ """
+ dtb, fname, entry = 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]
+
def SetEntryArgs(args):
"""Set the value of the entry args