From patchwork Thu Aug 11 14:04:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1665579 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=BrIQ76zw; 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 4M3T8m37ZBz9sG0 for ; Fri, 12 Aug 2022 00:05:12 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DA86784919; Thu, 11 Aug 2022 16:04:33 +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="BrIQ76zw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D4A9584893; Thu, 11 Aug 2022 16:04:27 +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-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (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 EB3C384947 for ; Thu, 11 Aug 2022 16:04:23 +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-x129.google.com with SMTP id c5so271023ilh.3 for ; Thu, 11 Aug 2022 07:04:23 -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=sLKSUvg3hGwGbuxMZMOdAkyfzdaFiB847SbSiPcVP9U=; b=BrIQ76zwhIy/CZ7OShAdyS9c8J9m9WuvPQ+rDw3SJF3jcKO4N+QVoD8BFppGi+uRdp QziF46IYUg9jA2GOIPptq+e3j/y/0l513m7ESQujJKzchv1OzFPJqQ4UeyvtZSw2YZTd ARQf3YHv3KlKVAVkt1CDJK8ita2po+KULJn5o= 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=sLKSUvg3hGwGbuxMZMOdAkyfzdaFiB847SbSiPcVP9U=; b=vD6nhqKx9DKgzTPEmG7WBkcw6EFrsCMjgkrHDxsTkTGelVb5jt1brww5ujqT+QsuL3 Mwj7SFt336uHovBy+yGjm3ZBJ/Ji1p0B+3uRo+Chtuax3IjrMsH2EzlzkefTezmy+R6k z+lx7TyslXD96UZcRpsPaUaywgfXglRypjoJq7YsacrHhlWloUI8Zlr53oXQBfm2sY/h KKf2hpo0nc3tGyJVUjpXm5gAagSK09d3vACTvrhd71PAEQTix8UCEd8pgySx2yFJkRrr hQ9AIkCSFkhEhMql3ZiARdQC1gTz9t/IO/X7CdOYpW1p8a8A1dwRVRDmLaVTOYGBaQNS e9iA== X-Gm-Message-State: ACgBeo3r6eH+lF/qaklwnKxzEPjB1i/XAvZ1pxiu0LxC0aMjE0yHQPCc 1gWmMHsRLHH/Q/+njDGhKCOV/3qFPhAXig== X-Google-Smtp-Source: AA6agR5TrEJXMFZe5tPeZYghxajo1uBYw59nJedMDPdtSaJbqtc8Uus9jRnURlnZBYwuwdxW9mZOxA== X-Received: by 2002:a05:6e02:1bed:b0:2df:6a1f:4f8a with SMTP id y13-20020a056e021bed00b002df6a1f4f8amr16332601ilv.117.1660226662330; Thu, 11 Aug 2022 07:04:22 -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 o9-20020a056e0214c900b002de990656f5sm3284667ilk.32.2022.08.11.07.04.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 07:04:21 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Marek Vasut , Philippe Reynes , Simon Glass Subject: [PATCH 01/11] doc: Build documentation in parallel Date: Thu, 11 Aug 2022 08:04:02 -0600 Message-Id: <20220811140412.1671844-2-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811140412.1671844-1-sjg@chromium.org> References: <20220811140412.1671844-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). Signed-off-by: Simon Glass --- doc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/Makefile b/doc/Makefile index 050d9dd2391..008a516cb64 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 $(shell nproc) \ -c $(abspath $(srctree)/$(src)) \ -d $(abspath $(BUILDDIR)/.doctrees/$3) \ -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) \ From patchwork Thu Aug 11 14:04:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1665578 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=UeYd/hhg; 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 4M3T8Q5MhPz9sG0 for ; Fri, 12 Aug 2022 00:04:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8662C84957; Thu, 11 Aug 2022 16:04:31 +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="UeYd/hhg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 73F9E845A3; Thu, 11 Aug 2022 16:04:27 +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-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) (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 AE9348494C for ; Thu, 11 Aug 2022 16:04:24 +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-xd31.google.com with SMTP id l24so14677669ion.13 for ; Thu, 11 Aug 2022 07:04:24 -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=TCaip1Jv5x0ZV5mdjJFILBubgN18LJBWwG8/gIJPU8k=; b=UeYd/hhg9vko8NK/H3apvRQvyKcqE8lpLyl4KfeNod1WJkljh4xDbdHCLv6jXrceyw HFmg+9gKx4xUU9ohHBzBaMR4Dh2ZxHgmamWF7rjwz7dr2VakLAMi/BM5ZX6IVvYmiRCb nAPzE9bzUSzyPriQEq587OSqsHF9wD1ZLFsGE= 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=TCaip1Jv5x0ZV5mdjJFILBubgN18LJBWwG8/gIJPU8k=; b=k0JjQ6okduns6GY1ozxlTb5LlAcP5//FW9Dqag+AeoE2jXM0RhWrHJs5QglQo9rfML t8U4EHCKDjt0AqNnJ6p/JEXlZAD3xqFEX3H6D+uKXNSfU7HtIet6DA5nX7wxs5HYlH1k VfmC+KMl7Fpn8l9WH56USuKSlvd/SlfPUwbAWPXzDwwDI4kFFw1T60RPjzlkHh/BHGjv msBUVRVSzlA9+vtPOPXZji7Pw4txvjfGOellcFQ+sUSwRpd3FoWwqq76TDeV5vXJlng7 xuo35NsWRZgVnMPU7HKp4AnX8XLrzNFL96QkJYYarr3wqdw0YavGZfJAYvc3CAjgu5zT 56Vw== X-Gm-Message-State: ACgBeo39vPFMpygxDQKboNGC5/6x7cTO3+M+/OcqXivT6Z2Y/ELtATQO 8ix1SYj9mOp0j9b6XYGGs9ndTYBY2hRLRw== X-Google-Smtp-Source: AA6agR7NytHYSBHsVz3uMpsGIrGmRRbmCwlLjm1X3tVMXsu/v0z7Q+9uxpYtsFtCT38bpbL9xh3MMg== X-Received: by 2002:a05:6638:32a5:b0:343:5d08:eda0 with SMTP id f37-20020a05663832a500b003435d08eda0mr248912jav.19.1660226663100; Thu, 11 Aug 2022 07:04:23 -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 o9-20020a056e0214c900b002de990656f5sm3284667ilk.32.2022.08.11.07.04.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 07:04:22 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Marek Vasut , Philippe Reynes , Simon Glass Subject: [PATCH 02/11] patman: Put the coverage command-line last Date: Thu, 11 Aug 2022 08:04:03 -0600 Message-Id: <20220811140412.1671844-3-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811140412.1671844-1-sjg@chromium.org> References: <20220811140412.1671844-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 --- 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 Thu Aug 11 14:04:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1665580 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=G1X9IiP7; 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 4M3T956hjGz9sG0 for ; Fri, 12 Aug 2022 00:05:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D9B18496A; Thu, 11 Aug 2022 16:04:38 +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="G1X9IiP7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7276984954; Thu, 11 Aug 2022 16:04:30 +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 78FB28494E for ; Thu, 11 Aug 2022 16:04: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=sjg@chromium.org Received: by mail-io1-xd2a.google.com with SMTP id e69so14703215iof.5 for ; Thu, 11 Aug 2022 07:04:25 -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=cvuEKkV9q4vHHg6m8wg2tMIbDng9sjQvNG5zMRKdPJk=; b=G1X9IiP7+PaKRmuNlHVCW+kMlCL2gpIx3qIllsWlg9aaTRYUXJAaUsVMsEdLKEHdpF YpDmreapEAXX3+EpM7EZl23oylACnPZKylCuOSNcDIT6i69nK0+CQLA9XJjuvaUeUlNM 1K/qQPC4CyxlK0brZtoEXBVF1uMXssjNoDsDs= 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=cvuEKkV9q4vHHg6m8wg2tMIbDng9sjQvNG5zMRKdPJk=; b=cFgn67yNaOlSvE0MWdJ5tGR0jA4eh7fPhBOh8gVJEL6fwcwLh6x3JFPWn00ubHJhjf dF3awsfwujbD8nudwWRtH5TkvfaXHOaHMX7fC6hgCqG6N4wdytRPzYLiJRsLmNow52O2 RruEaIj5AjhuSEG3gRyRG/UMh3MA1zM8MpF7sx9SnWwOUIjOvVorNizgekMNE6knhE0y SgU+2bExgudWNPRdH7LlpSIq4JI+FikCKDo+0M5AS3lNYgxecQefPuMACiOeKBCKnh3J w4E63reG0Js+tQsqpN+6W2ScJ1PdpqPzqLI27v/p5nLZhKWh7xwF5/DwQ6jAxVjTR/fD jDGg== X-Gm-Message-State: ACgBeo0jSbHQR1wwkZz/aLzi0r5rxP6HxoVddBY+LLg7fWlaGhkssNJH HjJDCbpKBRDoz2DuwZuivCoBFr/QWxGIfA== X-Google-Smtp-Source: AA6agR49dCRzlvp6vHELLHNwx6GlCVKisSo///0ccPP/3GxqCXw7OzQNusKrNBqMts/lKv5PNCArRg== X-Received: by 2002:a6b:7412:0:b0:67d:1da6:b498 with SMTP id s18-20020a6b7412000000b0067d1da6b498mr13103398iog.14.1660226663810; Thu, 11 Aug 2022 07:04:23 -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 o9-20020a056e0214c900b002de990656f5sm3284667ilk.32.2022.08.11.07.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 07:04:23 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Marek Vasut , Philippe Reynes , Simon Glass Subject: [PATCH 03/11] patman: Don't buffer test output with a single test Date: Thu, 11 Aug 2022 08:04:04 -0600 Message-Id: <20220811140412.1671844-4-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811140412.1671844-1-sjg@chromium.org> References: <20220811140412.1671844-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 --- 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 Thu Aug 11 14:04:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1665581 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=SybNBDo2; 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) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M3T9N07hYz9sG0 for ; Fri, 12 Aug 2022 00:05:43 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A7EBA84958; Thu, 11 Aug 2022 16:04:40 +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="SybNBDo2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 924138494E; Thu, 11 Aug 2022 16:04:30 +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 2D78A84953 for ; Thu, 11 Aug 2022 16:04:26 +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 x2so3869533ilp.10 for ; Thu, 11 Aug 2022 07:04:26 -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=7DQHfomlcd1D2v2n71FLTxjUvhlTIVQcYV48JfwKfIg=; b=SybNBDo2Py0MhNg0Dngg3HhCjETtjDz2YBGFF1nduwJur2ItExBDZknR8vqW7nKePn Ejv4+JPpVYLTLbhpHIfiHpUxxa0mYpKcr0ablH+iHzDYv2auYjojydUtCxcYwKpwiaXS zwJsXb+bfxKmU5OI5U0zjSI0KKxNGG95Rib+Q= 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=7DQHfomlcd1D2v2n71FLTxjUvhlTIVQcYV48JfwKfIg=; b=B1PL5iPtHh8LMspU6nfpWfmTo0torCQ22N6GJgl49DI5KC0quzO0YWlCwSXFp1R84N KKz3ndhdhsQXg6UhQzD2hu1YAA3j9LfeP5VHwiyq7+73lxNtn2jORoxNeVG85qg8g9jy j+ufrWX7GR2G1armlhZ05aTds9+PVOS3DMeTYND1Z0EzUs8TEtKDaBsTKXgadL78B4Ue FWZ+dww9hW4l/6oYQBA8e0SbwDa3ZyUHq/a+DbVR53q2uMzUFWDapa3xxd4tLiYv6IRY tXlGUjP2n1iJqHP+4vOpgartOPQGreOvThBUpgGjWk98QRi945QMMVoZ+38BWaA8pfJO wWGw== X-Gm-Message-State: ACgBeo2lufnPM4qah751sM9FX2v3ra3uF0+BADoxFPWIAwogVRJbPgDL bs0X3UTqKWJaCxaxdfUMhdJtcTU/OxkEPw== X-Google-Smtp-Source: AA6agR6Vys/8wKWu3onyI4joID5RJhzDKRR2mZR+IzlXgURXQrbQ4n/u5RMoiAp/j3PtHtsLNW44zg== X-Received: by 2002:a05:6e02:156e:b0:2e0:df52:44fa with SMTP id k14-20020a056e02156e00b002e0df5244famr10140821ilu.71.1660226664518; Thu, 11 Aug 2022 07:04:24 -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 o9-20020a056e0214c900b002de990656f5sm3284667ilk.32.2022.08.11.07.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 07:04:24 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Marek Vasut , Philippe Reynes , Simon Glass Subject: [PATCH 04/11] binman: Fix up the entry-docs for Entry_pre_load Date: Thu, 11 Aug 2022 08:04:05 -0600 Message-Id: <20220811140412.1671844-5-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811140412.1671844-1-sjg@chromium.org> References: <20220811140412.1671844-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 --- 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 Thu Aug 11 14:04:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1665582 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=SL9I7Ydq; 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 4M3T9Z0Nnvz9sG0 for ; Fri, 12 Aug 2022 00:05:53 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 03B2B84955; Thu, 11 Aug 2022 16:04:43 +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="SL9I7Ydq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 443E784953; Thu, 11 Aug 2022 16:04:31 +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 DB86684957 for ; Thu, 11 Aug 2022 16:04:26 +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 g14so9980170ile.11 for ; Thu, 11 Aug 2022 07:04:26 -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=mx+v7pr5DGQLN+QZFFEE+cI4Ny/Xx2m/vhod+YHQhcY=; b=SL9I7YdqbMhfHzW4dLi3FL7IEnLxm/B+0d3sihOrZR9jwfFgCoZiaFUe/USuEoRJef DIFlLQwj6bexSdugW5YTyzp+u8zXihekDFLH1FhH+uwtNNfyscQBBmPRmpR4KoJlAjsF 2GfinWlNyE6N26ybxy/8lKz4dqp/ovqpNLd/4= 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=mx+v7pr5DGQLN+QZFFEE+cI4Ny/Xx2m/vhod+YHQhcY=; b=u1psu4oixwCfm2h4MdCKvEczXJU8koPHoKKXowMxSp/jmVvaVR089pLieLG5mhhvCX 6/0SFP8PBedxojlVcKdqxX8rhl8kyjINYFH+UN/ECEMAec25+WuvMtIxjtAH/vGMzunc Z2PQcNRC5ulnz0nAgk42XoDkhOB6HnypHqklbRfb3d8W/zqhT+gHTLCq0HPEkoVTQmqc S40FNJ+7y5c4ukeU+jhNTqQOzUKpRTjbvMdDosqkqku2ZXlpHdSMk+SuR22JL3bQdoDz SKIVsoLrWHEuSzyqKn5oMJ2rJi9NZGpSPssu2Yvi7E5gkytYb+f9Qyjo9uXXUsKAYj0t e0NA== X-Gm-Message-State: ACgBeo28jHS20siRPzgODZZa2VpjXYV76cFItasueQJkAYD/sDjSGtwy fyuZzGZSrz7Z65BdSc/yInxgRkehJeGbrg== X-Google-Smtp-Source: AA6agR4hzgFnKzjbq0FzWNhsfJPv1110frdftuvZbt2cK0BrQpaUbDlLRxmtch0T5A4oDTnOpnnuww== X-Received: by 2002:a92:2a0a:0:b0:2d9:2571:f57e with SMTP id r10-20020a922a0a000000b002d92571f57emr14807936ile.154.1660226665265; Thu, 11 Aug 2022 07:04:25 -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 o9-20020a056e0214c900b002de990656f5sm3284667ilk.32.2022.08.11.07.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 07:04:24 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Marek Vasut , Philippe Reynes , Simon Glass Subject: [PATCH 05/11] binman: Add a function to check for missing properties Date: Thu, 11 Aug 2022 08:04:06 -0600 Message-Id: <20220811140412.1671844-6-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811140412.1671844-1-sjg@chromium.org> References: <20220811140412.1671844-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 Add a new function to Entry to check for missing properties, since this is likely to be come a common requirement. Signed-off-by: Simon Glass --- tools/binman/entry.py | 16 ++++++++++++++++ tools/binman/etype/fill.py | 3 +-- tools/binman/ftest.py | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 41f0eb58ae0..3be074ccd66 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -1179,3 +1179,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, prop_list): + """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 prop_list: + 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..0b068ba3268 100644 --- a/tools/binman/etype/fill.py +++ b/tools/binman/etype/fill.py @@ -26,8 +26,7 @@ class Entry_fill(Entry): def ReadNode(self): super().ReadNode() - if self.size is None: - self.Raise("'fill' entry must have a size property") + self.ensure_props(['size']) 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 Thu Aug 11 14:04:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1665583 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=Adv7LQvA; 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 4M3T9n6MLxz9sG0 for ; Fri, 12 Aug 2022 00:06:05 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2DFA084975; Thu, 11 Aug 2022 16:04:46 +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="Adv7LQvA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6428784977; Thu, 11 Aug 2022 16:04:33 +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-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 A230A8494B for ; Thu, 11 Aug 2022 16:04: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=sjg@chromium.org Received: by mail-il1-x12a.google.com with SMTP id p9so8758392ilq.13 for ; Thu, 11 Aug 2022 07:04:27 -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=giBcD92DUGqueGvcIYLr65DQ/JMZSgMjUoXUyafY5+o=; b=Adv7LQvAaQhMQn6g7KNKMt9fL0fbpc+IZVpdeqcnwGrFK3+0XXWxpsuzifqTspHSJt GHWgfYWSXy3Pe6ojnvVSd6zUL4Z6YBpbwWzmbcYwIu8ME0T86gPn8gaYPrh2lXnBTG/y ktqDC3ockia1mg08ciNq6SDmMezRZR3rVpfuk= 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=giBcD92DUGqueGvcIYLr65DQ/JMZSgMjUoXUyafY5+o=; b=b7DqX74BAE3lbqxAKvPoVh+sQ4MQAE8lb5NO7L8W/QnesCcmHSinXi8+yFg17UC/Ii ivIx1sHTBvsqe0x16vF0XRMVAL+zu5uvUyb52mVR9LKlnoOA0qfjhrsNiMvjz9EOCsyd ayicsLkJjCMppXPSOS7/o+tV5Lzr/z6JGAbVoqjWoBRC3oFnAjPy4SeJORV+I047HODY mhkdFkr2hTJtLyyGk+VcmTjJflhGJrA9UzAkC4QYuUwGz+n5cr++/sKmHote7kX3iWIN bdlsl6BhFyRM8nHhoSPj+5meQSeNy9wf1M7jGY1fHpUfCn90YB71zpWqDoH3NN4uCtsC /vMw== X-Gm-Message-State: ACgBeo3tuY5qH1vV2U50S3UV8LblE1OUEp4kE3NeSBHXcGUGcXfjcFzH QWQivGxrgpG3AhEATpSFuAfDwVv5ld4jEQ== X-Google-Smtp-Source: AA6agR5yi4WpxkJ9YL4I4d91fECy5YPgA7SDfdEwQqqDRM6nDSw2e2M3OLlCllES6qBXUujcx8a9wQ== X-Received: by 2002:a05:6e02:17c6:b0:2dd:d9dc:6387 with SMTP id z6-20020a056e0217c600b002ddd9dc6387mr15004989ilu.321.1660226666012; Thu, 11 Aug 2022 07:04:26 -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 o9-20020a056e0214c900b002de990656f5sm3284667ilk.32.2022.08.11.07.04.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 07:04:25 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Marek Vasut , Philippe Reynes , Simon Glass , Heiko Thiery Subject: [PATCH 06/11] binman: Adjust mkimage etype node reading Date: Thu, 11 Aug 2022 08:04:07 -0600 Message-Id: <20220811140412.1671844-7-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811140412.1671844-1-sjg@chromium.org> References: <20220811140412.1671844-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 --- 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 Thu Aug 11 14:04:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1665584 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=B0SHlBsB; 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 4M3TB23XMlz9sG0 for ; Fri, 12 Aug 2022 00:06:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 12F3784982; Thu, 11 Aug 2022 16:04:49 +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="B0SHlBsB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BB15A845A3; Thu, 11 Aug 2022 16:04:33 +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-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (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 5270484919 for ; Thu, 11 Aug 2022 16:04:28 +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-x12e.google.com with SMTP id g14so9980208ile.11 for ; Thu, 11 Aug 2022 07:04:28 -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=//qAPUUtfclkP+qmBRTyTH2pVLVgZgmibjnrWGgPf8c=; b=B0SHlBsBVkuL2HjlADjv18YEhx18dl8j26+sIOMTgp4db3nvw4dTrln5FbhccbxXO/ jTGiHgnuRRB0O2AF7bkg+ZeRvJ78c+Dt2i9u12FmtlmdfRkwAfbj3yKIu94/pwckwvhv rO4F+/Kpt7CsORlMBwhTAwT2XR6G7/R17X1sc= 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=//qAPUUtfclkP+qmBRTyTH2pVLVgZgmibjnrWGgPf8c=; b=VbaQVImgehhsaSzmg2LQaT6N0c1gYd8ckDWGaOHtUc4KCt/6bWcl6QOKTL/sWAP2aw cT18hN7vlCBPcf4yo/7NQc5dg2y9ouS62Kax6viN/7fk78pKB5VsXZBJYJAUqhhWatag /sP9oynCYhl4bqbY57Ngn58UPGMLo6lTsx0Kmj1r4TEsiMUyI8n85TqlkscvYOln944l UVEZWrFfYTVWQh/h60IiH6qmP260CnPskX9Q3fKgex9Op7Nqy7789me7mGrFCftm6xR/ lXvbr/afVI1LGsTduAIio4dksBY9fhlUThkzgO9Lo4Q4iI42SFUFL9hIv8ZrmnJfsDqF w6Bw== X-Gm-Message-State: ACgBeo1TzwCarnVH+/6KrDTtc56x7IZO0tmB0UGScGVrXPllAL4ueWZO sgnUo2RBp6lG1tgK2K/Dht7O4whOM0Cqag== X-Google-Smtp-Source: AA6agR6MwzalgTlhQgzlkf1C38TFhJXQogdXY6n165PNTeNTyCSFvBxNszyD7Q+eNgibSSv9MVeaKg== X-Received: by 2002:a05:6e02:1d16:b0:2de:c48e:d2e2 with SMTP id i22-20020a056e021d1600b002dec48ed2e2mr15094526ila.164.1660226666723; Thu, 11 Aug 2022 07:04:26 -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 o9-20020a056e0214c900b002de990656f5sm3284667ilk.32.2022.08.11.07.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 07:04:26 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Marek Vasut , Philippe Reynes , Simon Glass Subject: [PATCH 07/11] binman: Avoid use of expected failure Date: Thu, 11 Aug 2022 08:04:08 -0600 Message-Id: <20220811140412.1671844-8-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811140412.1671844-1-sjg@chromium.org> References: <20220811140412.1671844-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 --- 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 Thu Aug 11 14:04:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1665586 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=O4PvKEf4; 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 4M3TBT0Jd2z9sG0 for ; Fri, 12 Aug 2022 00:06:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 84D3C849D4; Thu, 11 Aug 2022 16:04:55 +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="O4PvKEf4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0D0BE84966; Thu, 11 Aug 2022 16:04:37 +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-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (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 46A4F8494C for ; Thu, 11 Aug 2022 16:04: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=sjg@chromium.org Received: by mail-il1-x12d.google.com with SMTP id p9so8758432ilq.13 for ; Thu, 11 Aug 2022 07:04:29 -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=1Fg8In2dh5bJ2e2A9HlLIZX09lbkyjvGt6VsIwwXUw8=; b=O4PvKEf4GHpuO17XnorTKUc/2qPM2EO62OlLQP92AmRyhqDH3KlEZb5opFU70IvIz3 eYn3KyGrM77hLaPaizS4qC6zUKKM+FMt1Io3kFJ7dib7kdktj8w7aUoM63yE9NlrEfmJ 2vHEp5PHGun38hzi3oUtNg79yGdfFLaLoDABk= 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=1Fg8In2dh5bJ2e2A9HlLIZX09lbkyjvGt6VsIwwXUw8=; b=iM5cfi3YINtZ9Ow+JecccBQ/wTZUfE8ZsrQQKkMi24l0SbHRJMzM0c79t69Pkh9/0W r+07ZIBv5/haj0htpL7LVYz/PvYsQRFyuIbq7kkRQ2rbwvNid2xo26jF9Uk7YTIN5Gbf W9KjcLnx/TIsn2QR9YLeLtRvEjCfHnLfd2IHhIL+r/G5uAVEEFGrhtELsDbRQhvcrsaC ELSOym37NscWUuSnBUpChNF+LXtFPoCjKl4/uGBhqyTUc0uqhUoQI5UMP/PFZ7NuZgGB pWMbUIqlGbubEwlmff5fQWL9lR5PWk4IMTU9u/FMGzbn6H0nfYei/ouuMuxzqPk4/ojO JL5Q== X-Gm-Message-State: ACgBeo34mA1cnfN98POnWOV4pW2x//3cmOd6Ayn9qMLwxKurofHoPgwp HTGPdo7XEUrzjmPCcF/erzdqQE56IRxwfw== X-Google-Smtp-Source: AA6agR7/aLVGLmWHbiBnvbAmmveWKWEysWBsY8xS6YkXVGQE1/VLztl+ZNlLMw5iA67r+uJOL6Gi5A== X-Received: by 2002:a05:6e02:194d:b0:2df:8893:90bb with SMTP id x13-20020a056e02194d00b002df889390bbmr13631414ilu.242.1660226667470; Thu, 11 Aug 2022 07:04:27 -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 o9-20020a056e0214c900b002de990656f5sm3284667ilk.32.2022.08.11.07.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 07:04:27 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Marek Vasut , Philippe Reynes , Simon Glass , Heiko Thiery Subject: [PATCH 08/11] binman: Improve mkimage documentation Date: Thu, 11 Aug 2022 08:04:09 -0600 Message-Id: <20220811140412.1671844-9-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811140412.1671844-1-sjg@chromium.org> References: <20220811140412.1671844-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. Signed-off-by: Simon Glass --- tools/binman/entries.rst | 28 +++++++++++++++++++++------- tools/binman/etype/mkimage.py | 28 +++++++++++++++++++++------- 2 files changed, 42 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..28f7eb31343 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,24 @@ 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, 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:: From patchwork Thu Aug 11 14:04:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1665585 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=nKtHuUwo; 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 4M3TBF6CgRz9sG0 for ; Fri, 12 Aug 2022 00:06:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3050C849B0; Thu, 11 Aug 2022 16:04:51 +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="nKtHuUwo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B60D784949; Thu, 11 Aug 2022 16:04:36 +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-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) (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 1C51F84975 for ; Thu, 11 Aug 2022 16:04:30 +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-x134.google.com with SMTP id j20so9992366ila.6 for ; Thu, 11 Aug 2022 07:04:30 -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=eRAAD4HTovO9CooHA674OEmzlLP3cDogIJfR5/QxQxI=; b=nKtHuUwoftcEGGinUlvYRBtc+QPIjVog7DcJOyoYPs5zyHFTd57rgNz7566uJt61Sk Tjv6wwKdjtMew8qOY2sVBiJ6yhKNv7lVgPSMfDgOP/pcioynuCf2xumJU7M9hN0irNsl ol7g7JseiqylI4Eb6SqxpVJVVen2N+lnhDm3I= 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=eRAAD4HTovO9CooHA674OEmzlLP3cDogIJfR5/QxQxI=; b=AWI+h6rIlKcD1eOdcJe1J9IRzREXs+7paIGcLHfYBKAKuPtPJ3xYqzSI/utVGd419A 2Yy3byEWQXAe/2Am8UkIJ/6Vla6rmTPLOipApGvL930q3B6vyh9uWehQyKHCSiyV13l5 ZvTQH+RDZr4wGWLwfZ0eXuXxe/sTGqVrOzQIJS5JJZMTWbG89I86xDBthkop57kZVF5o 3uvqsPioVHY11Eh4KOwZExibwkUppv4uZj9TNVEaBFoOxQ5nbv8Py/1sPLsfxjYPRyiW 8CzvO8tq8u+iDHXqdGBJImr28YFqUym5VoPb6FwMW6rVrReIFL6SXBnNh4BbBh9s7s5F O0VQ== X-Gm-Message-State: ACgBeo3TV0QnsO6XLm+YLj0Q45eseMysO6c4G9+eBB78AyOA8hOk465U Fyvu0H2ooF4vL8iAAE8DBa5aeLoODgb+TQ== X-Google-Smtp-Source: AA6agR7jP2/pgqnxZZbd5q3bOljoRsOYdEWGdrEqbsc/L1o4HeJL795VMkk3FE5yIng6eLdG1DsprA== X-Received: by 2002:a05:6e02:f93:b0:2df:da:b6e6 with SMTP id v19-20020a056e020f9300b002df00dab6e6mr14505939ilo.205.1660226668236; Thu, 11 Aug 2022 07:04:28 -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 o9-20020a056e0214c900b002de990656f5sm3284667ilk.32.2022.08.11.07.04.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 07:04:27 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Marek Vasut , Philippe Reynes , Simon Glass , Heiko Thiery Subject: [PATCH 09/11] binman: Allow the image name to be the data file Date: Thu, 11 Aug 2022 08:04:10 -0600 Message-Id: <20220811140412.1671844-10-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811140412.1671844-1-sjg@chromium.org> References: <20220811140412.1671844-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 --- tools/binman/entries.rst | 15 +++++++++++++++ tools/binman/etype/mkimage.py | 26 ++++++++++++++++++++++++-- tools/binman/ftest.py | 17 +++++++++++++++++ tools/binman/test/235_mkimage_name.dts | 18 ++++++++++++++++++ 4 files changed, 74 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 28f7eb31343..3295f451f79 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.:: @@ -56,6 +58,19 @@ 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). """ def __init__(self, section, etype, node): super().__init__(section, etype, node) @@ -65,6 +80,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): @@ -76,13 +93,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 Thu Aug 11 14:04:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1665588 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=iQJsN4z1; 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 4M3TBw5Ycyz9sG0 for ; Fri, 12 Aug 2022 00:07:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D9213849FD; Thu, 11 Aug 2022 16:05: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=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="iQJsN4z1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 28E1684955; Thu, 11 Aug 2022 16:04:40 +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-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (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 A686F84973 for ; Thu, 11 Aug 2022 16:04:30 +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-x129.google.com with SMTP id r6so9971388ilc.12 for ; Thu, 11 Aug 2022 07:04:30 -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=6Pyl9CLO6un1c/uOU8ZxsBLaiKy5O/dPMQU7yMXsQjs=; b=iQJsN4z1hYZvXBZPla6DZDtfUNKeqkrSYThN/SrS5sS0TlrNw6dhp237RDs6RoU73M 3A+48ftwhCJ6mrmH4L9KPYwerFUQjrjLvtCWP5WSBGWx5G6tV0yBL2bjUdTnPFqsspzt sgdtDv9sgcs/JCR/aQ01reV9cEMV8uVO6VIxo= 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=6Pyl9CLO6un1c/uOU8ZxsBLaiKy5O/dPMQU7yMXsQjs=; b=HXQKZA58okYlfIPtkpp4hN1FjHZC4bU10eXiLctSw/MZ9NkpLAtS/bOtsFKkLYVXdM Q93yprYMgcSUg5/EJLCXQum/rCY0OG7GU0UQjRHum210lD2f9HksXvhLmxm/voTq+EQl YKQs9h2DmO9oMp+hJ39jFIbHFSPEbybyF82TPb3BmQjZQx0glcBXXa9+r6je/XcZT5fb pMJc60ef0XgTwPpiycEW/pJ/XCzvApjeiNdT4gt3suFkQpELs0Rf+EAyC9HXcW/8ntES bwDIfd37Shnlq3sM2VhcwefYPFrcOL6E0F6UD0IQAyaM2Z9E6wIk2ZOMOMYAjiFQZXHs yACA== X-Gm-Message-State: ACgBeo1PpK/bHBQpTpSdDM/WEE8JHS6B/nJHM9QdTBSUcN7u6SWVi/fa pe6NcCIe2ttEum8ade2wll2pJkiNi1RIGw== X-Google-Smtp-Source: AA6agR48OJ12avOudg66+Bj0MdUjWJRrGU20zXiqAgzbiaLoLG1oZP1DKM6/fQEmsnCNURDpdco/sw== X-Received: by 2002:a05:6e02:188c:b0:2e0:efaf:2d12 with SMTP id o12-20020a056e02188c00b002e0efaf2d12mr9524379ilu.103.1660226669021; Thu, 11 Aug 2022 07:04:29 -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 o9-20020a056e0214c900b002de990656f5sm3284667ilk.32.2022.08.11.07.04.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 07:04:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Marek Vasut , Philippe Reynes , Simon Glass , Heiko Thiery Subject: [PATCH 10/11] binman: Allow passing entries using -n Date: Thu, 11 Aug 2022 08:04:11 -0600 Message-Id: <20220811140412.1671844-11-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811140412.1671844-1-sjg@chromium.org> References: <20220811140412.1671844-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 --- 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 3295f451f79..dd82d51bdb6 100644 --- a/tools/binman/etype/mkimage.py +++ b/tools/binman/etype/mkimage.py @@ -71,10 +71,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). + + 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): @@ -82,6 +101,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): @@ -89,7 +110,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 @@ -98,11 +122,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)) @@ -122,6 +153,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 @@ -131,6 +164,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 @@ -142,6 +177,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 Thu Aug 11 14:04:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1665587 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=kAohIVMd; 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 4M3TBj14BKz9sG0 for ; Fri, 12 Aug 2022 00:06:53 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 027D4849E8; Thu, 11 Aug 2022 16:04:57 +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="kAohIVMd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6D0C68494E; Thu, 11 Aug 2022 16:04:39 +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-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) (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 BEDFE8494E for ; Thu, 11 Aug 2022 16:04:31 +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-xd2e.google.com with SMTP id v185so14667774ioe.11 for ; Thu, 11 Aug 2022 07:04:31 -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=ZlpszlwNKILSgZJyxxTz0ApRVcZ/l5xCXQmqpVeAyzU=; b=kAohIVMdRXFDUo5hIqBYVMpumWDgJsArpjdA4IrYmerpWZ8P+Q3GcF2V5h3H8yeRHp 2L4OCfhctIb7Kmn9dx/BexWfyx5Ls8apcYr4TPhD1a08IO1wbQv7lZZCoZ2w4Qi20mzH IRJAdMf6cl750Ym1bQqK4kw42tb6z4hGB2SPo= 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=ZlpszlwNKILSgZJyxxTz0ApRVcZ/l5xCXQmqpVeAyzU=; b=4Egtb6ka5cPaivroJo17iUZFd/olJ18PEkVeyubZXYipwEE6GHte6oAsVJefhWGmFp hCZ74Ik7mJTaWfl4hKEDz58QhiNn6KqhluoHjlNQMMhWzvEnAPiTDcNdoTOIMRW//BlJ wVm6cxqSY0vj2P8X4RpwW9d8D7syWBR4iH/W/+WKnHiOtPadvby5ALR48Gpdy7LIVRXX XkVrMWtmarOdI2IsuDkwnvJRoQv9XHLifsMUH+9y8T1vHw3QFg5cBVecp7UUw1XDWWDg JqXrXAuCI442QRs2S3f5yGkCD8QeppUMmeQR4wPjPnOwfLsJFEHpWP3MpdNSA3x/x8Ty 44SQ== X-Gm-Message-State: ACgBeo31p9Hv09u806jYzDR8QtaQqjK2ZxFrJbUokD6NqgTHMQECTxZC 35ynErcD+KGexv8APlfzBSTKWUA+AM9LDQ== X-Google-Smtp-Source: AA6agR57kLMwVT4B4Hyb8y6c/q3VEcjXI1AWTXjCoxdjEty+PhTE5XWFI71r1wM8qiiHJn8igQGLpg== X-Received: by 2002:a05:6638:149:b0:342:d201:5eb3 with SMTP id y9-20020a056638014900b00342d2015eb3mr12031023jao.170.1660226669820; Thu, 11 Aug 2022 07:04:29 -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 o9-20020a056e0214c900b002de990656f5sm3284667ilk.32.2022.08.11.07.04.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 07:04:29 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Marek Vasut , Philippe Reynes , Simon Glass , Heiko Thiery Subject: [PATCH 11/11] binman: Allow collection to use entries from other sections Date: Thu, 11 Aug 2022 08:04:12 -0600 Message-Id: <20220811140412.1671844-12-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811140412.1671844-1-sjg@chromium.org> References: <20220811140412.1671844-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 --- tools/binman/entries.rst | 3 +++ tools/binman/entry.py | 22 ++++++++++++++++ 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 ++++++++++++++++++++++ 7 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 tools/binman/test/239_collection_other.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 3be074ccd66..b9995254982 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -684,6 +684,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 dd82d51bdb6..36eef973f21 100644 --- a/tools/binman/etype/mkimage.py +++ b/tools/binman/etype/mkimage.py @@ -144,6 +144,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 { + }; + }; +};