binman: Update Entry.ReadEntry() to work through classes

At present we simply extract the data directly from entries using the
image_pos information. This happens to work on current entry types, but
cannot work if the entry type encodes the data in some way. Update the
ReadData() method to provide the data by calling a new ReadChildData()
method in the parent. This allows the entry_Section class, or possibly
any other container class, to return the correct data in all cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2019-07-20 12:24:04 -06:00
parent 17a7421ff4
commit a9cd39ef75
4 changed files with 46 additions and 17 deletions

View file

@ -714,11 +714,8 @@ features to produce new behaviours.
"""
# Use True here so that we get an uncompressed section to work from,
# although compressed sections are currently not supported
data = self.section.ReadData(True)
tout.Info('%s: Reading data from offset %#x-%#x, size %#x (avail %#x)' %
(self.GetPath(), self.offset, self.offset + self.size,
self.size, len(data)))
return data[self.offset:self.offset + self.size]
data = self.section.ReadChildData(self, decomp)
return data
def LoadData(self, decomp=True):
data = self.ReadData(decomp)