From patchwork Wed May 16 01:52:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914114 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 Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="VWdcvUVd"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40lyCx6FxWz9ryk for ; Wed, 16 May 2018 11:54:21 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 85429C21DFD; Wed, 16 May 2018 01:53:34 +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_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 AAE33C21DAF; Wed, 16 May 2018 01:53:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 296D7C21BE5; Wed, 16 May 2018 01:53:06 +0000 (UTC) Received: from mail-it0-f48.google.com (mail-it0-f48.google.com [209.85.214.48]) by lists.denx.de (Postfix) with ESMTPS id C871CC21C2F for ; Wed, 16 May 2018 01:53:04 +0000 (UTC) Received: by mail-it0-f48.google.com with SMTP id y189-v6so6587659itb.2 for ; Tue, 15 May 2018 18:53:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=9VHwfA0ObklrYLhxFsp1qDN8FDTLOCJ49gV4TgwSv1g=; b=VWdcvUVdpk0B4rsj68WwkzAg8mC+3WfRb/Ac19aDteegkKCFN24heW0e2u27to11I9 ArXqTZ+ZB5CdBWXim31mUcMFe/NXeb227ogzmXXuAIS/uveOJ96Jac3SFASIVbSq8qa1 LVtC3zJJBnB+R6Oc+0tw/CB1mEpdlbfMu8eQ/zf0ulzPT0ZSVWYzsp3gx7mX8NJVnnZw VBkJmCBZa6qW1tVEalsv8B9n+dBEYgAUqjxlUBZ6BjSEsYzhCOXizrIMvWgAdBMhAAKR m+1xh6BPd43/9QXVXPPZLQ/vpU9gh1n3qlImwbC1kDOdnpVxHKfq0YavQ/KGN13/DAL5 PjFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=9VHwfA0ObklrYLhxFsp1qDN8FDTLOCJ49gV4TgwSv1g=; b=GkDq/RCTopWqUxb/UErxtPWwqAWoumr2xwuOWcZbV5pYrJDSBnT9RuEsXA0af2/aps WXTF37mWmvOWBuEJx2R4gu9GjV3mf9xPWpNYOwjdpahqLbSKT4MF5uCHsO3JCsNlusfG y6MVkes3KrBPYLC/em/X3X2OxionrdSyD3U3EqmiN+JVumUnPrEgQoO+xw2j5PD2pA9h Sfk8ZTaCuAEXLrJfXKm4E/NprVgHpYOF/qgOoDLzfmpuJhDcvL6MOyqUIQ1055iyniCF U8khl0A3Wi8iW69QT09F3xyf8pETlPVer90PrjiZEi4H4dDSKvCxD3VkWgZUHJGB/VXn Clug== X-Gm-Message-State: ALKqPwcHEQ2/G2pWb/0sts8aVYcKUlYIim8gBVtwEpDuXBgnqZSWLBiQ chOJEjGKMCJc+VLIi79VKP6hpg== X-Google-Smtp-Source: AB8JxZq/i+kQl0BrIcIF/p9eB9mUj02ZpB3XcDjPrXyinteB4NAm9wGrFuGnd/Jw67oUFMxXbDrvtg== X-Received: by 2002:a6b:9204:: with SMTP id u4-v6mr18217965iod.71.1526435583265; Tue, 15 May 2018 18:53:03 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id d8-v6sm741967ioh.20.2018.05.15.18.53.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 18:53:02 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id F0C0A141521; Tue, 15 May 2018 19:53:01 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 15 May 2018 19:52:47 -0600 Message-Id: <20180516015258.187295-2-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516015258.187295-1-sjg@chromium.org> References: <20180516015258.187295-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH 01/12] binman: Allow unit addresses for binaries 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Allow the same binary to appear multiple times in an image by using the device-tree unit-address feature (u-boot@0, u-boot@1). Signed-off-by: Simon Glass --- tools/binman/README | 4 ++++ tools/binman/etype/entry.py | 5 +++++ tools/binman/ftest.py | 5 +++++ tools/binman/test/54_unit_address.dts | 13 +++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 tools/binman/test/54_unit_address.dts diff --git a/tools/binman/README b/tools/binman/README index b20098177ee..196dda1fb4c 100644 --- a/tools/binman/README +++ b/tools/binman/README @@ -387,6 +387,10 @@ end-at-4gb: Examples of the above options can be found in the tests. See the tools/binman/test directory. +It is possible to have the same binary appear multiple times in the image, +either by using a unit number suffix (u-boot@0, u-boot@1) or by using a +different name for each and specifying the type with the 'type' attribute. + Special properties ------------------ diff --git a/tools/binman/etype/entry.py b/tools/binman/etype/entry.py index c331312c491..23e436a2e9d 100644 --- a/tools/binman/etype/entry.py +++ b/tools/binman/etype/entry.py @@ -72,7 +72,12 @@ class Entry(object): """ if not etype: etype = fdt_util.GetString(node, 'type', node.name) + + # Convert something like 'u-boot@0' to 'u_boot' since we are only + # interested in the type. module_name = etype.replace('-', '_') + if '@' in module_name: + module_name = module_name.split('@')[0] module = modules.get(module_name) # Import the module if we have not already done so. diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index a3abbc4b84b..b5e8736fbb5 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -909,6 +909,11 @@ class TestFunctional(unittest.TestCase): sym_values + U_BOOT_SPL_DATA[16:]) self.assertEqual(expected, data) + def testPackUnitAddress(self): + """Test that we support multiple binaries with the same name""" + data = self._DoReadFile('54_unit_address.dts') + self.assertEqual(U_BOOT_DATA + U_BOOT_DATA, data) + if __name__ == "__main__": unittest.main() diff --git a/tools/binman/test/54_unit_address.dts b/tools/binman/test/54_unit_address.dts new file mode 100644 index 00000000000..81cb63e98f8 --- /dev/null +++ b/tools/binman/test/54_unit_address.dts @@ -0,0 +1,13 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot@0 { + }; + u-boot@1 { + }; + }; +};