diff mbox series

[U-Boot,38/53] binman: Adjust fmap to ignore CBFS files

Message ID 20190720182416.183626-39-sjg@chromium.org
State Accepted
Commit 95a0f3c6919e5586c23e41df46d7d41e401f13bb
Delegated to: Simon Glass
Headers show
Series binman: Support replacing entries in an existing image | expand

Commit Message

Simon Glass July 20, 2019, 6:24 p.m. UTC
The FMAP is not intended to show the files inside a CBFS. The FMAP can be
used to locate the CBFS itself, but then the CBFS must be read to find out
what is in it.

Update the FMAP to work this way and add some debugging while we are here.

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

 tools/binman/README.entries | 3 ++-
 tools/binman/etype/fmap.py  | 9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

Comments

Simon Glass July 29, 2019, 9:22 p.m. UTC | #1
The FMAP is not intended to show the files inside a CBFS. The FMAP can be
used to locate the CBFS itself, but then the CBFS must be read to find out
what is in it.

Update the FMAP to work this way and add some debugging while we are here.

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

 tools/binman/README.entries | 3 ++-
 tools/binman/etype/fmap.py  | 9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 37b8b4c4f98..0f0e367d026 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -314,7 +314,8 @@  see www.flashrom.org/Flashrom for more information.
 
 When used, this entry will be populated with an FMAP which reflects the
 entries in the current image. Note that any hierarchy is squashed, since
-FMAP does not support this.
+FMAP does not support this. Also, CBFS entries appear as a single entry -
+the sub-entries are ignored.
 
 
 
diff --git a/tools/binman/etype/fmap.py b/tools/binman/etype/fmap.py
index 56677cbac1c..835ba5012e5 100644
--- a/tools/binman/etype/fmap.py
+++ b/tools/binman/etype/fmap.py
@@ -8,6 +8,8 @@ 
 from entry import Entry
 import fmap_util
 import tools
+from tools import ToHexSize
+import tout
 
 
 class Entry_fmap(Entry):
@@ -26,7 +28,8 @@  class Entry_fmap(Entry):
 
     When used, this entry will be populated with an FMAP which reflects the
     entries in the current image. Note that any hierarchy is squashed, since
-    FMAP does not support this.
+    FMAP does not support this. Also, CBFS entries appear as a single entry -
+    the sub-entries are ignored.
     """
     def __init__(self, section, etype, node):
         Entry.__init__(self, section, etype, node)
@@ -39,7 +42,9 @@  class Entry_fmap(Entry):
         """
         def _AddEntries(areas, entry):
             entries = entry.GetEntries()
-            if entries:
+            tout.Debug("fmap: Add entry '%s' type '%s' (%s subentries)" %
+                       (entry.GetPath(), entry.etype, ToHexSize(entries)))
+            if entries and entry.etype != 'cbfs':
                 for subentry in entries.values():
                     _AddEntries(areas, subentry)
             else: