diff mbox series

[7/8] btool: mkeficapsule: Add support for EFI empty capsule generation

Message ID 20230908120002.29851-8-sughosh.ganu@linaro.org
State Superseded
Headers show
Series Add some more EFI capsule tooling support | expand

Commit Message

Sughosh Ganu Sept. 8, 2023, noon 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>
---
 tools/binman/btool/mkeficapsule.py | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
diff mbox series

Patch

diff --git a/tools/binman/btool/mkeficapsule.py b/tools/binman/btool/mkeficapsule.py
index b0599aa506..061463418f 100644
--- a/tools/binman/btool/mkeficapsule.py
+++ b/tools/binman/btool/mkeficapsule.py
@@ -96,6 +96,35 @@  class Bintoolmkeficapsule(bintool.Bintool):
 
         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