From patchwork Sat Aug 13 17:40:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1666123 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=DU0L/d3F; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4nsG3L55z9sGP for ; Sun, 14 Aug 2022 03:41:22 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E51B5849E3; Sat, 13 Aug 2022 19:41:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="DU0L/d3F"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 379B8848AE; Sat, 13 Aug 2022 19:41:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D9E36848CE for ; Sat, 13 Aug 2022 19:41:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd29.google.com with SMTP id g15so3110791iob.0 for ; Sat, 13 Aug 2022 10:41:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=hyYrJnZWFhUSXEfbBv1pYhWWN4bwLn5GxjCRBekH7cg=; b=DU0L/d3FU7caZXw1OmSnQbWy8IN7FyBkgUMGipfjvURQW3WmCrJpN57C5rJ4JBT31W OA54dNSXPbctXyHiASnr1hAlqEIJ3mKiRmaOJclkw1jBOsCrHV2y2KNIacA/62T8AHnw 8EOfWLAK+y/9aXsIJ0AtzowZBVA/wtPS1YKmM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=hyYrJnZWFhUSXEfbBv1pYhWWN4bwLn5GxjCRBekH7cg=; b=cMUKQlnW8X5FbhEoVHbyyQ2XYuedMM7uOGDpTvu1kS4vvisx5bhOVsOBasoekdnkqE bc/tokuyQsKPtPytTU+2aCPiO2Zxa5EZMUzbz8gfVLxnOmRwn6jLRmXtwfQ9CChDEsId NSNHhIrFwW8g4+4R2HH3MNJzUIS7n135SZJhxNDE/3Wj27ZWL3emrVl0sfMbyEGnQbC2 kYmqhQrRq35aeAF5ZO0SmRs0L6z+HacfKMO1OW8AQQqo6VBbLzguBpZpi1yWAED4xjOu nJmATHl79xKBxupJJDhtHcNJpElgQnntIqTpj9SrwMoZlnnCB9xzCTB7JuqQIiwW6t/R vwRA== X-Gm-Message-State: ACgBeo1jBAEEd5bw5szuT1G+MM7Katu+LIUGCrj/VV/P9IPGEyZHafl0 4EzCDf8o63EflFbALwJk26q7pTHflyTcrA== X-Google-Smtp-Source: AA6agR7OcjupTWKMsQNLBCt+h37r8tjDhMB2b4866kEcl5Tu1F0rS0WU1XzB9X15EZr36EYtcYGTGQ== X-Received: by 2002:a05:6638:1310:b0:343:57e1:793b with SMTP id r16-20020a056638131000b0034357e1793bmr4179160jad.126.1660412459271; Sat, 13 Aug 2022 10:40:59 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u8-20020a02aa88000000b00339e669df91sm1224656jai.153.2022.08.13.10.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 10:40:59 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Quentin Schulz , Alper Nebi Yasak , Philippe Reynes , Marek Vasut , Simon Glass Subject: [PATCH v2 01/11] doc: Build documentation in parallel Date: Sat, 13 Aug 2022 11:40:40 -0600 Message-Id: <20220813174051.1813081-2-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220813174051.1813081-1-sjg@chromium.org> References: <20220813174051.1813081-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean With the addition of the revision stats this now takes over a minute. Use a parallel build to reduce it a bit (24 seconds for me). Series-changes; 2 - Use '-j auto' instead Signed-off-by: Simon Glass --- (no changes since v1) doc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/Makefile b/doc/Makefile index 050d9dd2391..a0680f9a376 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -57,6 +57,7 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) BUILDDIR=$(abspath $(BUILDDIR)) SPHINX_CONF=$(abspath $(srctree)/$(src)/$5/$(SPHINX_CONF)) \ $(SPHINXBUILD) \ -b $2 \ + -j auto \ -c $(abspath $(srctree)/$(src)) \ -d $(abspath $(BUILDDIR)/.doctrees/$3) \ -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) \ From patchwork Sat Aug 13 17:40:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1666124 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=N0lSYSJA; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4nsd3Md2z9sGP for ; Sun, 14 Aug 2022 03:41:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C8D80849C8; Sat, 13 Aug 2022 19:41:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="N0lSYSJA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 20F5484B44; Sat, 13 Aug 2022 19:41:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A496A8483E for ; Sat, 13 Aug 2022 19:41:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2a.google.com with SMTP id g15so3110806iob.0 for ; Sat, 13 Aug 2022 10:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=RXmKUaM9A1J2Cy5hICGOhYVUWCeJFfX+d+66DqeZxr0=; b=N0lSYSJAzXFiqf+qUV7wKcx7pWfKW5fROMlv5o1PMqphb9MU2mMfW8fyiZxDQzvOQd 5pChA24ZYcdMKBamu2r1D0WVTYhVM0sEvFXRG7omcFNLT48uJzojijQlyvCUgTeQoKcb obFnWHiGxOUiK09TCRsux0v6CaQDRYeTHcsSg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=RXmKUaM9A1J2Cy5hICGOhYVUWCeJFfX+d+66DqeZxr0=; b=3WEDXO9Id3FczprEhAw0wHlHe5juDten/M0p4Yyvqu63SUvAJKYuPLEuMoo/JSC4S5 kxazg5B1ERJdekGqAf/VWxk4TGManiwxLEz4SmD7c/97wM0fiFnVwNsdMfFs6+l2ExT6 UarWVIi7++yFsTwUKhYtac0uY2WQBxkd/sVFKN4wvBa6jtKn35MCbCnFEJwOu3JiX3hn JVOIffdf3pbJij2ADydOQ/R2mJ/rVpcuLsQm+faNrhoRIwG87XsmzV4VFeaPi4FdHeS/ WTsWxWcncWTSlx6U7mXLgStZdvbwu72UvyqyHr3Nhrm1EdNIi3ht4sOUhHslNsadU/ba H4Fg== X-Gm-Message-State: ACgBeo056/eF0sisUYs0e1b4TnoNMeqGZ8sjUBbhs1iD+XLnCrOMlWSo h8H6PrYzk43Xl2KqHT7vPERQ2TyZBOyTOw== X-Google-Smtp-Source: AA6agR5tCCtRBjVN24VoVD/5/+0B7Yx0bzUVJJM69pvvWHqwnSCQe0tXwiNtGNeiRTb3lW1myFeRoA== X-Received: by 2002:a05:6638:2728:b0:343:4b0e:8e62 with SMTP id m40-20020a056638272800b003434b0e8e62mr4098797jav.284.1660412459981; Sat, 13 Aug 2022 10:40:59 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u8-20020a02aa88000000b00339e669df91sm1224656jai.153.2022.08.13.10.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 10:40:59 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Quentin Schulz , Alper Nebi Yasak , Philippe Reynes , Marek Vasut , Simon Glass Subject: [PATCH v2 02/11] patman: Put the coverage command-line last Date: Sat, 13 Aug 2022 11:40:41 -0600 Message-Id: <20220813174051.1813081-3-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220813174051.1813081-1-sjg@chromium.org> References: <20220813174051.1813081-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Put this at the end so it is easier to copy it from the terminal. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/test_util.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py index c27e0b39e5f..7df2aec6705 100644 --- a/tools/patman/test_util.py +++ b/tools/patman/test_util.py @@ -81,8 +81,7 @@ def run_test_coverage(prog, filter_fname, exclude_list, build_dir, required=None print(coverage) if coverage != '100%': print(stdout) - print("Type 'python3-coverage html' to get a report in " - 'htmlcov/index.html') + print("To get a report in 'htmlcov/index.html', type: python3-coverage html") print('Coverage error: %s, but should be 100%%' % coverage) ok = False if not ok: From patchwork Sat Aug 13 17:40:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1666125 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Q7QXdKz2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4nsh6P21z9sGP for ; Sun, 14 Aug 2022 03:41:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EB61C849E0; Sat, 13 Aug 2022 19:41:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Q7QXdKz2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5DB5C84B49; Sat, 13 Aug 2022 19:41:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8B46D848F9 for ; Sat, 13 Aug 2022 19:41:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12a.google.com with SMTP id l9so1994450ilq.1 for ; Sat, 13 Aug 2022 10:41:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=PGbGGrthEltWCe5hRdrOz45XdOH50yUBSUBLQOGC3A8=; b=Q7QXdKz2lndFlYxSnoHF1hHohPxGpx/mSemaQGEndGEQPlaQ1p3CrdIEJHHd1UNJ2K kRdm+hmOu0avohfzIztWZJ4vCC+Bblyal22Y1nG7Y1g5M9TFJ5lbDrjBjJn1lKOmKcl5 1SjEU0ZpsMYerv5nezw3xwm879tPHUPXrm0Bs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=PGbGGrthEltWCe5hRdrOz45XdOH50yUBSUBLQOGC3A8=; b=GX4IaLOyt9iMB039Wsn34TbMhypQChGWL5x0bdr8rAuK1QMl3eHvvR0nQHpc7KExYH bxdtfIhSPgcCrKXC7yTxkjNI1sEwP3rIVCbncdwNVEer+2tlokMVT3DLuSNhxcRQy2M2 3JG01BcWesWuSlUwNTOdk5gEwS/5EbeoFuxCjoKVU2Q5PTTyXfMooFLjQkAQH5LnevQE jizikMH3vkDEPQXa6pg5fdg6ujNrNsOqAtaxX4oBBkX+3XfPhDkSf1MTLj4nMY4BILe1 lgjtWCEFCw/oLYOI4mufhJs4/Qx2Y7/p6wAXhmpY+y1ot3kU+AkHbRLhgb5maD0p5V6j Y82w== X-Gm-Message-State: ACgBeo2a8seCdPtgSKdXjf76ExAuNeOr1mT4LqXAhUx2hsLHXGHmITHx Q6Do6YO71cao/8k1N5j1eS1MwjOTq2otkQ== X-Google-Smtp-Source: AA6agR6yD1csEaufUBPUqejvRt4YP5ZPNy8CLzdJfEnozNgB814Iq7vfniuL6jFWjl0I6hNQLh9bQw== X-Received: by 2002:a92:ca47:0:b0:2de:a702:7a20 with SMTP id q7-20020a92ca47000000b002dea7027a20mr4221292ilo.307.1660412460782; Sat, 13 Aug 2022 10:41:00 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u8-20020a02aa88000000b00339e669df91sm1224656jai.153.2022.08.13.10.41.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 10:41:00 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Quentin Schulz , Alper Nebi Yasak , Philippe Reynes , Marek Vasut , Simon Glass Subject: [PATCH v2 03/11] patman: Don't buffer test output with a single test Date: Sat, 13 Aug 2022 11:40:42 -0600 Message-Id: <20220813174051.1813081-4-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220813174051.1813081-1-sjg@chromium.org> References: <20220813174051.1813081-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean When a single test is run we don't need to buffer the test output. This has the unfortunate side effect of suppressing test output, in particular the binman output directory normally printed with the -X option. This is a huge problem since it blocks debugging of tests. We don't actually know how many tests will be run when we set up the suite, so as a work-around, assume that test_name being specified indicates that there is likely only one. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/test_util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py index 7df2aec6705..0f6d1aa902d 100644 --- a/tools/patman/test_util.py +++ b/tools/patman/test_util.py @@ -208,14 +208,14 @@ def run_test_suites(toolname, debug, verbosity, test_preserve_dirs, processes, runner = unittest.TextTestRunner( stream=sys.stdout, verbosity=(1 if verbosity is None else verbosity), - buffer=buffer_outputs, + buffer=False if test_name else buffer_outputs, resultclass=FullTextTestResult, ) if use_concurrent and processes != 1: suite = ConcurrentTestSuite(suite, fork_for_tests(processes or multiprocessing.cpu_count(), - buffer=buffer_outputs)) + buffer=False if test_name else buffer_outputs)) for module in class_and_module_list: if isinstance(module, str) and (not test_name or test_name == module): From patchwork Sat Aug 13 17:40:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1666127 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=kZIntTtX; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4nt74tK3z9sGP for ; Sun, 14 Aug 2022 03:42:07 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0849D84B63; Sat, 13 Aug 2022 19:41:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="kZIntTtX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 04E4F848CD; Sat, 13 Aug 2022 19:41:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 510C88498E for ; Sat, 13 Aug 2022 19:41:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2a.google.com with SMTP id i84so3077128ioa.6 for ; Sat, 13 Aug 2022 10:41:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=jmonFKgNGvzR8peCQ6/+yT+5xCZZOjsVlJ7riENm85c=; b=kZIntTtX9C601U8QNnAV5gXTAUtUBri57seKSyGfKchnGQ8KlmHoXXOAF0P7sPA6bX k0hGTNFPqb6dFQGTvB+ZK/CqFwalglGK7j0W099G2Uxv18opcYediVuIYWDYvK6Ggsfn NujmGWp+gFiB06oJ8oZ0EzvhJtES3YO7x+/1Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=jmonFKgNGvzR8peCQ6/+yT+5xCZZOjsVlJ7riENm85c=; b=fomtMQnRabtdAekkYDxFncEGwuj+e7KbJaxYShqpVQ4j/i1gISR/BYCwllutCuL5sI zVPKilU5zQ4juUlhAxeCaM9Qhj5AhEolE0jhTBpl+Cs81xphs6AZaaO+iIzHRHnoSdXF qbNuB/51XmeZLEsKvcMpfwk1XYCJ9x+fKpfHuTMHolLKNUlw53MCHrUrK38kEuri2WKP 6e/qEU1+WA9UGpfhXyYY/cS1ZMPDSiuVQDQtqsbGFKnYkd3xIWUuIJMjnSW/9V/YtmPk kWcTGMGwsAvcvzukznoz4aZSjPOoDnZrFU/S6ts84yu/VLCCU5sbR4moGwsN73zD6D8m /spw== X-Gm-Message-State: ACgBeo0PcSSLqqSVl+9AafYTuetHMOA6F4NIveQRfUzHvSYBGT6Wcktn JWw3T2+gjctdLohbZaBUTMCNQaZxqC6QLA== X-Google-Smtp-Source: AA6agR44X9HczFzE8EXPuDppZr0eNk75cRiiu4w62BMG/CKONrtaaceXy8Z3W7cAQgrF3ydxjgoZdg== X-Received: by 2002:a02:601f:0:b0:344:c321:4d95 with SMTP id i31-20020a02601f000000b00344c3214d95mr572460jac.188.1660412461613; Sat, 13 Aug 2022 10:41:01 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u8-20020a02aa88000000b00339e669df91sm1224656jai.153.2022.08.13.10.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 10:41:01 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Quentin Schulz , Alper Nebi Yasak , Philippe Reynes , Marek Vasut , Simon Glass Subject: [PATCH v2 04/11] binman: Fix up the entry-docs for Entry_pre_load Date: Sat, 13 Aug 2022 11:40:43 -0600 Message-Id: <20220813174051.1813081-5-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220813174051.1813081-1-sjg@chromium.org> References: <20220813174051.1813081-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean This has got out of sync and needs a line wrap. Fix it. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/entries.rst | 3 ++- tools/binman/etype/pre_load.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst index ae4305c99e4..a77e61800dd 100644 --- a/tools/binman/entries.rst +++ b/tools/binman/entries.rst @@ -1159,7 +1159,8 @@ Entry: pre-load: Pre load image header -------------------------------------- Properties / Entry arguments: - - key-path: Path of the directory that store key (provided by the environment variable KEY_PATH) + - pre-load-key-path: Path of the directory that store key (provided by + the environment variable PRE_LOAD_KEY_PATH) - content: List of phandles to entries to sign - algo-name: Hash and signature algo to use for the signature - padding-name: Name of the padding (pkcs-1.5 or pss) diff --git a/tools/binman/etype/pre_load.py b/tools/binman/etype/pre_load.py index 245ee755259..b6222811592 100644 --- a/tools/binman/etype/pre_load.py +++ b/tools/binman/etype/pre_load.py @@ -37,7 +37,8 @@ class Entry_pre_load(Entry_collection): """Pre load image header Properties / Entry arguments: - - pre-load-key-path: Path of the directory that store key (provided by the environment variable PRE_LOAD_KEY_PATH) + - pre-load-key-path: Path of the directory that store key (provided by + the environment variable PRE_LOAD_KEY_PATH) - content: List of phandles to entries to sign - algo-name: Hash and signature algo to use for the signature - padding-name: Name of the padding (pkcs-1.5 or pss) From patchwork Sat Aug 13 17:40:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1666126 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=eM3zAnUG; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4nsw1rbZz9sGP for ; Sun, 14 Aug 2022 03:41:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5070984B55; Sat, 13 Aug 2022 19:41:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="eM3zAnUG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5CD0584B50; Sat, 13 Aug 2022 19:41:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1AADB8496C for ; Sat, 13 Aug 2022 19:41:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd29.google.com with SMTP id g15so3110860iob.0 for ; Sat, 13 Aug 2022 10:41:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=X4l/XI1Fmvq+EKxQV7bWOIhPbJSCIhujK7H6stkqr1Y=; b=eM3zAnUGiMvQ51Wh6Do+UHo6mJaxYMP5lKoesn4LPY9Wx8rDhkyM/0bIGIeZm0Sbq8 Wy5GggjJcyFpS1VejVI2QvFn6rkDifv/XBTU0GEKi9C8iQSPvTiJiMvaHea3RoXeOsjF RuFtupJReDQi/m2K+i989yqLJoCHu9YUtrmDI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=X4l/XI1Fmvq+EKxQV7bWOIhPbJSCIhujK7H6stkqr1Y=; b=3ae/0U8UJvMW/y9RZB1Nq7IHbCGFAjbCV9LSPg/LYD3vTul1TwpgRlSDdQjMgUaXhz kymLUDhDnXY5Th4dnv5Fn8hscKOhL0ufpmAdFDLsWjy18Ld7NcOHurYJz6Y1WXo5LWdq lvu0EuCVkvX9A5b66Gn4k3925sUHxhhRXiosJWGiSnMi0e+Wgj80Wp1xsbg6NtWJmCiI N+2oAWHZ5ANzQQ90bVoABuhiEX8ilAGTggcb/6ff/wAT26cOcER96i9pIj7eRXdfPaeH yWR/4F2BPBvONqCqAU7/4xCKfjx+cJZbUnmmLFmj7T07ZByqNZnrUOewrHt6gyi3cffk VvHA== X-Gm-Message-State: ACgBeo0h/1Fxj8UKqp356bj6nN/bCr1yv97qqHoJRJEqcKEehtJYvB6c MU1FtZ/+s9xDFJoLTAtulOsUDyg2cZ4JeQ== X-Google-Smtp-Source: AA6agR6ODVi+K80NltVzYIazC0Xo0FpwEsUnhO57OW4uBOkEWY5iKdx6ripT4g7ZmJQB1JCF4C6Qqg== X-Received: by 2002:a05:6638:3791:b0:342:a327:798b with SMTP id w17-20020a056638379100b00342a327798bmr4189500jal.102.1660412462475; Sat, 13 Aug 2022 10:41:02 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u8-20020a02aa88000000b00339e669df91sm1224656jai.153.2022.08.13.10.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 10:41:02 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Quentin Schulz , Alper Nebi Yasak , Philippe Reynes , Marek Vasut , Simon Glass Subject: [PATCH v2 05/11] binman: Add a way to check for missing properties Date: Sat, 13 Aug 2022 11:40:44 -0600 Message-Id: <20220813174051.1813081-6-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220813174051.1813081-1-sjg@chromium.org> References: <20220813174051.1813081-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Some new entries are likely to have required properties. Support this in a standard way, with a list of required properties which can be set up by base classes. Check for missing properties when the entry is read. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: - Use a dict to hold required properties tools/binman/entry.py | 20 ++++++++++++++++++++ tools/binman/etype/fill.py | 3 +-- tools/binman/ftest.py | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 41f0eb58ae0..5424a0e6e32 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -84,6 +84,8 @@ class Entry(object): update_hash: True if this entry's "hash" subnode should be updated with a hash of the entry contents fake_fname: Fake filename, if one was created, else None + required_props (dict of str): Properties which must be present. This can + be added to by subclasses """ fake_dir = None @@ -121,6 +123,7 @@ class Entry(object): self.missing_bintools = [] self.update_hash = True self.fake_fname = None + self.required_props = [] @staticmethod def FindEntryClass(etype, expanded): @@ -238,6 +241,7 @@ class Entry(object): This reads all the fields we recognise from the node, ready for use. """ + self.ensure_props() if 'pos' in self._node.props: self.Raise("Please use 'offset' instead of 'pos'") if 'expand-size' in self._node.props: @@ -1179,3 +1183,19 @@ features to produce new behaviours. if not os.path.exists(cls.fake_dir): os.mkdir(cls.fake_dir) tout.notice(f"Fake-blob dir is '{cls.fake_dir}'") + + def ensure_props(self): + """Raise an exception if properties are missing + + Args: + prop_list (list of str): List of properties to check for + + Raises: + ValueError: Any property is missing + """ + not_present = [] + for prop in self.required_props: + if not prop in self._node.props: + not_present.append(prop) + if not_present: + self.Raise(f"'{self.etype}' entry is missing properties: {' '.join(not_present)}") diff --git a/tools/binman/etype/fill.py b/tools/binman/etype/fill.py index cd382799199..c91d0152a8a 100644 --- a/tools/binman/etype/fill.py +++ b/tools/binman/etype/fill.py @@ -23,11 +23,10 @@ class Entry_fill(Entry): """ def __init__(self, section, etype, node): super().__init__(section, etype, node) + self.required_props = ['size'] def ReadNode(self): super().ReadNode() - if self.size is None: - self.Raise("'fill' entry must have a size property") self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0) def ObtainContents(self): diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index c8bab5c9416..4f696c68600 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -1693,7 +1693,7 @@ class TestFunctional(unittest.TestCase): """Test for an fill entry type with no size""" with self.assertRaises(ValueError) as e: self._DoReadFile('070_fill_no_size.dts') - self.assertIn("'fill' entry must have a size property", + self.assertIn("'fill' entry is missing properties: size", str(e.exception)) def _HandleGbbCommand(self, pipe_list): From patchwork Sat Aug 13 17:40:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1666131 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=HqPfp0Nv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4nv21slRz9sGP for ; Sun, 14 Aug 2022 03:42:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 21E4084B75; Sat, 13 Aug 2022 19:41:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="HqPfp0Nv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 87D3E84B5C; Sat, 13 Aug 2022 19:41:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E434D849CF for ; Sat, 13 Aug 2022 19:41:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x131.google.com with SMTP id d4so1987998ilc.8 for ; Sat, 13 Aug 2022 10:41:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=FhsDiFvXU34NC5TZlamu4Vh77xlLFVNI0vG8XMJuRpw=; b=HqPfp0NvryUgUtGQJPef1EDHKYlHx7ib0Pir96aaVQFV4QSHi5P4sGhGIKBpVb80x2 1OKy9SaeklMWnJ/TQXOkj3PR4zfLQLqh7LNKl5NOkLq2Q76I3GpcMaVBxQ6vsxbqYiS0 26P7v0ZCeHpWE4kRF8GQIzqB9+FNEEOOBV+yw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=FhsDiFvXU34NC5TZlamu4Vh77xlLFVNI0vG8XMJuRpw=; b=loj+ZWRgDj94TLPNdsgmn7IqJyvohbeRP0+FZNzAKIrWv57LeUMSgGkMWHvEmHNI4g MDvDOWxiFyJsDHmIlpqTV79nx9SnZeytWHS7LqgyiUfqLL3Ws7yu+gA4wKrdf6i9Rc0L 9NKpGTFLuGBw0JkuCaMgD2RGVl+WcAfYhfUdwTm3g2Mc1yqhsSlvoNifkBnmiOY2hl+c xtcwdxMkm5OjA/C4HhC2I1UyZwsScFH8OMFBXaWswRjvtlzYcFAVfRXykT2AccuLLlOG Li5r4sGHTOmp/s3/PU9f/aY8EzWo7K4ZebC6FQ179cHVlex63aeBAaG+yHIZ2c0p9pJx yBIg== X-Gm-Message-State: ACgBeo3hM/R8LqtdNTvCAPDpBHmfPC+Jyl8zjV5hrdVb7LTA74B6Gy/4 pRGVq2hKtrybl5fnGD7ioHC8NUCrj78/lw== X-Google-Smtp-Source: AA6agR5cvQnx+klZ4QmogmzgfmPNxelAdzmD9teskz7xqus4o4kDAW1uz9h6ahdaE0/RLfQMS9yiiA== X-Received: by 2002:a05:6e02:1583:b0:2d7:a75d:888f with SMTP id m3-20020a056e02158300b002d7a75d888fmr3873572ilu.13.1660412463290; Sat, 13 Aug 2022 10:41:03 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u8-20020a02aa88000000b00339e669df91sm1224656jai.153.2022.08.13.10.41.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 10:41:03 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Quentin Schulz , Alper Nebi Yasak , Philippe Reynes , Marek Vasut , Simon Glass , Heiko Thiery Subject: [PATCH v2 06/11] binman: Adjust mkimage etype node reading Date: Sat, 13 Aug 2022 11:40:45 -0600 Message-Id: <20220813174051.1813081-7-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220813174051.1813081-1-sjg@chromium.org> References: <20220813174051.1813081-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Since this is implemented as a section, it should really be split into several functions, one to read the node and one to read the entries. Do this so that it matches how Entry_section works. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/etype/mkimage.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py index 5f6def2287f..f3b3df6fe04 100644 --- a/tools/binman/etype/mkimage.py +++ b/tools/binman/etype/mkimage.py @@ -45,11 +45,21 @@ class Entry_mkimage(Entry): """ def __init__(self, section, etype, node): super().__init__(section, etype, node) - self._args = fdt_util.GetArgs(self._node, 'args') self._mkimage_entries = OrderedDict() self.align_default = None + + def ReadNode(self): + super().ReadNode() + self._args = fdt_util.GetArgs(self._node, 'args') self.ReadEntries() + def ReadEntries(self): + """Read the subnodes to find out what should go in this image""" + for node in self._node.subnodes: + entry = Entry.Create(self, node) + entry.ReadNode() + self._mkimage_entries[entry.name] = entry + def ObtainContents(self): # Use a non-zero size for any fake files to keep mkimage happy data, input_fname, uniq = self.collect_contents_to_file( @@ -67,13 +77,6 @@ class Entry_mkimage(Entry): return True - def ReadEntries(self): - """Read the subnodes to find out what should go in this image""" - for node in self._node.subnodes: - entry = Entry.Create(self, node) - entry.ReadNode() - self._mkimage_entries[entry.name] = entry - def SetAllowMissing(self, allow_missing): """Set whether a section allows missing external blobs From patchwork Sat Aug 13 17:40:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1666128 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=PsZqN4lq; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4ntM51jrz9sGP for ; Sun, 14 Aug 2022 03:42:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B4B798496C; Sat, 13 Aug 2022 19:41:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="PsZqN4lq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D1804848EC; Sat, 13 Aug 2022 19:41:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C271B84847 for ; Sat, 13 Aug 2022 19:41:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2c.google.com with SMTP id b142so183368iof.10 for ; Sat, 13 Aug 2022 10:41:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=RFNV5/Kfty/Md8wr5njJ59Xu3orsXrAJ81pxFR0wvmQ=; b=PsZqN4lqMC5aSTiRyT2PvvI9h6UgcIy0SgbBrSlqJW4rfcaisNbCDa6Pyl8aTR6SAT U7eJWVZQy7hurgtwJp4FNVdfjjbaldrGHEVO6fBWtMWQhtXYDZZDQl+x9CMHivCcLACI ep6ZWlKlzFfKUvg5QyAwriAx8/nmDsHqJIrQ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=RFNV5/Kfty/Md8wr5njJ59Xu3orsXrAJ81pxFR0wvmQ=; b=0l458zCx4V7rJ+Q+ctD2uUwzU7fvN1beAHrcEE11rfjN447EkCd1dDxS7TnoSKxR52 RObactK8C+Hr69YR7TL8ksTCXnyc6q2LnT5gAmq68LByqfFpDcpuCBFKlcs0O3arFy4P Lclv9ZhHs/IR3W0zx+6ulay7mBuOxiZWJiyYoi0klHfupBPu0Gq9kqcRjIBaazg7d23S i+5XYHTat/cES10v3zAJuzSNyNf5V0BC1WqqV5ufYT6G6alWyj+Eypsov4tFnISRMxaX 7htWNLXt6SLg2h0qtFzJvHG5nM1WTgs1/0HcO2pFRRPw6nEopWdu1N7GAm3qPCdUupgu KBZQ== X-Gm-Message-State: ACgBeo04CLSR7rMUwtyhpKOoBl1Vt7qre1PN80/gye9rHT2yMRMGATIr nBkWMh4AF4iUJfxbeqWpkNAtNUbzC/9cRw== X-Google-Smtp-Source: AA6agR5TY+fh86WZqKcKq3voQzGYsZvUVd6W3IPmznz5rN1nZkSCEYU5qzN44jdNgZIDWmPf+WJVoQ== X-Received: by 2002:a05:6638:3450:b0:343:3c23:ec7e with SMTP id q16-20020a056638345000b003433c23ec7emr4251302jav.67.1660412464127; Sat, 13 Aug 2022 10:41:04 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u8-20020a02aa88000000b00339e669df91sm1224656jai.153.2022.08.13.10.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 10:41:03 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Quentin Schulz , Alper Nebi Yasak , Philippe Reynes , Marek Vasut , Simon Glass Subject: [PATCH v2 07/11] binman: Avoid use of expected failure Date: Sat, 13 Aug 2022 11:40:46 -0600 Message-Id: <20220813174051.1813081-8-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220813174051.1813081-1-sjg@chromium.org> References: <20220813174051.1813081-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean The testReplaceSectionSimple() test is the only one which expects failure. It looks odd in the output and takes time to glance at it to see that all is in fact well. Also it does not check that the right exception is generated. Use the more common (in binman) approach of checking for an exception. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/ftest.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 4f696c68600..ac54183c399 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -5712,14 +5712,15 @@ fdt fdtmap Extract the devicetree blob from the fdtmap self.assertIsNotNone(path) self.assertEqual(expected_fdtmap, fdtmap) - @unittest.expectedFailure def testReplaceSectionSimple(self): """Test replacing a simple section with arbitrary data""" new_data = b'w' * len(COMPRESS_DATA + U_BOOT_DATA) - data, expected_fdtmap, _ = self._RunReplaceCmd( - 'section', new_data, - dts='234_replace_section_simple.dts') - self.assertEqual(new_data, data) + with self.assertRaises(ValueError) as exc: + self._RunReplaceCmd('section', new_data, + dts='234_replace_section_simple.dts') + self.assertIn( + "Node '/section': Replacing sections is not implemented yet", + str(exc.exception)) if __name__ == "__main__": From patchwork Sat Aug 13 17:40:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1666130 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=VGrVbIth; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4ntp5mRnz9sGP for ; Sun, 14 Aug 2022 03:42:42 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 149F084B65; Sat, 13 Aug 2022 19:41:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="VGrVbIth"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 17C12848F9; Sat, 13 Aug 2022 19:41:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B8B1584B52 for ; Sat, 13 Aug 2022 19:41:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd36.google.com with SMTP id h138so3066877iof.12 for ; Sat, 13 Aug 2022 10:41:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=nvvADehl1HyqhMbQFJdbHC1b8Xd8GDCBUmXwERfcNq8=; b=VGrVbIthnVPhI3BlzdF8AkHZ2G6eckUMw/+c448W9rLXitsQv7tIZ5rWWzn+PCA55R z6n+o+QoMOg8jARoFrWsh3FpEmziMP8+7wOkAGDFXJ2p3x23kV9YLeAnrYpw7KX6pY/y Ww6E6jH3k4QJeJ+OK3Clq1gjg5cMS4AG8lMPw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=nvvADehl1HyqhMbQFJdbHC1b8Xd8GDCBUmXwERfcNq8=; b=YXCYBT++X62+8j7SY0fA6rWYcO4/XfUvq7rhBYpfuFXmW6/wHsoIdadXzZISl+t2lZ fgRlho/CT6Fqm+TL0x8L8fEb9sTialIgJIJWSXJ24uZW+C6LP5XD1uhiw4hldy3ntlEM yQpoc+NuWQLN7PGFIEeCc1GvhLIM5egskeVaXDxgP92V7GjX5fFvSnApnwNW7vmsie92 0YQOjDKn1xFfH5QeROECzoHa+q8TTNoEVAZBZEZb4BjntpJgpFrUCn+e/bBQO3tSSx3e M3Stusg4i81YQhgqcv+NJILGO1xtuAlDziKytAs3XjBMFLf2w2eyhxEzEgzPmGX8GguG qZOw== X-Gm-Message-State: ACgBeo1j+li4hLcQhDXSiY+H6JOPUjxrq52ENBA6M4HFWsATd9iFQqi/ +VvmwVspQ0pXxwEsH+FfcqL9BWvcWp+vPQ== X-Google-Smtp-Source: AA6agR490bvCi4y7PpdTlE7Swq6+FJqr4oXEUxhi8YdxGmpjNWr68PfyrJXb8EbaRvI1k+yVQ1xjCQ== X-Received: by 2002:a02:b799:0:b0:343:390a:4f66 with SMTP id f25-20020a02b799000000b00343390a4f66mr3872498jam.222.1660412464979; Sat, 13 Aug 2022 10:41:04 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u8-20020a02aa88000000b00339e669df91sm1224656jai.153.2022.08.13.10.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 10:41:04 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Quentin Schulz , Alper Nebi Yasak , Philippe Reynes , Marek Vasut , Simon Glass , Heiko Thiery Subject: [PATCH v2 08/11] binman: Improve mkimage documentation Date: Sat, 13 Aug 2022 11:40:47 -0600 Message-Id: <20220813174051.1813081-9-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220813174051.1813081-1-sjg@chromium.org> References: <20220813174051.1813081-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Expand this a little to make things clearer. Also drop the invalid entry arg. Series-changes 2 - Make it clear that -d data is concatenated/collected by binman - Fix mulitple typoe - Reword a sentence for grammar Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/entries.rst | 28 +++++++++++++++++++++------- tools/binman/etype/mkimage.py | 31 ++++++++++++++++++++++++------- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst index a77e61800dd..8d7cbdc2e75 100644 --- a/tools/binman/entries.rst +++ b/tools/binman/entries.rst @@ -1100,11 +1100,10 @@ Entry: mkimage: Binary produced by mkimage ------------------------------------------ Properties / Entry arguments: - - datafile: Filename for -d argument - - args: Other arguments to pass + - args: Arguments to pass -The data passed to mkimage is collected from subnodes of the mkimage node, -e.g.:: +The data passed to mkimage via the -d flag is collected from subnodes of the +mkimage node, e.g.:: mkimage { args = "-n test -T imximage"; @@ -1113,9 +1112,24 @@ e.g.:: }; }; -This calls mkimage to create an imximage with u-boot-spl.bin as the input -file. The output from mkimage then becomes part of the image produced by -binman. +This calls mkimage to create an imximage with `u-boot-spl.bin` as the data +file, which mkimage being called like this:: + + mkimage -d -n test -T imximage + +The output from mkimage then becomes part of the image produced by +binman. If you need to put mulitple things in the data file, you can use +a section, or just multiple subnodes like this:: + + mkimage { + args = "-n test -T imximage"; + + u-boot-spl { + }; + + u-boot-tpl { + }; + }; To use CONFIG options in the arguments, use a string list instead, as in this example which also produces four arguments:: diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py index f3b3df6fe04..a5d94da6a91 100644 --- a/tools/binman/etype/mkimage.py +++ b/tools/binman/etype/mkimage.py @@ -15,11 +15,10 @@ class Entry_mkimage(Entry): """Binary produced by mkimage Properties / Entry arguments: - - datafile: Filename for -d argument - - args: Other arguments to pass + - args: Arguments to pass - The data passed to mkimage is collected from subnodes of the mkimage node, - e.g.:: + The data passed to mkimage via the -d flag is collected from subnodes of the + mkimage node, e.g.:: mkimage { args = "-n test -T imximage"; @@ -28,9 +27,27 @@ class Entry_mkimage(Entry): }; }; - This calls mkimage to create an imximage with u-boot-spl.bin as the input - file. The output from mkimage then becomes part of the image produced by - binman. + This calls mkimage to create an imximage with `u-boot-spl.bin` as the data + file, with mkimage being called like this:: + + mkimage -d -n test -T imximage + + The output from mkimage then becomes part of the image produced by + binman. If you need to put multiple things in the data file, you can use + a section, or just multiple subnodes like this:: + + mkimage { + args = "-n test -T imximage"; + + u-boot-spl { + }; + + u-boot-tpl { + }; + }; + + Note that binman places the contents (here SPL and TPL) into a single file + and passes that to mkimage using the -d option. To use CONFIG options in the arguments, use a string list instead, as in this example which also produces four arguments:: From patchwork Sat Aug 13 17:40:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1666129 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=JHct3C+x; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4ntb1bXTz9sGP for ; Sun, 14 Aug 2022 03:42:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C027E84B4D; Sat, 13 Aug 2022 19:41:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="JHct3C+x"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7A7E884B5C; Sat, 13 Aug 2022 19:41:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 69A91848F9 for ; Sat, 13 Aug 2022 19:41:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2c.google.com with SMTP id b142so183406iof.10 for ; Sat, 13 Aug 2022 10:41:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=/VzXH4lMMoguk7yh13O6r15fM3psdcSIsSYlBORtsG0=; b=JHct3C+x3sXPl2qvxyWGObmYUTbcorWtLcdWTU9wgR7BJ7XgTvUnLsThpV5DsH8pW4 /dSNUNd+7p/JWXpw2Ojem/7FgkbKzsUNDdI50O22HBkDOjYcp+bsUHCRCPixF95CEDsY N034TMYwey5x/N7VkdiCL9i3OvpHNbAcewZXc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=/VzXH4lMMoguk7yh13O6r15fM3psdcSIsSYlBORtsG0=; b=ad2yCQ3TwZGs4axQ+/k+fzUEaHqopFYx5ObNlsLqxdsvxdeYG9oGJtnY5nwkzAQYw1 ULG0RHX+e39j2BJ5WBbKAKl+Z6W+AS58/w1GFyNOPGi9HWk1FAVkOl/mZPH+y+kyE8WX YCBnXpKAT62Yu3qd/rojwT4YYFb4Z8z+EEhro0cfQlZsWaha+35XQY5yNpiA0yf+uB/c TdwqLrAtv5+XsKLpem3To/AvSd4DSShlH0J5NcwpOSMq/fDiOin+2OC459Vf71iknRfo S/EA2Nq8h6J9PArcUyk4BaSQr3MXEmew2ENmoHK3XMydu9qPvcTcdU5+QP+1hEK4g1wy U/jw== X-Gm-Message-State: ACgBeo3k2pxIAvRM29Yyk99nMTpMrhLQ2dL7BMDhaC5HZoM8fF8ixaPS NSUeBuz2pY6GFruXpOk7dWzKPW5OaIIeIA== X-Google-Smtp-Source: AA6agR7Bq9z29RbLdtLkmEb/cZBNXt1cihx4/Dogg76EDw9PQW4Gzqbqmyc8k0FfsI31A2DtIz9yBA== X-Received: by 2002:a05:6638:d93:b0:341:5cab:4d9 with SMTP id l19-20020a0566380d9300b003415cab04d9mr4224921jaj.146.1660412465807; Sat, 13 Aug 2022 10:41:05 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u8-20020a02aa88000000b00339e669df91sm1224656jai.153.2022.08.13.10.41.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 10:41:05 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Quentin Schulz , Alper Nebi Yasak , Philippe Reynes , Marek Vasut , Simon Glass , Heiko Thiery Subject: [PATCH v2 09/11] binman: Allow the image name to be the data file Date: Sat, 13 Aug 2022 11:40:48 -0600 Message-Id: <20220813174051.1813081-10-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220813174051.1813081-1-sjg@chromium.org> References: <20220813174051.1813081-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Some image types use the -n parameter to pass in the data file. Add support for this, with a new property. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: - Drop spurious quote - Reword explanation of what is passed with -d and -n tools/binman/entries.rst | 15 ++++++++++++++ tools/binman/etype/mkimage.py | 27 ++++++++++++++++++++++++-- tools/binman/ftest.py | 17 ++++++++++++++++ tools/binman/test/235_mkimage_name.dts | 18 +++++++++++++++++ 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 tools/binman/test/235_mkimage_name.dts diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst index 8d7cbdc2e75..1d38c513ffa 100644 --- a/tools/binman/entries.rst +++ b/tools/binman/entries.rst @@ -1101,6 +1101,8 @@ Entry: mkimage: Binary produced by mkimage Properties / Entry arguments: - args: Arguments to pass + - data-to-imagename: Indicates that the -d data should be passed in as + the image name also (-n) The data passed to mkimage via the -d flag is collected from subnodes of the mkimage node, e.g.:: @@ -1141,6 +1143,19 @@ this example which also produces four arguments:: }; }; +If you need to pass the input data in with the -n argument as well, then use +the 'data-to-imagename' property:: + + mkimage { + args = "-T imximage"; + data-to-imagename'; + + u-boot-spl { + }; + }; + +That will pass the data to mkimage both as the data file (with -d) and as +the image name (with -n). diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py index a5d94da6a91..53622546dc0 100644 --- a/tools/binman/etype/mkimage.py +++ b/tools/binman/etype/mkimage.py @@ -16,6 +16,8 @@ class Entry_mkimage(Entry): Properties / Entry arguments: - args: Arguments to pass + - data-to-imagename: Indicates that the -d data should be passed in as + the image name also (-n) The data passed to mkimage via the -d flag is collected from subnodes of the mkimage node, e.g.:: @@ -59,6 +61,20 @@ class Entry_mkimage(Entry): }; }; + If you need to pass the input data in with the -n argument as well, then use + the 'data-to-imagename' property:: + + mkimage { + args = "-T imximage"; + data-to-imagename; + + u-boot-spl { + }; + }; + + That will pass the data to mkimage both as the data file (with -d) and as + the image name (with -n). In both cases, a filename is passed as the + argument, with the actual data being in that file. """ def __init__(self, section, etype, node): super().__init__(section, etype, node) @@ -68,6 +84,8 @@ class Entry_mkimage(Entry): def ReadNode(self): super().ReadNode() self._args = fdt_util.GetArgs(self._node, 'args') + self._data_to_imagename = fdt_util.GetBool(self._node, + 'data-to-imagename') self.ReadEntries() def ReadEntries(self): @@ -79,13 +97,18 @@ class Entry_mkimage(Entry): def ObtainContents(self): # Use a non-zero size for any fake files to keep mkimage happy + # Note that testMkimageImagename() relies on this 'mkimage' parameter data, input_fname, uniq = self.collect_contents_to_file( self._mkimage_entries.values(), 'mkimage', 1024) if data is None: return False output_fname = tools.get_output_filename('mkimage-out.%s' % uniq) - if self.mkimage.run_cmd('-d', input_fname, *self._args, - output_fname) is not None: + + args = ['-d', input_fname] + if self._data_to_imagename: + args += ['-n', input_fname] + args += self._args + [output_fname] + if self.mkimage.run_cmd(*args) is not None: self.SetContents(tools.read_file(output_fname)) else: # Bintool is missing; just use the input data as the output diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index ac54183c399..e88eedff51b 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -5722,6 +5722,23 @@ fdt fdtmap Extract the devicetree blob from the fdtmap "Node '/section': Replacing sections is not implemented yet", str(exc.exception)) + def testMkimageImagename(self): + """Test using mkimage with -n holding the data too""" + data = self._DoReadFile('235_mkimage_name.dts') + + # Check that the data appears in the file somewhere + self.assertIn(U_BOOT_SPL_DATA, data) + + # Get struct image_header -> ih_name + name = data[0x20:0x40] + + # Build the filename that we expect to be placed in there, by virtue of + # the -n paraameter + expect = os.path.join(tools.get_output_dir(), 'mkimage.mkimage') + + # Check that the image name is set to the temporary filename used + self.assertEqual(expect.encode('utf-8')[:0x20], name) + if __name__ == "__main__": unittest.main() diff --git a/tools/binman/test/235_mkimage_name.dts b/tools/binman/test/235_mkimage_name.dts new file mode 100644 index 00000000000..fbc82f1f8d6 --- /dev/null +++ b/tools/binman/test/235_mkimage_name.dts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + mkimage { + args = "-T script"; + data-to-imagename; + + u-boot-spl { + }; + }; + }; +}; From patchwork Sat Aug 13 17:40:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1666133 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=bnEPzFpU; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4nvW0nJMz9sGP for ; Sun, 14 Aug 2022 03:43:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5EB6984B70; Sat, 13 Aug 2022 19:41:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bnEPzFpU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 59B2384B62; Sat, 13 Aug 2022 19:41:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 815BB849C6 for ; Sat, 13 Aug 2022 19:41:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12c.google.com with SMTP id c5so1995753ilh.3 for ; Sat, 13 Aug 2022 10:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=6LH3GxtlCh9So0HvzZsxdhqfHgyZRUFarb2db7tIYz8=; b=bnEPzFpUDdfIEjjE9IB06AlE5ljCZzSM+6ShnfzMcMSnXbP7OXpw5coaRVirJtO2hv O6G4UGHZ2OCePq0RqHwj64g5l6CmFHgNAZo1BJUIF+VxR1SIRu3xPZRR9Urv67wGk/ZO S0QgwyQcluUK9PDImBoPOz1fIZOYgwf97F4rE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=6LH3GxtlCh9So0HvzZsxdhqfHgyZRUFarb2db7tIYz8=; b=wsbNPXT4v0IQoW7kih16wwrvO3+eillZkrmh/NFJbKNkCIPqfdYw9ejJLt3e6kZbTK QOFLtJo5PCpgw2nrI4/nTcMQNxAHbJMdGNAPRmYkdqaLMsQo1wV8sLYvMLtEppAE4HEP NVDPTK7dteKYqkS0hZVWF7eIlaZSiynbbJQJTU1D3/bMmrUEU05mraohBkbq1DDrcsTi VhU8TD7Of+qZmT2reD8CDRa2BMgQ5qaCMWmi8J6bOnlFQW8HuCeBN6+t2DM1LzdS0ZsJ UuTMfPSOvXI+UVGlAlMRSKr+J7n0xXtcOEZhhAPsEjWMt5uJBIq9xvUPXeHsbZTDIn3u gEwg== X-Gm-Message-State: ACgBeo3V9+vrWYZkHF0cnXDz2MR2Vz8Yx1Vphlrl6KUGTJg+151UoN0D ohvgVf9+PNZlJZIJHBr/yFt19hLyoAranA== X-Google-Smtp-Source: AA6agR5pZmNkMsEYarHm2V1gVfrmMUfPeuIELd4xuIg4/ulhDZ9cZFwftsiPvVJgsZbQSN53Phd0sQ== X-Received: by 2002:a05:6e02:188c:b0:2e0:f18f:d1a9 with SMTP id o12-20020a056e02188c00b002e0f18fd1a9mr3851161ilu.177.1660412466702; Sat, 13 Aug 2022 10:41:06 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u8-20020a02aa88000000b00339e669df91sm1224656jai.153.2022.08.13.10.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 10:41:06 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Quentin Schulz , Alper Nebi Yasak , Philippe Reynes , Marek Vasut , Simon Glass , Heiko Thiery Subject: [PATCH v2 10/11] binman: Allow passing entries using -n Date: Sat, 13 Aug 2022 11:40:49 -0600 Message-Id: <20220813174051.1813081-11-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220813174051.1813081-1-sjg@chromium.org> References: <20220813174051.1813081-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Also control over what goes in the file passed with -n using a separate imagename subnode. This can include a section or any other entry type. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/entries.rst | 18 +++++++++ tools/binman/etype/mkimage.py | 39 ++++++++++++++++++- tools/binman/ftest.py | 34 ++++++++++++++++ tools/binman/test/236_mkimage_image.dts | 21 ++++++++++ .../test/237_mkimage_image_no_content.dts | 22 +++++++++++ tools/binman/test/238_mkimage_image_bad.dts | 22 +++++++++++ 6 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 tools/binman/test/236_mkimage_image.dts create mode 100644 tools/binman/test/237_mkimage_image_no_content.dts create mode 100644 tools/binman/test/238_mkimage_image_bad.dts diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst index 1d38c513ffa..682159ac6d3 100644 --- a/tools/binman/entries.rst +++ b/tools/binman/entries.rst @@ -1157,6 +1157,24 @@ the 'data-to-imagename' property:: That will pass the data to mkimage both as the data file (with -d) and as the image name (with -n). +If need to pass different data in with -n, then use an imagename subnode:: + + mkimage { + args = "-T imximage"; + + imagename { + blob { + filename = "spl/u-boot-spl.cfgout" + }; + }; + + u-boot-spl { + }; + }; + +This will pass in u-boot-spl as the input data and the .cfgout file as the +-n data. + Entry: opensbi: RISC-V OpenSBI fw_dynamic blob diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py index 53622546dc0..437fcdacfd7 100644 --- a/tools/binman/etype/mkimage.py +++ b/tools/binman/etype/mkimage.py @@ -75,10 +75,29 @@ class Entry_mkimage(Entry): That will pass the data to mkimage both as the data file (with -d) and as the image name (with -n). In both cases, a filename is passed as the argument, with the actual data being in that file. + + If need to pass different data in with -n, then use an `imagename` subnode:: + + mkimage { + args = "-T imximage"; + + imagename { + blob { + filename = "spl/u-boot-spl.cfgout" + }; + }; + + u-boot-spl { + }; + }; + + This will pass in u-boot-spl as the input data and the .cfgout file as the + -n data. """ def __init__(self, section, etype, node): super().__init__(section, etype, node) self._mkimage_entries = OrderedDict() + self._imagename = None self.align_default = None def ReadNode(self): @@ -86,6 +105,8 @@ class Entry_mkimage(Entry): self._args = fdt_util.GetArgs(self._node, 'args') self._data_to_imagename = fdt_util.GetBool(self._node, 'data-to-imagename') + if self._data_to_imagename and self._node.FindNode('imagename'): + self.Raise('Cannot use both imagename node and data-to-imagename') self.ReadEntries() def ReadEntries(self): @@ -93,7 +114,10 @@ class Entry_mkimage(Entry): for node in self._node.subnodes: entry = Entry.Create(self, node) entry.ReadNode() - self._mkimage_entries[entry.name] = entry + if entry.name == 'imagename': + self._imagename = entry + else: + self._mkimage_entries[entry.name] = entry def ObtainContents(self): # Use a non-zero size for any fake files to keep mkimage happy @@ -102,11 +126,18 @@ class Entry_mkimage(Entry): self._mkimage_entries.values(), 'mkimage', 1024) if data is None: return False + if self._imagename: + image_data, imagename_fname, _ = self.collect_contents_to_file( + [self._imagename], 'mkimage-n', 1024) + if image_data is None: + return False output_fname = tools.get_output_filename('mkimage-out.%s' % uniq) args = ['-d', input_fname] if self._data_to_imagename: args += ['-n', input_fname] + elif self._imagename: + args += ['-n', imagename_fname] args += self._args + [output_fname] if self.mkimage.run_cmd(*args) is not None: self.SetContents(tools.read_file(output_fname)) @@ -126,6 +157,8 @@ class Entry_mkimage(Entry): self.allow_missing = allow_missing for entry in self._mkimage_entries.values(): entry.SetAllowMissing(allow_missing) + if self._imagename: + self._imagename.SetAllowMissing(allow_missing) def SetAllowFakeBlob(self, allow_fake): """Set whether the sub nodes allows to create a fake blob @@ -135,6 +168,8 @@ class Entry_mkimage(Entry): """ for entry in self._mkimage_entries.values(): entry.SetAllowFakeBlob(allow_fake) + if self._imagename: + self._imagename.SetAllowFakeBlob(allow_fake) def CheckFakedBlobs(self, faked_blobs_list): """Check if any entries in this section have faked external blobs @@ -146,6 +181,8 @@ class Entry_mkimage(Entry): """ for entry in self._mkimage_entries.values(): entry.CheckFakedBlobs(faked_blobs_list) + if self._imagename: + self._imagename.CheckFakedBlobs(faked_blobs_list) def AddBintools(self, btools): self.mkimage = self.AddBintool(btools, 'mkimage') diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index e88eedff51b..9b10fd8698d 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -5739,6 +5739,40 @@ fdt fdtmap Extract the devicetree blob from the fdtmap # Check that the image name is set to the temporary filename used self.assertEqual(expect.encode('utf-8')[:0x20], name) + def testMkimageImage(self): + """Test using mkimage with -n holding the data too""" + data = self._DoReadFile('236_mkimage_image.dts') + + # Check that the data appears in the file somewhere + self.assertIn(U_BOOT_SPL_DATA, data) + + # Get struct image_header -> ih_name + name = data[0x20:0x40] + + # Build the filename that we expect to be placed in there, by virtue of + # the -n paraameter + expect = os.path.join(tools.get_output_dir(), 'mkimage-n.mkimage') + + # Check that the image name is set to the temporary filename used + self.assertEqual(expect.encode('utf-8')[:0x20], name) + + # Check the corect data is in the imagename file + self.assertEqual(U_BOOT_DATA, tools.read_file(expect)) + + def testMkimageImageNoContent(self): + """Test using mkimage with -n and no data""" + with self.assertRaises(ValueError) as exc: + self._DoReadFile('237_mkimage_image_no_content.dts') + self.assertIn('Could not complete processing of contents', + str(exc.exception)) + + def testMkimageImageBad(self): + """Test using mkimage with imagename node and data-to-imagename""" + with self.assertRaises(ValueError) as exc: + self._DoReadFile('238_mkimage_image_bad.dts') + self.assertIn('Cannot use both imagename node and data-to-imagename', + str(exc.exception)) + if __name__ == "__main__": unittest.main() diff --git a/tools/binman/test/236_mkimage_image.dts b/tools/binman/test/236_mkimage_image.dts new file mode 100644 index 00000000000..6b8f4a4a401 --- /dev/null +++ b/tools/binman/test/236_mkimage_image.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + mkimage { + args = "-T script"; + + imagename { + type = "u-boot"; + }; + + u-boot-spl { + }; + }; + }; +}; diff --git a/tools/binman/test/237_mkimage_image_no_content.dts b/tools/binman/test/237_mkimage_image_no_content.dts new file mode 100644 index 00000000000..7306c06af45 --- /dev/null +++ b/tools/binman/test/237_mkimage_image_no_content.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + mkimage { + args = "-T script"; + + imagename { + type = "_testing"; + return-unknown-contents; + }; + + u-boot-spl { + }; + }; + }; +}; diff --git a/tools/binman/test/238_mkimage_image_bad.dts b/tools/binman/test/238_mkimage_image_bad.dts new file mode 100644 index 00000000000..54d2c99d628 --- /dev/null +++ b/tools/binman/test/238_mkimage_image_bad.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + mkimage { + args = "-T script"; + data-to-imagename; + + imagename { + type = "u-boot"; + }; + + u-boot-spl { + }; + }; + }; +}; From patchwork Sat Aug 13 17:40:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1666132 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=cFPRgL++; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4nvH4GBqz9sGP for ; Sun, 14 Aug 2022 03:43:07 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4FB5D84B6C; Sat, 13 Aug 2022 19:41:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="cFPRgL++"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5A511849CF; Sat, 13 Aug 2022 19:41:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2416C8496C for ; Sat, 13 Aug 2022 19:41:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd36.google.com with SMTP id h138so3066955iof.12 for ; Sat, 13 Aug 2022 10:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=lXHcHGBBJPTNoyfAe1d1LG7BGZWW8aSRl4yiINLQYZo=; b=cFPRgL++AWXYefP/+0Fe2uvjROgtluXoIpEOby6BLG8kwKDvkDDLHIaRjePvyOw7XM ZqqdSoBuOCQzDCnPpbckPS4vRlZZvwlUPli/uKlU4/CUERxfZ1sAYHwwCbyO7s68oQJ6 hXRS8CPBIGMQ0DMuNyScZZfukzJtkfTUp3sAQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=lXHcHGBBJPTNoyfAe1d1LG7BGZWW8aSRl4yiINLQYZo=; b=zzXR6a5RGofrEizQcNbWEwv1KdINeBpHPrn6xdEH2ysMycycvTGz9hA9jRPwFLPrJU kIAYWVcrs2V/LfV7fEwss4QEae6cv5vZC9e3I3vjxb0ozsi86XvEMEGsv7UkjZu3rPkW 0bzCHd0XF3vviKFtG5JOdyR4zWtI+9DrPlgc201uHT0S/gruDp4MsiU0LGMyVlhgtt1C Bai7cqOQ8pWlNlim7DEA3Z7F5PTtRYChlKKg3EgoYVXEOfIMec/M0rkx7aroeYV3eZxW uuEE8GqMu5SjW7qx8ztZRwDvG0xTMdJy1ABamZxl1ORfNmAGuAwrufljtnUeq2s463TB 6fpQ== X-Gm-Message-State: ACgBeo1H8hIaqrCYdNu2YK9JabdAySbY1/hRs347NZEBtQ/dHAzdWPqU d1KKP6++Hy6i+UV4qdAeHvafdYBOnmLgcA== X-Google-Smtp-Source: AA6agR4dX8eLau3LnU+RXqavLlCGr/LtKQhJveicEIz/EH/vd9fSC5w5WYeOjTpvj7j+poHGk9VeSw== X-Received: by 2002:a02:ce9a:0:b0:344:c834:92a8 with SMTP id y26-20020a02ce9a000000b00344c83492a8mr102051jaq.307.1660412467488; Sat, 13 Aug 2022 10:41:07 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u8-20020a02aa88000000b00339e669df91sm1224656jai.153.2022.08.13.10.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 10:41:07 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Quentin Schulz , Alper Nebi Yasak , Philippe Reynes , Marek Vasut , Simon Glass , Heiko Thiery Subject: [PATCH v2 11/11] binman: Allow collection to use entries from other sections Date: Sat, 13 Aug 2022 11:40:50 -0600 Message-Id: <20220813174051.1813081-12-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220813174051.1813081-1-sjg@chromium.org> References: <20220813174051.1813081-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean At present the collections etype only works with entries in the same section. This can be limiting, since in some cases the data may be inside a subsection, e.g. if there are alignment constraints. Add a function to find the entries in an etype and have it search recursively. Make use of this for mkimage also. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/entries.rst | 3 +++ tools/binman/entry.py | 23 +++++++++++++++++ tools/binman/etype/collection.py | 3 +++ tools/binman/etype/mkimage.py | 7 ++++++ tools/binman/etype/section.py | 8 +++--- tools/binman/ftest.py | 14 +++++++++++ tools/binman/test/239_collection_other.dts | 29 ++++++++++++++++++++++ tools/binman/test/240_mkimage_coll.dts | 27 ++++++++++++++++++++ 8 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 tools/binman/test/239_collection_other.dts create mode 100644 tools/binman/test/240_mkimage_coll.dts diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst index 682159ac6d3..3fa027a241c 100644 --- a/tools/binman/entries.rst +++ b/tools/binman/entries.rst @@ -427,6 +427,9 @@ listed entries are combined to form this entry. This serves as a useful base class for entry types which need to process data from elsewhere in the image, not necessarily child entries. +The entries can generally be anywhere in the same image, even if they are in +a different section from this entry. + Entry: cros-ec-rw: A blob entry which contains a Chromium OS read-write EC image diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 5424a0e6e32..6d305bfb611 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -679,6 +679,7 @@ class Entry(object): self.WriteMapLine(fd, indent, self.name, self.offset, self.size, self.image_pos) + # pylint: disable=assignment-from-none def GetEntries(self): """Return a list of entries contained by this entry @@ -688,6 +689,28 @@ class Entry(object): """ return None + def FindEntryByNode(self, find_node): + """Find a node in an entry, searching all subentries + + This does a recursive search. + + Args: + find_node (fdt.Node): Node to find + + Returns: + Entry: entry, if found, else None + """ + entries = self.GetEntries() + if entries: + for entry in entries.values(): + if entry._node == find_node: + return entry + found = entry.FindEntryByNode(find_node) + if found: + return found + + return None + def GetArg(self, name, datatype=str): """Get the value of an entry argument or device-tree-node property diff --git a/tools/binman/etype/collection.py b/tools/binman/etype/collection.py index 442b40b48b3..c532aafe3e7 100644 --- a/tools/binman/etype/collection.py +++ b/tools/binman/etype/collection.py @@ -21,6 +21,9 @@ class Entry_collection(Entry): listed entries are combined to form this entry. This serves as a useful base class for entry types which need to process data from elsewhere in the image, not necessarily child entries. + + The entries can generally be anywhere in the same image, even if they are in + a different section from this entry. """ def __init__(self, section, etype, node): super().__init__(section, etype, node) diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py index 437fcdacfd7..d298776741e 100644 --- a/tools/binman/etype/mkimage.py +++ b/tools/binman/etype/mkimage.py @@ -148,6 +148,13 @@ class Entry_mkimage(Entry): return True + def GetEntries(self): + # Make a copy so we don't change the original + entries = OrderedDict(self._mkimage_entries) + if self._imagename: + entries['imagename'] = self._imagename + return entries + def SetAllowMissing(self, allow_missing): """Set whether a section allows missing external blobs diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py index bd67238b919..5c326a75e8c 100644 --- a/tools/binman/etype/section.py +++ b/tools/binman/etype/section.py @@ -506,10 +506,10 @@ class Entry_section(Entry): node = self._node.GetFdt().LookupPhandle(phandle) if not node: source_entry.Raise("Cannot find node for phandle %d" % phandle) - for entry in self._entries.values(): - if entry._node == node: - return entry.GetData(required) - source_entry.Raise("Cannot find entry for node '%s'" % node.name) + entry = self.FindEntryByNode(node) + if not entry: + source_entry.Raise("Cannot find entry for node '%s'" % node.name) + return entry.GetData(required) def LookupSymbol(self, sym_name, optional, msg, base_addr, entries=None): """Look up a symbol in an ELF file diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 9b10fd8698d..737dbcc2466 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -5773,6 +5773,20 @@ fdt fdtmap Extract the devicetree blob from the fdtmap self.assertIn('Cannot use both imagename node and data-to-imagename', str(exc.exception)) + def testCollectionOther(self): + """Test a collection where the data comes from another section""" + data = self._DoReadFile('239_collection_other.dts') + self.assertEqual(U_BOOT_NODTB_DATA + U_BOOT_DTB_DATA + + tools.get_bytes(0xff, 2) + U_BOOT_NODTB_DATA + + tools.get_bytes(0xfe, 3) + U_BOOT_DTB_DATA, + data) + + def testMkimageCollection(self): + """Test using a collection referring to an entry in a mkimage entry""" + data = self._DoReadFile('240_mkimage_coll.dts') + expect = U_BOOT_SPL_DATA + U_BOOT_DATA + self.assertEqual(expect, data[:len(expect)]) + if __name__ == "__main__": unittest.main() diff --git a/tools/binman/test/239_collection_other.dts b/tools/binman/test/239_collection_other.dts new file mode 100644 index 00000000000..09de20e5bca --- /dev/null +++ b/tools/binman/test/239_collection_other.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + collection { + content = <&u_boot_nodtb &dtb>; + }; + section { + fill { + size = <2>; + fill-byte = [ff]; + }; + u_boot_nodtb: u-boot-nodtb { + }; + fill2 { + type = "fill"; + size = <3>; + fill-byte = [fe]; + }; + }; + dtb: u-boot-dtb { + }; + }; +}; diff --git a/tools/binman/test/240_mkimage_coll.dts b/tools/binman/test/240_mkimage_coll.dts new file mode 100644 index 00000000000..30860118860 --- /dev/null +++ b/tools/binman/test/240_mkimage_coll.dts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + collection { + content = <&spl &u_boot>; + }; + mkimage { + args = "-T script"; + + spl: u-boot-spl { + }; + + imagename { + type = "section"; + + u_boot: u-boot { + }; + }; + }; + }; +};