From patchwork Wed Sep 25 14:56:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1167428 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="hoKAYwwt"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46dj136hwQz9sP3 for ; Thu, 26 Sep 2019 01:39:51 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 81332C22164; Wed, 25 Sep 2019 15:18:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 09278C2206E; Wed, 25 Sep 2019 15:02:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9B68BC22168; Wed, 25 Sep 2019 15:02:41 +0000 (UTC) Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by lists.denx.de (Postfix) with ESMTPS id C36E8C2206E for ; Wed, 25 Sep 2019 14:58:35 +0000 (UTC) Received: by mail-io1-f68.google.com with SMTP id j4so14563585iog.11 for ; Wed, 25 Sep 2019 07:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5KgR/JUUVU117m3V+nRMPgC/mdrhsLwlkK7Vh0ANfZM=; b=hoKAYwwtf/uLiZfxdVBn8pAipq2Et/MmcrQcuR3SVmiqSCh/hDAE2QsKRviD3PgyKd eKEsYQZ7NQ0sN27HDCBid8Cn7uFbSAFNS58Dy3B5puEsNUFWJybaPlKKSdbqzj8kanMJ DNKJdOQfTiy9eXI3UqOqPLvmjRx00kcJGEtVk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5KgR/JUUVU117m3V+nRMPgC/mdrhsLwlkK7Vh0ANfZM=; b=HI26irVFdmbOoRLLYDfTx/Tnl/osPkf860VxRs/3KXCqT3xW7cuMnQ5HYyZkZaWKoy 3lUkYLNrXM/JcfB5Q/tJC1+CMlZ2Xa2w3GkqI5rtcLVlCjUEs92kUJAc/o4KFJRYJpgX SanR+i76alytoFXAP8vqJ+fF17MX9Dsy+FhvowQ5rPvLcC2+mgs11yfTOF4ctw06izIF 9NeJ7faYAyWTLJkplh0GnvrGI6/+A3XhYRtuxr8ymYtV9s/dO3YqzcDgprw507KIikWm PyTleOcMxNLH9mPd3g5x0QtpoO82XUFMOuI3bV7whF+6cdBueefPbe6k48sw/FTpo89H FbQw== X-Gm-Message-State: APjAAAWXpvV/ZxRv6rbR9oIYzy4msaaeTT2TAKVbYkvCBOEttbmKiJmk YQoy1y60VVBPj3T83U0RtMdd0AAkZkk= X-Google-Smtp-Source: APXvYqwCMR7v1WQNVHyK1N+DFAPecKsVxzEvN/w1yzmQyCg/+S9jzbfh+dS4fr3t6gqguM4Tg+7xtQ== X-Received: by 2002:a05:6602:2543:: with SMTP id j3mr2365544ioe.29.1569423514385; Wed, 25 Sep 2019 07:58:34 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id d9sm4254964ioq.9.2019.09.25.07.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2019 07:58:33 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 25 Sep 2019 08:56:21 -0600 Message-Id: <20190925145750.200592-38-sjg@chromium.org> X-Mailer: git-send-email 2.23.0.444.g18eeb5a265-goog In-Reply-To: <20190925145750.200592-1-sjg@chromium.org> References: <20190925145750.200592-1-sjg@chromium.org> MIME-Version: 1.0 Subject: [U-Boot] [PATCH 037/126] binman: Handle reading data for end-at-4gb sections X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 Acked-by: Bin Meng --- tools/binman/entry.py | 6 ++++-- tools/binman/etype/section.py | 16 +++++----------- tools/binman/image.py | 2 ++ 3 files changed, 11 insertions(+), 13 deletions(-) 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):