* [Buildroot] [PATCH v3] boot/uboot: support custom DTS with CONFIG_OF_UPSTREAM
@ 2026-10-03 21:06 Alexander Sverdlin
2026-10-18 19:32 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Sverdlin @ 2026-10-03 21:06 UTC (permalink / raw)
To: buildroot; +Cc: Alexander Sverdlin, Romain Naour, Vincent Jardin
Since U-Boot 2024.07, boards with CONFIG_OF_UPSTREAM build their device
trees from dts/upstream/src/<arch>/<vendor>/ instead of arch/<arch>/dts/,
so the files copied by BR2_TARGET_UBOOT_CUSTOM_DTS_PATH were misplaced.
Derive the destination from the U-Boot configuration, including the vendor
sub-directory taken from CONFIG_DEFAULT_DEVICE_TREE.
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
Changelog:
v3:
- reduced verbocity and duplication in the commit message, help text and
code comments
v2:
- handle *u-boot.dtsi separately
- document the new behaviour with OF_UPSTREAM-enabled U-Boot builds
- https://lore.kernel.org/all/20260913133520.3423773-1-alexander.sverdlin@gmail.com/
v1:
- https://lore.kernel.org/all/20260901145225.579733-1-alexander.sverdlin@gmail.com/
boot/uboot/Config.in | 5 ++---
boot/uboot/uboot.mk | 25 ++++++++++++++++++++++---
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index 1eabd10407..c6cddee1a2 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -802,9 +802,8 @@ if BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
config BR2_TARGET_UBOOT_CUSTOM_DTS_PATH
string "Device Tree Source file paths"
help
- Space-separated list of paths to device tree source files
- that will be copied to arch/ARCH/dts/ before starting the
- build.
+ Space-separated paths to device tree source files to copy into
+ source tree before building.
To use this device tree source file, the U-Boot configuration
file must refer to it.
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 5b3f46ac74..05972f6a79 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -426,10 +426,29 @@ endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
UBOOT_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH))
+# Linux uses arm64 where UBOOT_ARCH is arm.
+define UBOOT_INSTALL_CUSTOM_DTS
+ arch_dir="arch/$(UBOOT_ARCH)/dts"; \
+ dts_dir="$$arch_dir"; \
+ if grep -q "^CONFIG_OF_UPSTREAM=y" $(@D)/.config; then \
+ if grep -q "^CONFIG_ARM64=y" $(@D)/.config; then \
+ dts_dir="dts/upstream/src/arm64"; \
+ else \
+ dts_dir="dts/upstream/src/$(UBOOT_ARCH)"; \
+ fi; \
+ dt=$$(sed -n 's/^CONFIG_DEFAULT_DEVICE_TREE="\(.*\)"$$/\1/p' $(@D)/.config); \
+ case "$$dt" in */*) dts_dir="$$dts_dir/$${dt%/*}";; esac; \
+ fi; \
+ for dts in $(UBOOT_CUSTOM_DTS_PATH); do \
+ case "$$dts" in \
+ *u-boot.dtsi) cp -f "$$dts" $(@D)/$$arch_dir/;; \
+ *) cp -f "$$dts" $(@D)/$$dts_dir/;; \
+ esac; \
+ done
+endef
+
define UBOOT_BUILD_CMDS
- $(if $(UBOOT_CUSTOM_DTS_PATH),
- cp -f $(UBOOT_CUSTOM_DTS_PATH) $(@D)/arch/$(UBOOT_ARCH)/dts/
- )
+ $(if $(UBOOT_CUSTOM_DTS_PATH),$(UBOOT_INSTALL_CUSTOM_DTS))
$(TARGET_CONFIGURE_OPTS) \
PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
PKG_CONFIG_SYSROOT_DIR="/" \
--
2.56.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH v3] boot/uboot: support custom DTS with CONFIG_OF_UPSTREAM
2026-10-03 21:06 [Buildroot] [PATCH v3] boot/uboot: support custom DTS with CONFIG_OF_UPSTREAM Alexander Sverdlin
@ 2026-10-18 19:32 ` Thomas Petazzoni via buildroot
2026-10-18 19:45 ` Alexander Sverdlin
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-10-18 19:32 UTC (permalink / raw)
To: Alexander Sverdlin; +Cc: Vincent Jardin, Romain Naour, arnout, buildroot
On Sat, Oct 03, 2026 at 11:06:12PM +0200, Alexander Sverdlin wrote:
> Since U-Boot 2024.07, boards with CONFIG_OF_UPSTREAM build their device
> trees from dts/upstream/src/<arch>/<vendor>/ instead of arch/<arch>/dts/,
> so the files copied by BR2_TARGET_UBOOT_CUSTOM_DTS_PATH were misplaced.
>
> Derive the destination from the U-Boot configuration, including the vendor
> sub-directory taken from CONFIG_DEFAULT_DEVICE_TREE.
>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Thanks for the patch. However, I don't really understand the
use-case. If your board DT is not in the upstream Linux kernel, why
would you enable CONFIG_OF_UPSTREAM in the first place?
The whole point of CONFIG_OF_UPSTREAM=y is to tell U-Boot "use the DT
from the upstream kernel". But if you have to copy your own DT, it
means your board DT is not in upstream Linux. So, just disable
CONFIG_OF_UPSTREAM in your U-Boot configuration, and use the existing
BR2_TARGET_UBOOT_CUSTOM_DTS_PATH option that copies to arch/ARCH/dts/
and does the job.
Could you clarify why we would want this change? I'm kind of missing
the point.
Thanks a lot!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH v3] boot/uboot: support custom DTS with CONFIG_OF_UPSTREAM
2026-10-18 19:32 ` Thomas Petazzoni via buildroot
@ 2026-10-18 19:45 ` Alexander Sverdlin
2026-10-19 7:42 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Sverdlin @ 2026-10-18 19:45 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: Vincent Jardin, Romain Naour, arnout, buildroot
Hi Thomas!
On Sun, 2026-10-18 at 21:32 +0200, Thomas Petazzoni wrote:
> > Since U-Boot 2024.07, boards with CONFIG_OF_UPSTREAM build their device
> > trees from dts/upstream/src/<arch>/<vendor>/ instead of arch/<arch>/dts/,
> > so the files copied by BR2_TARGET_UBOOT_CUSTOM_DTS_PATH were misplaced.
> >
> > Derive the destination from the U-Boot configuration, including the vendor
> > sub-directory taken from CONFIG_DEFAULT_DEVICE_TREE.
> >
> > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
>
> Thanks for the patch. However, I don't really understand the
> use-case. If your board DT is not in the upstream Linux kernel, why
> would you enable CONFIG_OF_UPSTREAM in the first place?
>
> The whole point of CONFIG_OF_UPSTREAM=y is to tell U-Boot "use the DT
> from the upstream kernel". But if you have to copy your own DT, it
> means your board DT is not in upstream Linux. So, just disable
> CONFIG_OF_UPSTREAM in your U-Boot configuration, and use the existing
> BR2_TARGET_UBOOT_CUSTOM_DTS_PATH option that copies to arch/ARCH/dts/
> and does the job.
>
> Could you clarify why we would want this change? I'm kind of missing
> the point.
This is indeed a valid point!
I've been looking into it from the point of implementing a BSP for a board
which have been already merged into upstream Linux, but not into U-Boot
yet, but you are right, for this intermediate step I'm not forced to
use CONFIG_OF_UPSTREAM even if it would be used for the same board at
some point in future (when the DTs will be merged into U-Boot as well).
Sorry for the noise, let's ignore the patch for now!
--
Alexander Sverdlin.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH v3] boot/uboot: support custom DTS with CONFIG_OF_UPSTREAM
2026-10-18 19:45 ` Alexander Sverdlin
@ 2026-10-19 7:42 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-10-19 7:42 UTC (permalink / raw)
To: Alexander Sverdlin; +Cc: Vincent Jardin, Romain Naour, arnout, buildroot
On Sun, Oct 18, 2026 at 09:45:45PM +0200, Alexander Sverdlin wrote:
> > Could you clarify why we would want this change? I'm kind of missing
> > the point.
>
> This is indeed a valid point!
> I've been looking into it from the point of implementing a BSP for a board
> which have been already merged into upstream Linux, but not into U-Boot
> yet, but you are right, for this intermediate step I'm not forced to
> use CONFIG_OF_UPSTREAM even if it would be used for the same board at
> some point in future (when the DTs will be merged into U-Boot as well).
>
> Sorry for the noise, let's ignore the patch for now!
Thanks for your feedback! I'll mark the patch as Rejected then.
Best regards,
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-19 7:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-03 21:06 [Buildroot] [PATCH v3] boot/uboot: support custom DTS with CONFIG_OF_UPSTREAM Alexander Sverdlin
2026-10-18 19:32 ` Thomas Petazzoni via buildroot
2026-10-18 19:45 ` Alexander Sverdlin
2026-10-19 7:42 ` Thomas Petazzoni via buildroot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.