From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: "Uwe Kleine-König" <uwe@kleine-koenig.org>,
"Ahmad Fatoum" <a.fatoum@pengutronix.de>
Subject: [PATCH 1/4] scripts/make_fit: factor dtb file name into configuration name
Date: Tue, 18 Mar 2025 09:25:04 +0100 [thread overview]
Message-ID: <20250318082507.419785-1-a.fatoum@pengutronix.de> (raw)
Bootloaders often support booting a specific FIT configuration by name.
This is useful when the automatic boot fails, because the bootloader's
DT compatible differs from the upstream one included with the Linux
device trees.
Currently, configuration are numbered sequentially requiring the user to
dump the FIT image to determine what number the configuration has.
Improve upon this by naming configurations after the dtb name instead.
This is what OE-core kernel-fitimage.bbclass does for example.
Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
scripts/make_fit.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/scripts/make_fit.py b/scripts/make_fit.py
index 075b7c258ff2..2190da4c003c 100755
--- a/scripts/make_fit.py
+++ b/scripts/make_fit.py
@@ -145,11 +145,9 @@ def finish_fit(fsw, entries):
str: Compatible stringlist
"""
fsw.end_node()
- seq = 0
with fsw.add_node('configurations'):
- for model, compat, files in entries:
- seq += 1
- with fsw.add_node(f'conf-{seq}'):
+ for dtbname, model, compat, files in entries:
+ with fsw.add_node(f'conf-{dtbname}'):
fsw.property('compatible', bytes(compat))
fsw.property_string('description', model)
fsw.property('fdt', bytes(''.join(f'fdt-{x}\x00' for x in files), "ascii"))
@@ -266,6 +264,7 @@ def build_fit(args):
fsw = libfdt.FdtSw()
setup_fit(fsw, args.name)
entries = []
+ dtbs_seen = set()
fdts = {}
# Handle the kernel
@@ -290,7 +289,13 @@ def build_fit(args):
files_seq = [fdts[fn] for fn in files]
- entries.append([model, compat, files_seq])
+ dtbname = os.path.basename(fname)
+ ndtbs_seen = len(dtbs_seen)
+ dtbs_seen.add(dtbname)
+ if len(dtbs_seen) == ndtbs_seen:
+ raise RuntimeError(f"Duplicate file name '{dtbname}' during FIT creation")
+
+ entries.append([dtbname, model, compat, files_seq])
finish_fit(fsw, entries)
--
2.39.5
next reply other threads:[~2025-03-18 8:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 8:25 Ahmad Fatoum [this message]
2025-03-18 8:25 ` [PATCH 2/4] amba: drop unused hepers for creating AMBA devices outside OF Ahmad Fatoum
2025-03-18 10:53 ` Uwe Kleine-König
2025-03-18 8:25 ` [PATCH 3/4] amba: support masking data abort during identification Ahmad Fatoum
2025-03-18 11:04 ` Sascha Hauer
2025-03-18 11:24 ` Ahmad Fatoum
2025-03-18 8:25 ` [PATCH 4/4] ARM: qemu: mask data aborts during AMBA identification Ahmad Fatoum
2025-03-18 11:07 ` Sascha Hauer
2025-03-18 11:03 ` [PATCH 1/4] scripts/make_fit: factor dtb file name into configuration name Uwe Kleine-König
2025-03-18 11:27 ` Ahmad Fatoum
2025-03-18 11:33 ` Uwe Kleine-König
2025-03-18 11:07 ` Sascha Hauer
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=20250318082507.419785-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=uwe@kleine-koenig.org \
/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