diff mbox series

[U-Boot,19/53] binman: Support loading entry data from a file

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

Commit Message

Simon Glass July 20, 2019, 6:23 p.m. UTC
When modifying an image it is convenient to load the data from the file
into each entry so that it can be reprocessed. Add a new LoadData() method
to handle this.

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

 tools/binman/entry.py         | 5 +++++
 tools/binman/etype/section.py | 5 +++++
 2 files changed, 10 insertions(+)

Comments

Simon Glass July 29, 2019, 9:22 p.m. UTC | #1
When modifying an image it is convenient to load the data from the file
into each entry so that it can be reprocessed. Add a new LoadData() method
to handle this.

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

 tools/binman/entry.py         | 5 +++++
 tools/binman/etype/section.py | 5 +++++
 2 files changed, 10 insertions(+)

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

Patch

diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index e3c64348225..6436384254d 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -695,3 +695,8 @@  features to produce new behaviours.
                   (self.GetPath(), self.offset, self.offset + self.size,
                    self.size, len(data)))
         return data[self.offset:self.offset + self.size]
+
+    def LoadData(self, decomp=True):
+        data = self.ReadData(decomp)
+        self.ProcessContentsUpdate(data)
+        self.Detail('Loaded data size %x' % len(data))
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index f29784c1bbf..cd623821a34 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -462,3 +462,8 @@  class Entry_section(Entry):
                            self.image_pos, None, self.offset, self)
         for entry in self._entries.values():
             entry.ListEntries(entries, indent + 1)
+
+    def LoadData(self, decomp=True):
+        for entry in self._entries.values():
+            entry.LoadData(decomp)
+        self.Detail('Loaded data')