[PATCH v4 2/3] binman: Generate preload header and sign data only once
Simon Glass
sjg at chromium.org
Fri Apr 3 15:21:52 CEST 2026
Hi Paul,
On 2026-04-03T07:55:27, Paul HENRYS <paul.henrys_ext at softathome.com> wrote:
> binman: Generate preload header and sign data only once
>
> To optimize preload generation, generate the header and signatures only
> after all data has been collected. This avoids signing the data multiple
> times.
>
> Since header_size is known upfront (from __init__), set the preload
> header size in ObtainContents() to avoid an extra packing pass when
> ProcessContentsUpdate() detects the size changed from 0 to header_size.
>
> This reduces unnecessary repacking and signing operations.
>
> Signed-off-by: Paul HENRYS <paul.henrys_ext at softathome.com>
> diff --git a/tools/binman/etype/pre_load.py b/tools/binman/etype/pre_load.py
> @@ -152,14 +152,14 @@ class Entry_pre_load(Entry_collection):
> + def ObtainContents(self):
> + """Only set the known size of the preload header. The data will be
> + generated later on in ProcessContents() when the data from every entries
> + can be retrieved.
> + """
> + self.contents_size = self.header_size
> + return True
Setting contents_size without calling SetContents() is unusual. Most
entry types provide placeholder data so GetData() returns something
valid rather than None. While section.py handles None by substituting
pad bytes, this feels like relying on a side-effect.
Please can you call SetContents() with placeholder data of header_size
length instead, similar to image_header? That would be more consistent
with other entry types.
Also the docstring should have the summary on the first line per
Python conventions.
Regards,
Simon
More information about the U-Boot
mailing list