diff mbox series

[v2,5/6] btool: mkeficapsule: Add support for EFI empty capsule generation

Message ID 20231010091059.375036-6-sughosh.ganu@linaro.org
State Accepted
Commit f1c8fc5e67bfb40fa7d2b91b5972eb6f0e8760ad
Headers show
Series Support for dumping capsule headers and empty capsules | expand

Commit Message

Sughosh Ganu Oct. 10, 2023, 9:10 a.m. UTC
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 <sughosh.ganu@linaro.org>
---
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(+)

Comments

Simon Glass Oct. 12, 2023, 3:45 a.m. UTC | #1
On Tue, 10 Oct 2023 at 02:12, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> 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 <sughosh.ganu@linaro.org>
> ---
> 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(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass Oct. 13, 2023, 10 p.m. UTC | #2
On Tue, 10 Oct 2023 at 02:12, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> 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 <sughosh.ganu@linaro.org>
> ---
> 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(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox series

Patch

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