diff options
author | Simon Glass | 2021-03-18 20:25:01 +1300 |
---|---|---|
committer | Simon Glass | 2021-03-26 17:03:09 +1300 |
commit | cb8bebbde09c762cc09d2d1a387dc6b3c4434853 (patch) | |
tree | 3d07cb7e51dc946e4fb9bf692683007628a577c9 /tools | |
parent | 7697170e780bb13e7ace7035d8995190f79fc2f3 (diff) |
binman: Drop unnecessary field in output_fdt_info
At present we store an entry as the third field in output_fdt_info[].
This is only used to get the type of the entry. Of course multiple entries
may have this same type. Also the entry type is the key to this dict, so
we can use that instead.
Drop the field and update GetUpdateNodes() to suit. Improve the comment for
output_fdt_info a little while here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/binman/state.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/tools/binman/state.py b/tools/binman/state.py index cef5f660bba..053b4fe73f1 100644 --- a/tools/binman/state.py +++ b/tools/binman/state.py @@ -23,11 +23,10 @@ DTB_TYPE_FNAME = { # 'u-boot-spl-dtb'). These are the output FDT files, which can be updated by # binman. They have been copied to <xxx>.out files. # -# key: entry type +# key: entry type (e.g. 'u-boot-dtb) # value: tuple: # Fdt object # Filename -# Entry object, or None if not known output_fdt_info = {} # Prefix to add to an fdtmap path to turn it into a path to the /binman node @@ -124,11 +123,11 @@ def UpdateFdtContents(etype, data): etype: Entry type (e.g. 'u-boot-dtb') data: Data to replace the DTB with """ - dtb, fname, entry = output_fdt_info[etype] + dtb, fname = 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] + output_fdt_info[etype] = [dtb, fname] def SetEntryArgs(args): """Set the value of the entry args @@ -183,10 +182,10 @@ def Prepare(images, dtb): main_dtb = dtb output_fdt_info.clear() fdt_path_prefix = '' - output_fdt_info['u-boot-dtb'] = [dtb, 'u-boot.dtb', None] + output_fdt_info['u-boot-dtb'] = [dtb, 'u-boot.dtb'] if use_fake_dtb: for etype, fname in DTB_TYPE_FNAME.items(): - output_fdt_info[etype] = [dtb, fname, None] + output_fdt_info[etype] = [dtb, fname] else: fdt_set = {} for image in images.values(): @@ -199,7 +198,7 @@ def Prepare(images, dtb): 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, entry] + output_fdt_info[etype] = [other_dtb, out_fname] def PrepareFromLoadedData(image): """Get device tree files ready for use with a loaded image @@ -222,7 +221,7 @@ def PrepareFromLoadedData(image): tout.Info('Preparing device trees') output_fdt_info.clear() fdt_path_prefix = '' - output_fdt_info['fdtmap'] = [image.fdtmap_dtb, 'u-boot.dtb', None] + output_fdt_info['fdtmap'] = [image.fdtmap_dtb, 'u-boot.dtb'] main_dtb = None tout.Info(" Found device tree type 'fdtmap' '%s'" % image.fdtmap_dtb.name) for etype, value in image.GetFdts().items(): @@ -240,7 +239,7 @@ def PrepareFromLoadedData(image): if 'multiple-images' in image_node.props: image_node = dtb.GetNode('/binman/%s' % image.image_node) fdt_path_prefix = image_node.path - output_fdt_info[etype] = [dtb, None, entry] + output_fdt_info[etype] = [dtb, None] tout.Info(" FDT path prefix '%s'" % fdt_path_prefix) @@ -275,12 +274,11 @@ def GetUpdateNodes(node, for_repack=False): is node, SPL and TPL) """ yield node - for dtb, fname, entry in output_fdt_info.values(): + for entry_type, (dtb, fname) in output_fdt_info.items(): if dtb != node.GetFdt(): - if for_repack and entry.etype != 'u-boot-dtb': + if for_repack and entry_type != 'u-boot-dtb': continue other_node = dtb.GetNode(fdt_path_prefix + node.path) - #print(' try', fdt_path_prefix + node.path, other_node) if other_node: yield other_node |