From patchwork Tue Oct 10 09:10:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 731428 Delivered-To: patch@linaro.org Received: by 2002:a5d:574c:0:b0:31d:da82:a3b4 with SMTP id q12csp1634559wrw; Tue, 10 Oct 2023 02:13:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEf96mI4QvbVrT+c48MPzxFW/7A2xr5KdaEGYpYvQ5orgOqOGke19skFZkmliGHY+J1UICw X-Received: by 2002:adf:ee85:0:b0:31f:e74e:8265 with SMTP id b5-20020adfee85000000b0031fe74e8265mr15669468wro.56.1696929192080; Tue, 10 Oct 2023 02:13:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696929192; cv=none; d=google.com; s=arc-20160816; b=b4n8BicYNJ8ePyxH09lSopCWc4sT3D+3MkoetrPp1g6tPQVH+rW6COuvtMefnoHTIr q0JXnairkYzWcdfOq6DDhisY/6nIGjAwJGd4oxXlIAib+ztJ5H5A907NhH61pqPFMFE+ qMF5eIMI++zJlGlT54PCm6zGRLCzOtAEVRfQYM+iL1MUJ8Dyq5JFQhEEBxGKNBFwsW7q Jr7NVD1PRs/RJHWLpkJsXPLtQrMT94+RXK4PDkFoIoBh4wtErv35NrjkNrV2PAhR4a8x CdlNozc88qmkhfXswr3E5XJ1Jc9M4hId42cpmCOkoJ94u64zcK1vUBcPiMcsRvwHhPOP tFMQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from; bh=Exu2nmIRts1TnraYVLkIjNMSGE5F8dPZL3QdCxuabmA=; fh=GFi6yKGMx/0zdTg+7jHYbY+NaEzlEBFVO9Bq4SjQnp0=; b=mdNgpDo86XAbaJEYuTAzDO7afkcaCUkt8U0DR0kkGVnarC7zq79eunhciIQWez7D/S pYpbk2UFFJyQb59sVZcPllXtbftCC9ppvezolEBDlbTVzcsI/pgGQx+czAOIN4fanylg 9m06GP0RMky4f+ME/Rg3OisD/+QJYO6DYh0PppZGK1VvU1NCNXXzt91ePp69sPt+ZuoX b42y/8UfiTOR6PKqfOIg20hE5My/lnYrp7h2Vn+8h3+Z/h+joO7mCIBVG3kKouWUUOI3 CTZcVgz6JwuPFhOGOY+rnoGbN+R1IeZr6R5N97dXDAr2en/JxwoTdTHmAy0Dw+avwqaX TONg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id c1-20020a5d4f01000000b0032121b2c404si4320925wru.575.2023.10.10.02.13.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 02:13:12 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 26A9986E06; Tue, 10 Oct 2023 11:12:17 +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 7C20E86DDF; Tue, 10 Oct 2023 11:12:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-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 E61AF86DEE for ; Tue, 10 Oct 2023 11:12:09 +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 2939A1FB; Tue, 10 Oct 2023 02:12:50 -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 3EACC3F762; Tue, 10 Oct 2023 02:12:07 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Simon Glass , Heinrich Schuchardt , Ilias Apalodimas , Takahiro Akashi , Tom Rini , Sughosh Ganu Subject: [PATCH v2 5/6] btool: mkeficapsule: Add support for EFI empty capsule generation Date: Tue, 10 Oct 2023 14:40:58 +0530 Message-Id: <20231010091059.375036-6-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010091059.375036-1-sughosh.ganu@linaro.org> References: <20231010091059.375036-1-sughosh.ganu@linaro.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.8 at phobos.denx.de X-Virus-Status: Clean Add a method to the mkeficapsule bintool to generate empty capsules. These are capsules needed for the FWU A/B update feature. Signed-off-by: Sughosh Ganu Reviewed-by: Simon Glass Reviewed-by: Simon Glass --- Changes since V1: * 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. tools/binman/btool/mkeficapsule.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/binman/btool/mkeficapsule.py b/tools/binman/btool/mkeficapsule.py index 61179747ff..ef1da638df 100644 --- a/tools/binman/btool/mkeficapsule.py +++ b/tools/binman/btool/mkeficapsule.py @@ -80,6 +80,32 @@ class Bintoolmkeficapsule(bintool.Bintool): return self.run_cmd(*args) + def generate_empty_capsule(self, image_guid, output_fname, + accept=True): + """Generate empty capsules for FWU A/B updates + + Args: + image_guid (str): GUID used for identifying the image + in case of an accept capsule + output_fname (str): Path to the output capsule file + accept (bool): Generate an accept capsule, + else a revert capsule + + Returns: + str: Tool output + """ + if accept: + args = [ + f'--guid={image_guid}', + '--fw-accept' + ] + else: + args = [ '--fw-revert' ] + + args += [ output_fname ] + + return self.run_cmd(*args) + def fetch(self, method): """Fetch handler for mkeficapsule