Commit 1b3847a3 authored by Simon Glass's avatar Simon Glass
Browse files

binman: Use the fake SPL/TPL only if requested



At present we always use the main devicetree for SPL/TPL as well when
setting up the state. But this it not needed if there is a real devicetree
for SPL or TPL. In fact it confuses things since we cannot distinguish
between one being provided and using the fake one.

Update the code to create the fakes only when requested. Put the mapping
in a constant so we can use it elsewhere.

Rename 'other_fname' to 'fname' while we are here since there is nothing
'other' about it.
Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
parent 2c2f21ba
...@@ -13,6 +13,12 @@ import os ...@@ -13,6 +13,12 @@ import os
from patman import tools from patman import tools
from patman import tout from patman import tout
# Map an dtb etype to its expected filename
DTB_TYPE_FNAME = {
'u-boot-spl-dtb': 'spl/u-boot-spl.dtb',
'u-boot-tpl-dtb': 'tpl/u-boot-tpl.dtb',
}
# Records the device-tree files known to binman, keyed by entry type (e.g. # Records the device-tree files known to binman, keyed by entry type (e.g.
# 'u-boot-spl-dtb'). These are the output FDT files, which can be updated by # 'u-boot-spl-dtb'). These are the output FDT files, which can be updated by
# binman. They have been copied to <xxx>.out files. # binman. They have been copied to <xxx>.out files.
...@@ -178,19 +184,20 @@ def Prepare(images, dtb): ...@@ -178,19 +184,20 @@ def Prepare(images, dtb):
output_fdt_info.clear() output_fdt_info.clear()
fdt_path_prefix = '' fdt_path_prefix = ''
output_fdt_info['u-boot-dtb'] = [dtb, 'u-boot.dtb', None] output_fdt_info['u-boot-dtb'] = [dtb, 'u-boot.dtb', None]
output_fdt_info['u-boot-spl-dtb'] = [dtb, 'spl/u-boot-spl.dtb', None] if use_fake_dtb:
output_fdt_info['u-boot-tpl-dtb'] = [dtb, 'tpl/u-boot-tpl.dtb', None] for etype, fname in DTB_TYPE_FNAME.items():
if not use_fake_dtb: output_fdt_info[etype] = [dtb, fname, None]
else:
fdt_set = {} fdt_set = {}
for image in images.values(): for image in images.values():
fdt_set.update(image.GetFdts()) fdt_set.update(image.GetFdts())
for etype, other in fdt_set.items(): for etype, other in fdt_set.items():
entry, other_fname = other entry, fname = other
infile = tools.GetInputFilename(other_fname) infile = tools.GetInputFilename(fname)
other_fname_dtb = fdt_util.EnsureCompiled(infile) fname_dtb = fdt_util.EnsureCompiled(infile)
out_fname = tools.GetOutputFilename('%s.out' % out_fname = tools.GetOutputFilename('%s.out' %
os.path.split(other_fname)[1]) os.path.split(fname)[1])
tools.WriteFile(out_fname, tools.ReadFile(other_fname_dtb)) tools.WriteFile(out_fname, tools.ReadFile(fname_dtb))
other_dtb = fdt.FdtScan(out_fname) other_dtb = fdt.FdtScan(out_fname)
output_fdt_info[etype] = [other_dtb, out_fname, entry] output_fdt_info[etype] = [other_dtb, out_fname, entry]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment