diff mbox series

[U-Boot,037/126] binman: Handle reading data for end-at-4gb sections

Message ID 20190925145750.200592-38-sjg@chromium.org
State Accepted
Commit 2d553c006d46653f3e0367cc5bfe36a9c7128eb5
Delegated to: Bin Meng
Headers show
Series x86: Add initial support for apollolake | expand

Commit Message

Simon Glass Sept. 25, 2019, 2:56 p.m. UTC
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>
---

 tools/binman/entry.py         |  6 ++++--
 tools/binman/etype/section.py | 16 +++++-----------
 tools/binman/image.py         |  2 ++
 3 files changed, 11 insertions(+), 13 deletions(-)

Comments

Bin Meng Oct. 5, 2019, 2:42 p.m. UTC | #1
On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote:
>
> 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>
> ---
>
>  tools/binman/entry.py         |  6 ++++--
>  tools/binman/etype/section.py | 16 +++++-----------
>  tools/binman/image.py         |  2 ++
>  3 files changed, 11 insertions(+), 13 deletions(-)
>

Acked-by: Bin Meng <bmeng.cn@gmail.com>
Bin Meng Oct. 6, 2019, 11:20 a.m. UTC | #2
On Sat, Oct 5, 2019 at 10:42 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote:
> >
> > 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>
> > ---
> >
> >  tools/binman/entry.py         |  6 ++++--
> >  tools/binman/etype/section.py | 16 +++++-----------
> >  tools/binman/image.py         |  2 ++
> >  3 files changed, 11 insertions(+), 13 deletions(-)
> >
>
> Acked-by: Bin Meng <bmeng.cn@gmail.com>

applied to u-boot-x86/next, thanks!
diff mbox series

Patch

diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 0e82065c291..409c0dca934 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -717,17 +717,19 @@  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
+        tout.Debug("ReadChildData section '%s', entry '%s'" %
+                   (self.section.GetPath(), self.GetPath()))
         data = self.section.ReadChildData(self, decomp)
         return data
 
     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
         the given child.
 
         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;
                 False to return the raw, uncompressed data
 
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index d39c6ad81ea..ab0c42cee04 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -508,18 +508,12 @@  class Entry_section(Entry):
         return data
 
     def ReadChildData(self, child, decomp=True):
-        """Read the data for a particular child entry
-
-        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
-        """
+        tout.Debug("ReadChildData for child '%s'" % child.GetPath())
         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:
             indata = data
             data = tools.Decompress(indata, child.compress)
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 7b39a1ddcec..2beab7fd4d2 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -201,6 +201,8 @@  class Image(section.Entry_section):
         return entry
 
     def ReadData(self, decomp=True):
+        tout.Debug("Image '%s' ReadData(), size=%#x" %
+                   (self.GetPath(), len(self._data)))
         return self._data
 
     def GetListEntries(self, entry_paths):