[U-Boot,11/53] binman: Simplify state.fdt_subset
diff mbox series

Message ID 20190720182416.183626-12-sjg@chromium.org
State Accepted
Commit 77e4ef1bf48eed22efe42f007d60c90b2035e101
Delegated to: Simon Glass
Headers show
Series
  • binman: Support replacing entries in an existing image
Related show

Commit Message

Simon Glass July 20, 2019, 6:23 p.m. UTC
At present this excludes the device tree passed in to binman since it
is always returned first by GetAllFdts(). However, this is easy to ensure
by adding a check in that function. Change this dict to includes all
device trees, and rename it to fdt_set.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/binman/state.py | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Comments

Simon Glass July 29, 2019, 9:22 p.m. UTC | #1
At present this excludes the device tree passed in to binman since it
is always returned first by GetAllFdts(). However, this is easy to ensure
by adding a check in that function. Change this dict to includes all
device trees, and rename it to fdt_set.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/binman/state.py | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Applied to u-boot-dm, thanks!

Patch
diff mbox series

diff --git a/tools/binman/state.py b/tools/binman/state.py
index 0278f87df22..46c1c8d613a 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -28,11 +28,12 @@  entry_args = {}
 # ftest.py)
 use_fake_dtb = False
 
-# Dict of device trees, keyed by entry type, but excluding the main one
+# Dict of device trees, keyed by entry type. These are the input device trees,
+# before any modification by U-Boot
 # The value is as returned by Entry.GetFdts(), i.e. a tuple:
 #     Fdt object for this dtb, or None if not available
 #     Filename of file containing this dtb
-fdt_subset = {}
+fdt_set = {}
 
 # The DTB which contains the full image information
 main_dtb = None
@@ -135,7 +136,7 @@  def Prepare(images, dtb):
         images: List of images being used
         dtb: Main dtb
     """
-    global fdt_set, fdt_subset, output_fdt_files, main_dtb
+    global fdt_set, output_fdt_files, main_dtb
     # Import these here in case libfdt.py is not available, in which case
     # the above help option still works.
     import fdt
@@ -150,13 +151,11 @@  def Prepare(images, dtb):
     output_fdt_files['u-boot-dtb'] = [dtb, 'u-boot.dtb']
     output_fdt_files['u-boot-spl-dtb'] = [dtb, 'spl/u-boot-spl.dtb']
     output_fdt_files['u-boot-tpl-dtb'] = [dtb, 'tpl/u-boot-tpl.dtb']
-    fdt_subset = {}
+    fdt_set = {}
     if not use_fake_dtb:
         for image in images.values():
-            fdt_subset.update(image.GetFdts())
-        if 'u-boot-dtb' in fdt_subset:
-            del fdt_subset['u-boot-dtb']
-        for etype, other in fdt_subset.items():
+            fdt_set.update(image.GetFdts())
+        for etype, other in fdt_set.items():
             _, other_fname = other
             infile = tools.GetInputFilename(other_fname)
             other_fname_dtb = fdt_util.EnsureCompiled(infile)
@@ -173,8 +172,10 @@  def GetAllFdts():
         Device trees being used (U-Boot proper, SPL, TPL)
     """
     yield main_dtb
-    for etype in fdt_subset:
-        yield output_fdt_files[etype][0]
+    for etype in fdt_set:
+        dtb = output_fdt_files[etype][0]
+        if dtb != main_dtb:
+            yield dtb
 
 def GetUpdateNodes(node):
     """Yield all the nodes that need to be updated in all device trees