From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>,
Steffen Trumtrar <s.trumtrar@pengutronix.de>
Subject: [PATCH] ARM: lib32: bootm: always pass a device tree to barebox images
Date: Mon, 28 Sep 2026 11:59:12 +0200 [thread overview]
Message-ID: <20260928095913.1102079-1-a.fatoum@pengutronix.de> (raw)
Since commit 828ffad14177 ("bootm: make fallback to barebox internal
tree optional"), disabling CONFIG_BOOTM_OFTREE_FALLBACK doesn't only
affect kernels, but also barebox images started with bootm. Without -o,
these now get ATAGs instead of a device tree, which leaves images like
barebox-dt-2nd.img or the STM32MP generic BL33 without any description
of the hardware and thus without an interactive console.
The option is meant to make users notice a missing kernel device tree,
but barebox images don't ship one that should be preferred over ours.
So let's have the barebox image handler preset barebox' own device tree
for bootm_get_devicetree() to use if none was supplied.
Tested on an STM32MP157C-DK2 with CONFIG_BOOTM_OFTREE_FALLBACK=n: a
zImage still gets no device tree, -o is still honoured and a chainloaded
generic BL33 image comes up with a console.
Assisted-by: Claude:opus-5.5
Fixes: 828ffad14177 ("bootm: make fallback to barebox internal tree optional")
Reported-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/lib32/bootm.c | 17 ++++++++++++++++-
common/bootm.c | 4 +++-
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/arch/arm/lib32/bootm.c b/arch/arm/lib32/bootm.c
index e2a80ada788b..cfd30d1e0aff 100644
--- a/arch/arm/lib32/bootm.c
+++ b/arch/arm/lib32/bootm.c
@@ -457,9 +457,24 @@ static struct image_handler zimage_handler = {
.filetype = filetype_arm_zimage,
};
+static int do_bootm_barebox(struct image_data *data)
+{
+ /*
+ * Unlike a kernel, barebox doesn't ship a device tree that should be
+ * preferred over ours: Images like barebox-dt-2nd.img and the
+ * STM32MP generic BL33 image learn about the hardware solely from
+ * the device tree they are passed. So pass along ours if none was
+ * supplied, regardless of CONFIG_BOOTM_OFTREE_FALLBACK.
+ */
+ if (!data->oftree)
+ data->of_root_node = of_dup(of_get_root_node());
+
+ return do_bootm_linux(data);
+}
+
static struct image_handler barebox_handler = {
.name = "ARM barebox",
- .bootm = do_bootm_linux,
+ .bootm = do_bootm_barebox,
.check_image = bootm_efi_check_image,
.filetype = filetype_arm_barebox,
};
diff --git a/common/bootm.c b/common/bootm.c
index 27da1a590bf1..7ba31379a217 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -330,7 +330,9 @@ void *bootm_get_devicetree(struct image_data *data)
printf("using %s as devicetree\n", data->oftree->name);
} else {
- data->of_root_node = of_dup_root_node_for_boot();
+ /* image handlers may preset barebox' own device tree */
+ if (!data->of_root_node)
+ data->of_root_node = of_dup_root_node_for_boot();
if (!data->of_root_node) {
if (bootm_verbose(data))
printf("using no devicetree\n");
--
2.47.3
reply other threads:[~2026-09-28 10:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260928095913.1102079-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.trumtrar@pengutronix.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