All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] dts: build the DTS from a directory outside the tree
@ 2026-11-10  7:52 Vincent Jardin
  2026-11-10  7:52 ` [PATCH v2 1/3] scripts: Makefile.dts: build the device tree with DEVICE_TREE= too Vincent Jardin
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Vincent Jardin @ 2026-11-10  7:52 UTC (permalink / raw)
  To: u-boot
  Cc: Markus Schneider-Pargmann, Denis Mukhin, E Shattow,
	Rasmus Villemoes, Simon Glass, Tom Rini, Suraj Kakade,
	Marek Vasut, Vincent Jardin,
	Jérémie Dautheribes (Schneider Electric)

A board whose DTS is not in U-Boot does not have a clean way to build it.

Today the build systems copy the sources into the tree and follow its
layout: Buildroot has copied BR2_TARGET_UBOOT_CUSTOM_DTS_PATH into
arch/<arch>/dts since 2017 [1][2], and had to learn
dts/upstream/src/<arch>/<vendor> for OF_UPSTREAM boards this September [3];
Yocto layers copy their .dts into arch/<arch>/dts and sed a dtb-y line
into its Makefile [4], copy their -u-boot.dtsi there [5], or tell the user
to patch the dts into the U-Boot source [6].

This series adds a way to build it from a directory outside the tree:

    make EXT_DTS_DIR=/path/to/dts DEVICE_TREE=myboard

The benefits for the build systems:

- Buildroot: BR2_TARGET_UBOOT_CUSTOM_DTS_PATH could become a make option,
  EXT_DTS_DIR=<dir> in UBOOT_MAKE_OPTS, for every U-Boot layout at once,
  without the copy, the sed, or the question of where the -u-boot.dtsi
  goes: next to the .dts. A U-Boot upgrade no longer moves the files.

- Yocto: a BSP layer adds EXTRA_OEMAKE += "EXT_DTS_DIR=${UNPACKDIR}/dts"
  and keeps its device trees in the layer, versioned with the board, not
  with the U-Boot recipe; a UBOOT_CONFIG with several configurations
  passes its DEVICE_TREE per configuration as before.

- A bring-up, or a board whose device tree is maintained with the
  kernel's, keeps one device tree repository for both; nothing is copied
  into U-Boot until the board goes upstream.

Patch 1 makes "make DEVICE_TREE=<name>" build that device tree in the
directories built through scripts/Makefile.dts, which listed Kconfig's
only (the VisionFive 2 report [7]). Patch 2 looks for <name>-u-boot.dtsi
next to the .dts before arch/<arch>/dts. Patch 3 adds EXT_DTS_DIR.

It was tested on next at ecdcf9e365d (v2027.01-rc2) using:

- imx8mp_evk (OF_UPSTREAM, SPL, binman): with its .dts copied out of the
  tree, the external build gives dt.dtb, u-boot.dtb, u-boot.itb,
  spl/u-boot-spl.bin and flash.bin identical to the in-tree build,
  in the <vendor>/ layout. A *-u-boot.dtsi next to the source is taken
  first. Touching the source rebuilds, nothing else does.

[1] https://lists.buildroot.org/pipermail/buildroot/2017-April/553477.html
[2] https://gitlab.com/buildroot.org/buildroot/-/blob/master/boot/uboot/uboot.mk
[3] https://lists.buildroot.org/pipermail/buildroot/2026-September/809302.html
[4] https://github.com/karo-electronics/meta-karo/blob/85984e583a110855586938454964a259a323054f/recipes-bsp/u-boot/u-boot-karo.inc
[5] https://github.com/toradex/meta-toradex-tezi/blob/b53871a3df70e8a1d960523d9a4f186e2e1e2bd1/recipes-bsp/u-boot/u-boot-toradex-tezi.inc
[6] https://github.com/Xilinx/meta-xilinx/blob/f55a2890a9fdca73e14253d2383823eff513ba9b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx.inc
[7] https://lore.kernel.org/u-boot/034a4ae4-b579-42b0-b6b0-3a204737156f@proton.me/

Changes in v2:
- Rebase on next, v2027.01-rc2
- control.rst: for a WIP board that (Tom Rini)
- 3/3 log: wording: directories, not folders (Marek Vasut)

Vincent Jardin (3):
  scripts: Makefile.dts: build the device tree with DEVICE_TREE= too
  scripts: Makefile.lib: add check of -u-boot.dtsi in the device tree
    source
  dts: build the device tree from a directory outside the tree,
    EXT_DTS_DIR

 .gitignore                         |  1 +
 Makefile                           |  9 +++++-
 doc/develop/devicetree/control.rst | 49 ++++++++++++++++++++++++++++--
 dts/Makefile                       | 20 ++++++++++--
 scripts/Makefile.build             | 11 ++++++-
 scripts/Makefile.dts               | 12 +++++++-
 scripts/Makefile.lib               | 14 +++++++--
 7 files changed, 105 insertions(+), 11 deletions(-)

---
base-commit: ecdcf9e365df6249a57cd8cc946e7026804ff4ae
branch: for-upstream/ext-dts-dir-v2

-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-21 12:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10  7:52 [PATCH v2 0/3] dts: build the DTS from a directory outside the tree Vincent Jardin
2026-11-10  7:52 ` [PATCH v2 1/3] scripts: Makefile.dts: build the device tree with DEVICE_TREE= too Vincent Jardin
2026-11-10  7:52 ` [PATCH v2 2/3] scripts: Makefile.lib: add check of -u-boot.dtsi in the device tree source Vincent Jardin
2026-11-10  7:52 ` [PATCH v2 3/3] dts: build the device tree from a directory outside the tree, EXT_DTS_DIR Vincent Jardin
2026-11-20 17:46 ` [PATCH v2 0/3] dts: build the DTS from a directory outside the tree Tom Rini
2026-11-21 12:13   ` Vincent Jardin

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.