[3/3] binman: etype: collection: Set build_done on the referenced entries
Simon Glass
sjg at chromium.org
Thu Apr 2 02:17:44 CEST 2026
Hi Yan,
On 2026-04-01T15:35:23, yan wang <yan.wang at softathome.com> wrote:
> binman: etype: collection: Set build_done on the referenced entries
> binman: etype: collection: Set build_done on the referenced entries
>
> The collection etype uses phandles in the 'content' property to
> reference other entries. Resolve each phandle to its Entry and mark
> it with build_done to avoid rebuilding the same entry data multiple
> times.
>
> This is important for certain cases where rebuilding may change
> the data content, e.g. due to timestamp or random IVs.
>
> Signed-off-by: yan wang <yan.wang at softathome.com>
> diff --git a/tools/binman/etype/collection.py b/tools/binman/etype/collection.py
> @@ -51,6 +51,14 @@ class Entry_collection(Entry):
> + # Mark referenced entries as build_done to avoid rebuilding
> + node = self.section._node.GetFdt().LookupPhandle(entry_phandle)
> + if node:
> + entry = self.section.FindEntryByNode(node)
> + if entry:
> + entry.build_done = True
This duplicates the phandle lookup that GetContentsByPhandle() already
performs. GetContentsByPhandle() calls LookupPhandle() and
FindEntryByNode(), and then you repeat those same calls here.
Also, GetContentsByPhandle() raises an exception if node or entry is
not found, so the conditional checks here would never evaluate to
false after a successful call returns entry_data.
Please can you refactor this to avoid the duplicate lookup? One option
is to have GetContentsByPhandle() return the entry as well as the
data, or set build_done itself. What do you think?
Regards,
Simon
More information about the U-Boot
mailing list