]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
binman: Generate preload header and sign data only once
authorPaul HENRYS <paul.henrys_ext@softathome.com>
Fri, 17 Apr 2026 08:30:48 +0000 (10:30 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 5 May 2026 16:37:09 +0000 (10:37 -0600)
To optimize preload generation, generate the header and signatures only
after all data has been collected in ProcessContentsUpdate(). This
avoids signing the data multiple times.

Since header_size is known upfront (from __init__), create a placeholder
in `ObtainContents()` to avoid an extra packing pass when
ProcessContentsUpdate() detects a size change.

This reduces unnecessary repacking and signing operations.

Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/binman/etype/pre_load.py

index 00f1a8967673b29a35e17c462348f4a3d9eb7a80..0d953cb258e0e100163017bc7bc4c4707c74b320 100644 (file)
@@ -152,14 +152,11 @@ class Entry_pre_load(Entry_collection):
         return data + pad
 
     def ObtainContents(self):
-        """Obtain a placeholder for the header contents"""
-        # wait that the image is available
-        self.image = self.GetContents(False)
-        if self.image is None:
-            return False
-        self.SetContents(self._CreateHeader())
+        """Create a placeholder for the header"""
+        self.SetContents(tools.get_bytes(0, self.header_size))
         return True
 
     def ProcessContents(self):
+        self.image = self.GetContents(True)
         data = self._CreateHeader()
         return self.ProcessContentsUpdate(data)