From patchwork Tue Oct 10 09:10:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 731423 Delivered-To: patch@linaro.org Received: by 2002:a5d:574c:0:b0:31d:da82:a3b4 with SMTP id q12csp1634185wrw; Tue, 10 Oct 2023 02:12:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpLeBJTdQN0EgvbReEGad8HN6HPvwashzz0QnLb+x7tOdKougTHGcWi1CbtH5DXxVmKw8p X-Received: by 2002:a05:600c:3652:b0:3fe:d1b9:7ea9 with SMTP id y18-20020a05600c365200b003fed1b97ea9mr15028650wmq.36.1696929131366; Tue, 10 Oct 2023 02:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696929131; cv=none; d=google.com; s=arc-20160816; b=O10eXF7zCJlBO2K+LYuoaudp35qKx2H+OL/Q8O8T19sKtwuqcYBRKpSBBKO0M34O73 sDJM/gSQtvRRHtTOZeLgbeCoMqXWV5vP1ON/EmyYVY9uA7xsRkM7P84cH8Wtp2FQTG2N ySLPSEywOvevH2TKG9zOuRHC1dQssw7GLA/jsudGQBN7DGuFTaGujTzt7px4Dkp+XPDB W91zu+7pJy6XApNw4W18LiHTOKl/P7YyqCSDIuJkRsdaQV+/zQL7WhC9rH3ZS1iAsOl6 v7zfsPybY7cU6pmR7aNF+RY2wzjz13Em/lFdR43RP2/eaJ0pK/GjfntM+hi+vbI8atfe NamA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=QbSOeRnEY4+pjxJQdeLrQnYOarttg8DBtpeOmAeDBNE=; fh=9Ibi1qL39tpLE9uNA395sqKM1l+0iUV56jVqPR8MVCc=; b=R2bFK2H/ogMllkj3+8zf+WryIcVgjd1dNsVl9yVrFgWszpWdpfbK4rCKADdN4T4wfQ yfsQ7qWsSc1vcdPWGO0GUieGXrBTlcKSxyQlIGWAR3xcxKZwP07Q7aYX3LDm6L79ut11 XzB+NptRnLqPfJqX1Q+RLrPi+4Cu3pnfejpU9WizG2zJdai8/JM4I74NB0R1QZrSfSpk wJeBXkpKULQNLmp2CkGgYO2UzMVpMdGXgnH0ilL831jc1lYoZwNslmFbIh5mxjsYDvs/ aZ1ALFx2LlNhlkeV1OZYBd2WJIzLZqgRi48TRNqk3vcMuhbTcOLjIZUDsVgU5E3PbM1X H7Ww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id h21-20020a05600c315500b0040648cfbe73si6086173wmo.37.2023.10.10.02.12.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 02:12:11 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1FCDE86489; Tue, 10 Oct 2023 11:12:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id C4F5F86459; Tue, 10 Oct 2023 11:11:58 +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=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 971F386489 for ; Tue, 10 Oct 2023 11:11:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 720F71FB; Tue, 10 Oct 2023 02:12:36 -0700 (PDT) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C235C3F762; Tue, 10 Oct 2023 02:11:53 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Simon Glass , Heinrich Schuchardt , Ilias Apalodimas , Takahiro Akashi , Tom Rini Subject: [PATCH v2 0/6] Support for dumping capsule headers and empty capsules Date: Tue, 10 Oct 2023 14:40:53 +0530 Message-Id: <20231010091059.375036-1-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 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.8 at phobos.denx.de X-Virus-Status: Clean These set of patches are intended for two tasks. The first set of patches are adding support for dumping capsule header information, which is then being used in the binman test framework for testing the capsule generation. This replaces the current hardcoding of offsets used for verifying the capsule contents in the binman tests. Patch 1 introduces this functionality in the mkeficapsule tool. Patch 4 is using this functionality in the binman tests for capsules. The other set of patches, 5 and 6 are for adding support for generation of empty capsules in binman. The empty capsules are used for the FWU A/B update functionality. Changes since V1: * Get rid of the superfluous hdr_size variable in the dump_fmp_payload_header() function * Move the get_binman_test_guid() function outside the Entry_efi_capsule class so that it can be called from outside the module. * Use lowercase characters in the GUID values * Add comments for the _GetCapsuleHeaders() function. * Use a simple dict in _GetCapsuleHeaders() for storing the capsule header values dumped by the mkeficapsule tool. * Use a single boolean value to indicate the generation of either of accept/revert capsule. * Move the parameters added to the list on the same line in a couple of places. * Instead of using two separate boolean values, use a 'capsule-type' property for indicating generation of an accept/revert capsule. * Make corresponding changes in the sanity checks, documentation and tests based on the above change. * Use lower case characters for GUIDs. * Call get_binman_test_guid() from the efi_capsule entry module. * Add the documentation entry for the empty capsules in entries.rst. * Remove the #[address,size]-cells properties from the test dts' for empty capsules. Sughosh Ganu (6): tools: mkeficapsule: Add support to print capsule headers doc: capsule: Add documentation for the capsule dump feature binman: capsule: Remove superfluous [address,size]-cells properties binman: capsule: Use dumped capsule header contents for verification btool: mkeficapsule: Add support for EFI empty capsule generation binman: capsule: Add support for generating EFI empty capsules doc/develop/uefi/uefi.rst | 17 ++ tools/binman/btool/mkeficapsule.py | 26 ++ tools/binman/entries.rst | 44 ++++ tools/binman/etype/efi_capsule.py | 24 +- tools/binman/etype/efi_empty_capsule.py | 86 +++++++ tools/binman/ftest.py | 160 +++++++++--- tools/binman/test/311_capsule.dts | 3 - tools/binman/test/312_capsule_signed.dts | 3 - tools/binman/test/313_capsule_version.dts | 3 - tools/binman/test/314_capsule_signed_ver.dts | 3 - tools/binman/test/315_capsule_oemflags.dts | 3 - tools/binman/test/316_capsule_missing_key.dts | 3 - .../binman/test/317_capsule_missing_index.dts | 3 - .../binman/test/318_capsule_missing_guid.dts | 3 - tools/binman/test/319_capsule_accept.dts | 13 + tools/binman/test/320_capsule_revert.dts | 11 + .../test/321_capsule_accept_missing_guid.dts | 11 + .../test/322_empty_capsule_type_missing.dts | 12 + .../323_capsule_accept_revert_missing.dts | 13 + tools/eficapsule.h | 2 + tools/mkeficapsule.c | 227 +++++++++++++++++- 21 files changed, 599 insertions(+), 71 deletions(-) create mode 100644 tools/binman/etype/efi_empty_capsule.py create mode 100644 tools/binman/test/319_capsule_accept.dts create mode 100644 tools/binman/test/320_capsule_revert.dts create mode 100644 tools/binman/test/321_capsule_accept_missing_guid.dts create mode 100644 tools/binman/test/322_empty_capsule_type_missing.dts create mode 100644 tools/binman/test/323_capsule_accept_revert_missing.dts