Romain Naour 290f6bb45a linux: introduce BR2_LINUX_KERNEL_CUSTOM_DTS_DIR
Since Linux 6.12, the Buildroot option BR2_LINUX_KERNEL_CUSTOM_DTS_PATH
does not work as expected on arm, arm64, mips and riscv[1]. These are
the architectures that store the in-tree DTS files in vendor-specific
subdirectories of arch/$ARCH/boot/dts/.

BR2_LINUX_KERNEL_CUSTOM_DTS_PATH was introduced in Buildroot 2012.08
(commit 69fc497df0 "Rework support for the device tree"). At the time,
the kernel kept all in-tree DTS files directly in arch/$ARCH/boot/dts/,
and this is where Buildroot drops the user's custom DTS. Vendor-specific
subdirectories appeared in Linux v3.19 for the arm64 architecture, and
this scheme was later adopted by mips, riscv and arm.

For these architectures, Linux 6.12 (commit e7e2941300d2, "kbuild: split
device tree build rules into scripts/Makefile.dtbs") made the DTB build
infrastructure incompatible with the way
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH is implemented. This infrastructure now
expects all DTS files to be in vendor-specific subdirectories on the
architectures that use this scheme.

We can't update easily the current behavior of
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH since it expect a list of files but
can also be used "unexpectedly" with directories [2].

  BR2_LINUX_KERNEL_INTREE_DTS_NAME="st/stm32mp135f-dk-mx"
  BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="$(BR2_EXTERNAL_ST_PATH)/[...]/linux-dts/st"

In this case, the st directory is copied into the arch/$ARCH/boot/dts/
and BR2_LINUX_KERNEL_INTREE_DTS_NAME is used to build stm32mp135f-dk-mx dtb
as if it was intree.

Introduce BR2_LINUX_KERNEL_CUSTOM_DTS_DIR configuration
parameter to specify a list of directories that are copied as-is over
the arch/<arch>/boot/dts/ directory before building the device tree
blob:

  board/acmesystems/acqua-a5/dts/
  └── microchip
      └── at91-sama5d3_acqua.dts

defconfig:
  BR2_LINUX_KERNEL_CUSTOM_DTS_DIR="board/acmesystems/acqua-a5/dts"

Each dts file found is automatically added to the list of devicetree
to build.

BR2_LINUX_KERNEL_CUSTOM_DTS_DIR can also be used for external
devicetree overlays files:

  board/ti/am574x-idk/dts/
  └── ti
      └── omap
          └── am57xx-evm.dtso

With this new option, BR2_LINUX_KERNEL_CUSTOM_DTS_PATH is now deprecated.

Note: We want to create a list of dts files (LINUX_DTS_LIST) present in
diectrories listed by BR2_LINUX_KERNEL_CUSTOM_DTS_DIR. But
LINUX_DTS_LIST must not contain BR2_LINUX_KERNEL_CUSTOM_DTS_DIR
paths. Use GNU 'find' print format %P to print each dts file path
without their respective dts overlay directory path.
Do the same for LINUX_DTSO_LIST.

Thanks to Edgar Bonet for the initial contribution [3].

[1] https://lists.buildroot.org/pipermail/buildroot/2024-October/765463.html
[2] 541ba7d963/configs/st_stm32mp135f_dk_demo_defconfig (L21)
[3] https://lore.kernel.org/buildroot/93f83afb-6987-441c-8e06-dab4d43b828f@grenoble.cnrs.fr/

Cc: Michael Walle <michael@walle.cc>
Cc: Gaël PORTAY <gael.portay+rtone@gmail.com>
Reported-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
[Romain:
  - Rework the initial contribution by Edgar Bonet by
    BR2_LINUX_KERNEL_CUSTOM_DTS_DIR following
    Michael Walle comments and Gaël PORTAY review.
  - Reword the commit log accordingly.
]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2025-03-05 20:07:21 +01:00
2025-02-05 11:43:43 +01:00
2025-02-28 17:27:41 +01:00
2025-02-21 15:52:13 +01:00
2024-09-14 11:20:06 +02:00
2025-01-15 21:30:31 +01:00
2025-02-28 17:27:41 +01:00

Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.

The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html

To build and use the buildroot stuff, do the following:

1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images

You do not need to be root to build or run buildroot.  Have fun!

Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.

Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on OFTC IRC.

If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches
Description
No description provided
Readme 209 MiB
Languages
Makefile 62.4%
Python 19%
C 8.5%
Shell 6.1%
PHP 1.4%
Other 2.2%