diff mbox series

[U-Boot,32/53] binman: Move Image.BuildImage() into a single function

Message ID 20190720182416.183626-33-sjg@chromium.org
State Accepted
Commit 7400107e467da52c7e6772b677f69f4464f6d2ce
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
Now that an Image is an Entry_section, there is no need for the separate
BuildSection() function. Drop it and add a bit of logging.

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

 tools/binman/image.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Simon Glass July 29, 2019, 9:22 p.m. UTC | #1
Now that an Image is an Entry_section, there is no need for the separate
BuildSection() function. Drop it and add a bit of logging.

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

 tools/binman/image.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

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

Patch

diff --git a/tools/binman/image.py b/tools/binman/image.py
index 893e8cb4cd5..fd4f5044929 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -142,16 +142,14 @@  class Image(section.Entry_section):
         """Write symbol values into binary files for access at run time"""
         section.Entry_section.WriteSymbols(self, self)
 
-    def BuildSection(self, fd, base_offset):
-        """Write the section to a file"""
-        fd.seek(base_offset)
-        fd.write(self.GetData())
-
     def BuildImage(self):
         """Write the image to a file"""
         fname = tools.GetOutputFilename(self._filename)
+        tout.Info("Writing image to '%s'" % fname)
         with open(fname, 'wb') as fd:
-            self.BuildSection(fd, 0)
+            data = self.GetData()
+            fd.write(data)
+        tout.Info("Wrote %#x bytes" % len(data))
 
     def WriteMap(self):
         """Write a map of the image to a .map file