summaryrefslogtreecommitdiffstats
path: root/tools/dtoc/fdt_util.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-07-20 12:23:49 -0600
committerSimon Glass <sjg@chromium.org>2019-07-29 09:38:06 -0600
commita004f29464d14f3535ed8db22e5dfed02c8fc9d8 (patch)
tree0451f714cdca079bad5d1d99e08d26b32b45fe80 /tools/dtoc/fdt_util.py
parent02fd463cfeeb3ec693539885dbc58e0439d3b4de (diff)
downloadu-boot-a004f29464d14f3535ed8db22e5dfed02c8fc9d8.tar.gz
u-boot-a004f29464d14f3535ed8db22e5dfed02c8fc9d8.tar.xz
u-boot-a004f29464d14f3535ed8db22e5dfed02c8fc9d8.zip
binman: Tidy up _SetupDtb() to use its own temporary file
At present EnsureCompiled() uses an file from the 'output' directory (in the tools module) when compiling the device tree. This is fine in most cases, allowing useful inspection of the output files from binman. However in functional tests, _SetupDtb() creates an output directory and immediately removes it afterwards. This serves no benefit and just confuses things, since the 'official' output directory is supposed to be created and destroyed in control.Binman(). Add a new parameter for the optional temporary directory to use, and use a separate temporary directory in _SetupDtb(). Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/fdt_util.py')
-rw-r--r--tools/dtoc/fdt_util.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py
index f47879ac00..b105faec74 100644
--- a/tools/dtoc/fdt_util.py
+++ b/tools/dtoc/fdt_util.py
@@ -43,12 +43,14 @@ def fdt_cells_to_cpu(val, cells):
out = out << 32 | fdt32_to_cpu(val[1])
return out
-def EnsureCompiled(fname, capture_stderr=False):
+def EnsureCompiled(fname, tmpdir=None, capture_stderr=False):
"""Compile an fdt .dts source file into a .dtb binary blob if needed.
Args:
fname: Filename (if .dts it will be compiled). It not it will be
left alone
+ tmpdir: Temporary directory for output files, or None to use the
+ tools-module output directory
Returns:
Filename of resulting .dtb file
@@ -57,8 +59,12 @@ def EnsureCompiled(fname, capture_stderr=False):
if ext != '.dts':
return fname
- dts_input = tools.GetOutputFilename('source.dts')
- dtb_output = tools.GetOutputFilename('source.dtb')
+ if tmpdir:
+ dts_input = os.path.join(tmpdir, 'source.dts')
+ dtb_output = os.path.join(tmpdir, 'source.dtb')
+ else:
+ dts_input = tools.GetOutputFilename('source.dts')
+ dtb_output = tools.GetOutputFilename('source.dtb')
search_paths = [os.path.join(os.getcwd(), 'include')]
root, _ = os.path.splitext(fname)