Building out of tree dtbs

From: Chris Packham
Date: Tue Jan 04 2022 - 22:30:41 EST


Hi All,

I had a quick search of the devicetree mailing list and didn't find
anything relevant so here goes...

I'm looking at how best to go about managing out of tree devicetrees for
our internal build system. If the devicetrees for our boards were
completely standalone there would be no problem we could just invoke dtc
directly and produce the dtbs we're after. But we'd like to have the C
preprocessor and dtc pick up the in-tree dtsi files for the various
SoCs/IP blocks that we use.

I can do (and have done) something where we manually invoke gcc -E and
dtc with the relevant -I/-i directives (as well as the various other
arguments that the kernel build passes). But this seems very fragile and
I expect will break in the near future.

Buildroot seems to solve the problem by copying the out of tree files
into the kernel source tree[1]. This works but it ends up putting
untracked files into the source tree.

What would be really neat is if something like the mechanism for
building an out of tree module were possible (i.e. make -C
`path/to/kernel/source M=$PWD). Other than not being anyone's itch to
scratch is there any reason this hasn't been done?

Any guidance on this would be much appreciated.

Thanks,
Chris

--
[1] - https://git.buildroot.net/buildroot/tree/linux/linux.mk#n434