From patchwork Wed Oct 4 11:27:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 729285 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a4e:0:b0:31d:da82:a3b4 with SMTP id v14csp287757wrs; Wed, 4 Oct 2023 04:28:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpwjaK1bXNlk4tOIAROhEwzK7ST57e/Qbyy1hHEqVRMF/v99ruSGzo6ClQZBeHKRO0wiHd X-Received: by 2002:a05:6000:6:b0:320:261:b87f with SMTP id h6-20020a056000000600b003200261b87fmr1815499wrx.62.1696418924811; Wed, 04 Oct 2023 04:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696418924; cv=none; d=google.com; s=arc-20160816; b=kIjvRwqOA+cpyq0Xsr8OEBpcoUFtPM5whbWdXai9OI/FZdB5Bnn6QgxUfIEPKapXBW 1s0BycBv3lW0ErCdGEfVgeuPFcIBNmB1kAeTP11iEYqfF5yzH/+qIegPCAYfGhep4qvQ xZy5l7WAn1NrlOichmzPRWMS0LG+iAQlNZS8GR8CBtyP4+IL+KXAlydQCk8B8vVn29wi 4Nbz36lwc6GSALnPGpS39Ec11vKahU6CNcWvb7sHNP+kYnDm8ZQz70qa8RksYT6ajuGZ wu4zaJJzoVSErwv2dlug4kwHzDLMLzTQObOTy59jTrsP34FALQBCXx5SVGhZ9jASiQvn HDkg== 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=rte+vGHTgQassXUpfLwa9L94AqZM48QRfS2e8wGqETk=; fh=GFi6yKGMx/0zdTg+7jHYbY+NaEzlEBFVO9Bq4SjQnp0=; b=v6lWcFYinG0c5msjJbT51M0PhXMPD6jdzggK9zsae3pLI13V41uzBRudxGajFwU4XR TiNRx2EtRYZJ7PVEKLW+6U46ixK/6tnt6Wg9zSoFZUY9abZy3Xeu+Tq2Y5jLBo8uh9xZ d+N8zfSCcN1JyoJucoaEHJ5Tp5/f7hSKlUylBWtvdmvBq439dKunV/Vrf5wr1mqQAwB+ pDwXivHrLqmjhsisAdseXTo+OqJu3arNBuHQmVSkmtqTTWwM4ebsTmOg993or0JZDYad yZNFOFw2siKwjoO1YOOC630yaLcBdlFnVc5fiWEaPivfBb4czXZIm5PjLZLXoSaE4EVQ zEeg== 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 x1-20020adfdcc1000000b0032329400347si1996675wrm.286.2023.10.04.04.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 04:28:44 -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 4241C86477; Wed, 4 Oct 2023 13:27:59 +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 A76AA874DC; Wed, 4 Oct 2023 13:27:54 +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 2389E874DC for ; Wed, 4 Oct 2023 13:27:52 +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 371EADA7; Wed, 4 Oct 2023 04:28:30 -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 57EC63F762; Wed, 4 Oct 2023 04:27:49 -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 4/5] btool: mkeficapsule: Add support for EFI empty capsule generation Date: Wed, 4 Oct 2023 16:57:21 +0530 Message-Id: <20231004112722.416877-5-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231004112722.416877-1-sughosh.ganu@linaro.org> References: <20231004112722.416877-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 --- tools/binman/btool/mkeficapsule.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/binman/btool/mkeficapsule.py b/tools/binman/btool/mkeficapsule.py index 61179747ff..89c0adfc9f 100644 --- a/tools/binman/btool/mkeficapsule.py +++ b/tools/binman/btool/mkeficapsule.py @@ -80,6 +80,35 @@ class Bintoolmkeficapsule(bintool.Bintool): return self.run_cmd(*args) + def generate_empty_capsule(self, accept, revert, image_guid, + output_fname): + """Generate empty capsules for FWU A/B updates + + Args: + accept (int): Generate an accept capsule + revert (int): Generate a revert capsule + image_guid (str): GUID used for identifying the image + output_fname (str): Path to the output capsule file + + Returns: + str: Tool output + """ + if accept: + args = [ + f'--guid={image_guid}', + '--fw-accept' + ] + elif revert: + args = [ + '--fw-revert' + ] + + args += [ + output_fname + ] + + return self.run_cmd(*args) + def fetch(self, method): """Fetch handler for mkeficapsule