mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 01:02:19 +02:00
binman: Handle reading data for end-at-4gb sections
Some x86 sections have special offsets which currently result in empty data being returned from the 'extract' command. Fix this by taking account of the skip-at-start property. Add a little more debugging while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
@@ -714,17 +714,19 @@ features to produce new behaviours.
|
|||||||
"""
|
"""
|
||||||
# Use True here so that we get an uncompressed section to work from,
|
# Use True here so that we get an uncompressed section to work from,
|
||||||
# although compressed sections are currently not supported
|
# although compressed sections are currently not supported
|
||||||
|
tout.Debug("ReadChildData section '%s', entry '%s'" %
|
||||||
|
(self.section.GetPath(), self.GetPath()))
|
||||||
data = self.section.ReadChildData(self, decomp)
|
data = self.section.ReadChildData(self, decomp)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def ReadChildData(self, child, decomp=True):
|
def ReadChildData(self, child, decomp=True):
|
||||||
"""Read the data for a particular child
|
"""Read the data for a particular child entry
|
||||||
|
|
||||||
This reads data from the parent and extracts the piece that relates to
|
This reads data from the parent and extracts the piece that relates to
|
||||||
the given child.
|
the given child.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
child: Child to read (must be valid)
|
child: Child entry to read data for (must be valid)
|
||||||
decomp: True to decompress any compressed data before returning it;
|
decomp: True to decompress any compressed data before returning it;
|
||||||
False to return the raw, uncompressed data
|
False to return the raw, uncompressed data
|
||||||
|
|
||||||
|
@@ -500,18 +500,12 @@ class Entry_section(Entry):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def ReadChildData(self, child, decomp=True):
|
def ReadChildData(self, child, decomp=True):
|
||||||
"""Read the data for a particular child entry
|
tout.Debug("ReadChildData for child '%s'" % child.GetPath())
|
||||||
|
|
||||||
Args:
|
|
||||||
child: Child entry to read data for
|
|
||||||
decomp: True to return uncompressed data, False to leave the data
|
|
||||||
compressed if it is compressed
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Data contents of entry
|
|
||||||
"""
|
|
||||||
parent_data = self.ReadData(True)
|
parent_data = self.ReadData(True)
|
||||||
data = parent_data[child.offset:child.offset + child.size]
|
offset = child.offset - self._skip_at_start
|
||||||
|
tout.Debug("Extract for child '%s': offset %#x, skip_at_start %#x, result %#x" %
|
||||||
|
(child.GetPath(), child.offset, self._skip_at_start, offset))
|
||||||
|
data = parent_data[offset:offset + child.size]
|
||||||
if decomp:
|
if decomp:
|
||||||
indata = data
|
indata = data
|
||||||
data = tools.Decompress(indata, child.compress)
|
data = tools.Decompress(indata, child.compress)
|
||||||
|
@@ -201,6 +201,8 @@ class Image(section.Entry_section):
|
|||||||
return entry
|
return entry
|
||||||
|
|
||||||
def ReadData(self, decomp=True):
|
def ReadData(self, decomp=True):
|
||||||
|
tout.Debug("Image '%s' ReadData(), size=%#x" %
|
||||||
|
(self.GetPath(), len(self._data)))
|
||||||
return self._data
|
return self._data
|
||||||
|
|
||||||
def GetListEntries(self, entry_paths):
|
def GetListEntries(self, entry_paths):
|
||||||
|
Reference in New Issue
Block a user