diff --git a/tools/binman/state.py b/tools/binman/state.py index 053b4fe73f..84f606b188 100644 --- a/tools/binman/state.py +++ b/tools/binman/state.py @@ -188,17 +188,16 @@ def Prepare(images, dtb): output_fdt_info[etype] = [dtb, fname] else: fdt_set = {} - for image in images.values(): - fdt_set.update(image.GetFdts()) - for etype, other in fdt_set.items(): - entry, fname = other - infile = tools.GetInputFilename(fname) - fname_dtb = fdt_util.EnsureCompiled(infile) - out_fname = tools.GetOutputFilename('%s.out' % - os.path.split(fname)[1]) - tools.WriteFile(out_fname, tools.ReadFile(fname_dtb)) - other_dtb = fdt.FdtScan(out_fname) - output_fdt_info[etype] = [other_dtb, out_fname] + for etype, fname in DTB_TYPE_FNAME.items(): + infile = tools.GetInputFilename(fname, allow_missing=True) + if infile and os.path.exists(infile): + fname_dtb = fdt_util.EnsureCompiled(infile) + out_fname = tools.GetOutputFilename('%s.out' % + os.path.split(fname)[1]) + tools.WriteFile(out_fname, tools.ReadFile(fname_dtb)) + other_dtb = fdt.FdtScan(out_fname) + output_fdt_info[etype] = [other_dtb, out_fname] + def PrepareFromLoadedData(image): """Get device tree files ready for use with a loaded image diff --git a/tools/patman/tools.py b/tools/patman/tools.py index 10997e4386..e5f391b7aa 100644 --- a/tools/patman/tools.py +++ b/tools/patman/tools.py @@ -130,8 +130,12 @@ def GetInputFilename(fname, allow_missing=False): allow_missing: True if the filename can be missing Returns: - The full path of the filename, within the input directory, or - None on error + fname, if indir is None; + full path of the filename, within the input directory; + None, if file is missing and allow_missing is True + + Raises: + ValueError if file is missing and allow_missing is False """ if not indir or fname[:1] == '/': return fname