From: Yan WANG <yan.wang@softathome.com>
To: trini@konsulko.com, sjg@chromium.org, alpernebiyasak@gmail.com
Cc: paul.henrys_ext@softathome.com, u-boot@lists.denx.de,
yan wang <yan.wang@softathome.com>
Subject: [PATCH v7 2/3] binman: collection: Set build_done on referenced entries
Date: Fri, 17 Apr 2026 10:30:49 +0200 [thread overview]
Message-ID: <20260417083050.499955-3-yan.wang@softathome.com> (raw)
In-Reply-To: <20260417083050.499955-1-yan.wang@softathome.com>
From: yan wang <yan.wang@softathome.com>
The collection etype uses phandles in the 'content' property to
reference other entries. Mark each referenced entry with build_done
to avoid rebuilding the same entry data multiple times.
This is important for cases where rebuilding may change the data
content, e.g. due to timestamps or random IVs in encryption.
Refactor GetContentsByPhandle() to return both the entry object and
its data.
Signed-off-by: yan wang <yan.wang@softathome.com>
---
Changes in v7:
- use mark_build_done() to recursively mark child entries
tools/binman/etype/collection.py | 9 +++++++--
tools/binman/etype/section.py | 5 +++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/tools/binman/etype/collection.py b/tools/binman/etype/collection.py
index c532aafe3e7..866ea8dcc1e 100644
--- a/tools/binman/etype/collection.py
+++ b/tools/binman/etype/collection.py
@@ -45,12 +45,17 @@ class Entry_collection(Entry):
self.Info('Getting contents, required=%s' % required)
data = bytearray()
for entry_phandle in self.content:
- entry_data = self.section.GetContentsByPhandle(entry_phandle, self,
- required)
+ entry, entry_data = self.section.GetContentsByPhandle(
+ entry_phandle, self, required)
if not required and entry_data is None:
self.Info('Contents not available yet')
# Data not available yet
return None
+
+ # Mark referenced entries as build_done to avoid rebuilding
+ if required:
+ entry.mark_build_done()
+
data += entry_data
self.Info('Returning contents size %x' % len(data))
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 6a26d687056..8530b7ee17f 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -557,7 +557,8 @@ class Entry_section(Entry):
return None
Returns:
- data from associated entry (as a string), or None if not found
+ tuple: (entry, data) where entry is the Entry object and data is
+ from that entry (as a string), or (entry, None) if data not found
"""
node = self._node.GetFdt().LookupPhandle(phandle)
if not node:
@@ -565,7 +566,7 @@ class Entry_section(Entry):
entry = self.FindEntryByNode(node)
if not entry:
source_entry.Raise("Cannot find entry for node '%s'" % node.name)
- return entry.GetData(required)
+ return entry, entry.GetData(required)
def LookupEntry(self, entries, sym_name, msg):
"""Look up the entry for a binman symbol
--
2.25.1
next prev parent reply other threads:[~2026-04-17 8:31 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 19:24 [PATCH v2 1/3] tools: binman: Test signing an encrypted FIT with a preload header yan wang
2026-04-02 19:24 ` [PATCH v2 2/3] binman: Generate preload header and sign data only once yan wang
2026-04-03 1:02 ` Simon Glass
2026-04-02 19:24 ` [PATCH v2 3/3] binman: collection: Set build_done on referenced entries yan wang
2026-04-03 1:02 ` Simon Glass
2026-04-02 19:35 ` [PATCH v2 1/3] tools: binman: Test signing an encrypted FIT with a preload header Tom Rini
2026-04-03 7:32 ` [PATCH v3 " Paul HENRYS
2026-04-03 7:32 ` [PATCH v3 2/3] binman: Generate preload header and sign data only once Paul HENRYS
2026-04-03 7:32 ` [PATCH v3 3/3] binman: collection: Set build_done on referenced entries Paul HENRYS
2026-04-03 7:41 ` [PATCH v3 1/3] tools: binman: Test signing an encrypted FIT with a preload header Paul HENRYS
2026-04-03 14:53 ` Tom Rini
2026-04-03 7:55 ` [PATCH v4 " Paul HENRYS
2026-04-03 7:55 ` [PATCH v4 2/3] binman: Generate preload header and sign data only once Paul HENRYS
2026-04-03 13:21 ` Simon Glass
2026-04-03 7:55 ` [PATCH v4 3/3] binman: collection: Set build_done on referenced entries Paul HENRYS
2026-04-03 13:22 ` Simon Glass
2026-04-08 15:01 ` [PATCH v5 0/3] binman: Fix preload signing with encrypted FIT Paul HENRYS
2026-04-08 15:01 ` [PATCH v5 1/3] binman: Generate preload header and sign data only once Paul HENRYS
2026-04-11 17:19 ` Simon Glass
2026-04-08 15:02 ` [PATCH v5 2/3] binman: collection: Set build_done on referenced entries Paul HENRYS
2026-04-11 17:18 ` Simon Glass
2026-04-14 13:15 ` [PATCH v6 0/3] binman: Fix preload signing with encrypted FIT Yan WANG
2026-04-14 13:15 ` [PATCH v6 1/3] binman: Generate preload header and sign data only once Yan WANG
2026-04-16 17:37 ` Simon Glass
2026-04-14 13:15 ` [PATCH v6 2/3] binman: collection: Set build_done on referenced entries Yan WANG
2026-04-16 17:36 ` Simon Glass
2026-04-17 8:30 ` [PATCH v7 0/3] binman: Fix preload signing with encrypted FIT Yan WANG
2026-04-17 8:30 ` [PATCH v7 1/3] binman: Generate preload header and sign data only once Yan WANG
2026-04-18 18:14 ` Simon Glass
2026-04-17 8:30 ` Yan WANG [this message]
2026-04-18 18:15 ` [PATCH v7 2/3] binman: collection: Set build_done on referenced entries Simon Glass
2026-04-17 8:30 ` [PATCH v7 3/3] tools: binman: Test signing an encrypted FIT with a preload header Yan WANG
2026-04-18 18:15 ` Simon Glass
2026-04-14 13:15 ` [PATCH v6 " Yan WANG
2026-04-16 17:37 ` Simon Glass
2026-04-08 15:02 ` [PATCH v5 " Paul HENRYS
2026-04-11 17:19 ` Simon Glass
2026-04-03 13:22 ` [PATCH v4 1/3] " Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260417083050.499955-3-yan.wang@softathome.com \
--to=yan.wang@softathome.com \
--cc=alpernebiyasak@gmail.com \
--cc=paul.henrys_ext@softathome.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox