]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
binman: Support loading entry data from a file
authorSimon Glass <sjg@chromium.org>
Sat, 20 Jul 2019 18:23:41 +0000 (12:23 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 29 Jul 2019 15:38:05 +0000 (09:38 -0600)
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
tools/binman/etype/section.py

index e3c64348225cc14e5580885275f42109263c24c8..6436384254d5d8fc5748b0da9a72d4519ab9473e 100644 (file)
@@ -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))
index f29784c1bbfd53d7fd3c8e180cd222ff125787b2..cd623821a3451761a91942deb4148c6eaaa6f3bf 100644 (file)
@@ -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')