diff mbox series

[v1,2/5] dts: allow dts files in board directory

Message ID 20211217230131.2715940-3-troy.kisky@boundarydevices.com
State Deferred
Delegated to: Tom Rini
Headers show
Series Move board specific files to board directory | expand

Commit Message

Troy Kisky Dec. 17, 2021, 11:01 p.m. UTC
Let the board specific dts files live in the board directory.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
---
 dts/Makefile         | 11 +++++++++--
 scripts/Makefile.lib |  1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

Comments

Simon Glass Dec. 28, 2021, 8:33 a.m. UTC | #1
Hi Troy,

On Fri, 17 Dec 2021 at 16:02, Troy Kisky <troy.kisky@boundarydevices.com> wrote:
>
> Let the board specific dts files live in the board directory.
>
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> ---
>  dts/Makefile         | 11 +++++++++--
>  scripts/Makefile.lib |  1 +
>  2 files changed, 10 insertions(+), 2 deletions(-)

I think .dts files should be built at the SoC level, at the finest.
Otherwise we might change a .dtsi and break something without
knowing...and it is very hard to know what other builds to do. This
seems to be heading towards target-specific building.

Regards,
Simon
Troy Kisky Jan. 6, 2022, 9:01 p.m. UTC | #2
On 12/28/2021 12:33 AM, Simon Glass wrote:
> Hi Troy,
> 
> On Fri, 17 Dec 2021 at 16:02, Troy Kisky <troy.kisky@boundarydevices.com> wrote:
>>
>> Let the board specific dts files live in the board directory.
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>> ---
>>  dts/Makefile         | 11 +++++++++--
>>  scripts/Makefile.lib |  1 +
>>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> I think .dts files should be built at the SoC level, at the finest.
> Otherwise we might change a .dtsi and break something without
> knowing...and it is very hard to know what other builds to do. This
> seems to be heading towards target-specific building.
> 
> Regards,
> Simon

I can try to address that in the next rev, if that is the only thing stopping it.

Thanks for the review.

Troy
diff mbox series

Patch

diff --git a/dts/Makefile b/dts/Makefile
index cb311138295..09b46f9fcfd 100644
--- a/dts/Makefile
+++ b/dts/Makefile
@@ -13,7 +13,9 @@  endif
 ifneq ($(EXT_DTB),)
 DTB := $(EXT_DTB)
 else
-DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
+ifneq "$(ARCH)" "arm64"
+DTB := $(patsubst $(srctree)/%.dts,%.dtb,$(shell find "$(srctree)/board/$(BOARDDIR)" $(srctree)/arch/$(ARCH)/dts/ -type f -name $(DEVICE_TREE).dts))
+endif
 endif
 
 $(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE
@@ -40,8 +42,13 @@  $(DTB): arch-dtbs
 	/bin/false)
 
 PHONY += arch-dtbs
+ifneq "$(patsubst board/$(BOARDDIR)/%,,$(DTB))" ""
 arch-dtbs:
 	$(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
+else
+arch-dtbs:
+	$(Q)$(MAKE) $(build)="board/$(BOARDDIR)" dtbs
+endif
 
 ifeq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
@@ -63,4 +70,4 @@  spl_dtbs: $(obj)/dt-$(SPL_NAME).dtb
 clean-files := dt.dtb.S
 
 # Let clean descend into dts directories
-subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts ../arch/powerpc/dts ../arch/riscv/dts
+subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts ../arch/powerpc/dts ../arch/riscv/dts ../$(patsubst $(srctree)/%/,%,$(dir $(shell find $(srctree)/board -type f -name "*.dtb")))
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 39f03398ed8..18fe42f378f 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -183,6 +183,7 @@  u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \
 
 # Modified for U-Boot
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
+		 -I$(srctree)/board/$(BOARDDIR)                          \
 		 -I$(srctree)/arch/$(ARCH)/dts                           \
 		 -I$(srctree)/arch/$(ARCH)/dts/include                   \
 		 -Iinclude                                               \