From patchwork Tue Jul 17 19:25:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 945309 X-Patchwork-Delegate: sjg@chromium.org 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41VW8f6W0rz9s0w for ; Wed, 18 Jul 2018 05:50:10 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9B556C21DF8; Tue, 17 Jul 2018 19:42:12 +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=none 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 122C7C21FBF; Tue, 17 Jul 2018 19:27:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2FDFEC21F17; Tue, 17 Jul 2018 19:26:56 +0000 (UTC) Received: from mail-io0-f201.google.com (mail-io0-f201.google.com [209.85.223.201]) by lists.denx.de (Postfix) with ESMTPS id 9FC07C21F2F for ; Tue, 17 Jul 2018 19:26:48 +0000 (UTC) Received: by mail-io0-f201.google.com with SMTP id d11-v6so1586041iok.21 for ; Tue, 17 Jul 2018 12:26:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=DIcEOUSaljZBZokaQ+KJV8mqgfIc8h4EVN1Fk4e4GI0=; b=acO94+tPKT2jbutp7uxJXBz0i+7CrdiggBLKtuk3r8cIOYl4LgM3HmM/Mn2w/qI4Zj hh20wcwhClGgXpWjBfM/jQ5H6fcHur8ZoGICNCauAgMjIz9zYRUervtF/Ff12o9g4DoK 0cpzXDLZkwBYcIaAcresfks6soKMlRsGXGf60K/uOCaUA7zGJnVPTPQeSuiuByVQpyF2 uH/D5tx95+Htgb/g0QLtG5C2ngY9jZAOFOoV3e+Tb6nVsjaQeBXe+wpM1nASxBCSKleX kPXe/M4t1i7WXKhimOJ7ZZw8vGU6vI28lzbu5c3g6cWBhNCRK/K1vrQNma+kgXHia5Fr NH0w== X-Gm-Message-State: AOUpUlGZ5XV6dQkeNDs2AYMngORhRkbXndRNAKOK3pSqknhve5CNq7Pj wIwIsh3zzuwNP3UwEI5CIDkbdQ0= X-Google-Smtp-Source: AA+uWPxwstbz/aX6aKi23yfPYpq++ZkKCPVBfn2GU5hdPQ/wZbXjHHBWRhetAkm+2YacL71sJZPwfyg= MIME-Version: 1.0 X-Received: by 2002:a6b:6d05:: with SMTP id a5-v6mr1191417iod.16.1531855607712; Tue, 17 Jul 2018 12:26:47 -0700 (PDT) Date: Tue, 17 Jul 2018 13:25:49 -0600 In-Reply-To: <20180717192552.198496-1-sjg@chromium.org> Message-Id: <20180717192552.198496-27-sjg@chromium.org> References: <20180717192552.198496-1-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.203.gfac676dfb9-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini Subject: [U-Boot] [PATCH 26/29] binman: Show the image position in the map 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" At present the map only shows the offset and size for each region. The image position provides the actual position of each entry in the image, regardless of the section hierarchy. Add the image position to the map. Signed-off-by: Simon Glass --- tools/binman/bsection.py | 3 ++- tools/binman/entry.py | 8 +++++--- tools/binman/ftest.py | 28 ++++++++++++++-------------- tools/binman/image.py | 3 ++- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py index f3a95fda8e..30c8f307a8 100644 --- a/tools/binman/bsection.py +++ b/tools/binman/bsection.py @@ -376,7 +376,8 @@ class Section(object): Args: fd: File to write the map to """ - Entry.WriteMapLine(fd, indent, self._name, self._offset, self._size) + Entry.WriteMapLine(fd, indent, self._name, self._offset, self._size, + self._image_pos) for entry in self._entries.values(): entry.WriteMap(fd, indent + 1) diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 996f03e3a6..6ce5dbdc90 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -349,8 +349,9 @@ class Entry(object): pass @staticmethod - def WriteMapLine(fd, indent, name, offset, size): - print('%s%08x %08x %s' % (' ' * indent, offset, size, name), file=fd) + def WriteMapLine(fd, indent, name, offset, size, image_pos): + print('%08x %s%08x %08x %s' % (image_pos, ' ' * indent, offset, + size, name), file=fd) def WriteMap(self, fd, indent): """Write a map of the entry to a .map file @@ -359,7 +360,8 @@ class Entry(object): fd: File to write the map to indent: Curent indent level of map (0=none, 1=one level, etc.) """ - self.WriteMapLine(fd, indent, self.name, self.offset, self.size) + self.WriteMapLine(fd, indent, self.name, self.offset, self.size, + self.image_pos) def GetEntries(self): """Return a list of entries contained by this entry diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index d09868588c..ce473dfaff 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -1052,25 +1052,25 @@ class TestFunctional(unittest.TestCase): def testMap(self): """Tests outputting a map of the images""" _, _, map_data, _ = self._DoReadFileDtb('55_sections.dts', map=True) - self.assertEqual(''' Offset Size Name -00000000 00000028 main-section - 00000000 00000010 section@0 - 00000000 00000004 u-boot - 00000010 00000010 section@1 - 00000000 00000004 u-boot - 00000020 00000004 section@2 - 00000000 00000004 u-boot + self.assertEqual('''ImagePos Offset Size Name +00000000 00000000 00000028 main-section +00000000 00000000 00000010 section@0 +00000000 00000000 00000004 u-boot +00000010 00000010 00000010 section@1 +00000010 00000000 00000004 u-boot +00000020 00000020 00000004 section@2 +00000020 00000000 00000004 u-boot ''', map_data) def testNamePrefix(self): """Tests that name prefixes are used""" _, _, map_data, _ = self._DoReadFileDtb('56_name_prefix.dts', map=True) - self.assertEqual(''' Offset Size Name -00000000 00000028 main-section - 00000000 00000010 section@0 - 00000000 00000004 ro-u-boot - 00000010 00000010 section@1 - 00000000 00000004 rw-u-boot + self.assertEqual('''ImagePos Offset Size Name +00000000 00000000 00000028 main-section +00000000 00000000 00000010 section@0 +00000000 00000000 00000004 ro-u-boot +00000010 00000010 00000010 section@1 +00000010 00000000 00000004 rw-u-boot ''', map_data) def testUnknownContents(self): diff --git a/tools/binman/image.py b/tools/binman/image.py index 4debc73451..68126bc3e6 100644 --- a/tools/binman/image.py +++ b/tools/binman/image.py @@ -124,5 +124,6 @@ class Image: filename = '%s.map' % self._name fname = tools.GetOutputFilename(filename) with open(fname, 'w') as fd: - print('%8s %8s %s' % ('Offset', 'Size', 'Name'), file=fd) + print('%8s %8s %8s %s' % ('ImagePos', 'Offset', 'Size', 'Name'), + file=fd) self._section.WriteMap(fd, 0)