]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
btool: mkeficapsule: Add support for EFI empty capsule generation
authorSughosh Ganu <sughosh.ganu@linaro.org>
Tue, 10 Oct 2023 09:10:58 +0000 (14:40 +0530)
committerSimon Glass <sjg@chromium.org>
Fri, 13 Oct 2023 20:01:42 +0000 (14:01 -0600)
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>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/binman/btool/mkeficapsule.py

index 61179747ffad34f154b76ad3c25a26b0e28bc68a..ef1da638df12ba201cefee86f8d3c35031820081 100644 (file)
@@ -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