]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
dts: automatically build necessary .dtb files
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Mon, 10 Jan 2022 13:34:41 +0000 (14:34 +0100)
committerSimon Glass <sjg@chromium.org>
Wed, 9 Feb 2022 19:26:12 +0000 (12:26 -0700)
When building for a custom board, it is quite common to maintain a
private branch which include some defconfig and .dts files. But to
hook up those .dts files requires modifying a file "belonging" to
upstream U-Boot, the arch/*/dts/Makefile. Forward-porting that branch
to a newer upstream then often results in a conflict which, while it
is trivial to resolve by hand, makes it harder to have a CI do "try to
build our board against latest upstream".

The .config usually includes information on precisely what .dtb(s) are
needed, so to avoid having to modify the Makefile, simply add the
files in (SPL_)OF_LIST to dtb-y.

A technicality is that (SPL_)OF_LIST is not always defined, so rework
the Kconfig symbols so that (SPL_)OF_LIST is always defined (when
(SPL_)OF_CONTROL), but only prompted for in the cases which used to be
their "depends on".

nios2 and microblaze already have something like this in their
dts/Makefile, and the rationale in commit 41f59f68539 is similar to
the above. So this simply generalizes existing practice. Followup
patches could remove the logic in those two makefiles, just as there's
potential for moving some common boilerplate from all the
arch/*/dts/Makefile files to the new scripts/Makefile.dts.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 files changed:
arch/arc/dts/Makefile
arch/arm/dts/Makefile
arch/m68k/dts/Makefile
arch/microblaze/dts/Makefile
arch/mips/dts/Makefile
arch/nds32/dts/Makefile
arch/nios2/dts/Makefile
arch/powerpc/dts/Makefile
arch/riscv/dts/Makefile
arch/sandbox/dts/Makefile
arch/sh/dts/Makefile
arch/x86/dts/Makefile
arch/xtensa/dts/Makefile
dts/Kconfig
scripts/Makefile.dts [new file with mode: 0644]

index 515fe1fe53588b6e5cb269c670be75722103af6e..532a8131c599d64d7b7080e7cc04fd76f895e6fe 100644 (file)
@@ -8,6 +8,8 @@ dtb-$(CONFIG_TARGET_EMSDP) +=  emsdp.dtb
 dtb-$(CONFIG_TARGET_HSDK) +=  hsdk.dtb hsdk-4xd.dtb
 dtb-$(CONFIG_TARGET_IOT_DEVKIT) +=  iot_devkit.dtb
 
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 DTC_FLAGS += -R 4 -p 0x1000
index 5a5706918ae140bb184f162d1cdecb42529096d9..c1cec726cf0f6694bb49742b2c4d3653fc0b8689 100644 (file)
@@ -1205,6 +1205,8 @@ dtb-$(CONFIG_TARGET_EA_LPC3250DEVKITV2) += lpc3250-ea3250.dtb
 
 dtb-$(CONFIG_ARCH_QEMU) += qemu-arm.dtb qemu-arm64.dtb
 
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 # Add any required device tree compiler flags here
index fdd435bc345e7e358e918461b2d7d0d8f0469f5f..7988522eb98c283b7216b94a168d516fd74f7e8b 100644 (file)
@@ -18,6 +18,8 @@ dtb-$(CONFIG_TARGET_M5373EVB) += M5373EVB.dtb
 dtb-$(CONFIG_TARGET_AMCORE) += amcore.dtb
 dtb-$(CONFIG_TARGET_STMARK2) += stmark2.dtb
 
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 DTC_FLAGS += -R 4 -p 0x1000
index 4690dc1b9f07e212329ed87c40d604cd6f825924..427a8f9aaca35f70923a6c15813b5cbb9ec1c6ef 100644 (file)
@@ -2,6 +2,8 @@
 
 dtb-y += $(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)).dtb
 
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 DTC_FLAGS += -R 4 -p 0x1000
index 215283cfa05b1a77296790d6a6538583d1ac8d98..95144b24dcfaa5ce2220689030099c5433b55fb9 100644 (file)
@@ -34,6 +34,8 @@ dtb-$(CONFIG_SOC_JR2) += jr2_pcb110.dtb jr2_pcb111.dtb serval2_pcb112.dtb
 dtb-$(CONFIG_SOC_SERVALT) += servalt_pcb116.dtb
 dtb-$(CONFIG_SOC_SERVAL) += serval_pcb105.dtb serval_pcb106.dtb
 
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 # Add any required device tree compiler flags here
index a8e23ad9ad845952f0ff6b66f139ddfd1306f342..5a09e3b45b39cdd4cd1e12853413d2c39bb97da2 100644 (file)
@@ -2,6 +2,8 @@
 
 dtb-$(CONFIG_TARGET_ADP_AG101P) += ag101p.dtb
 dtb-$(CONFIG_TARGET_ADP_AE3XX) += ae3xx.dtb
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 DTC_FLAGS += -R 4 -p 0x1000
index 0014acfdfb764de14bdb3d65b0b558d9207a60b9..2b29fa90f6c810e19b3fab9c4e8ba7f6ab86086f 100644 (file)
@@ -2,6 +2,8 @@
 
 dtb-y += $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%).dtb
 
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 DTC_FLAGS += -R 4 -p 0x1000
index 66d22ae8a45db4304c8b34b0c0b40a27200fc404..a4b0d7ddc4ff872eb8bd2b40166ce8faf0816849 100644 (file)
@@ -30,6 +30,8 @@ dtb-$(CONFIG_TARGET_TUXX1) += kmtuxa1.dtb
 dtb-$(CONFIG_TARGET_MCR3000) += mcr3000.dtb
 dtb-$(CONFIG_TARGET_GAZERBEAM) += gazerbeam.dtb
 
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 # Add any required device tree compiler flags here
index 90d3f35e6e3ee04133cdaed2afd537c08c37b32f..5c15a0f303a1407217f05c529b3ebd0ee8566902 100644 (file)
@@ -8,6 +8,8 @@ dtb-$(CONFIG_TARGET_SIFIVE_UNLEASHED) += hifive-unleashed-a00.dtb
 dtb-$(CONFIG_TARGET_SIFIVE_UNMATCHED) += hifive-unmatched-a00.dtb
 dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb
 
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 DTC_FLAGS += -R 4 -p 0x1000
index 3e5dc67d53e515148aa62a859b91f23617009430..6cbc9bbcaa1ba9aae2dbe0a5a83775900ef730ff 100644 (file)
@@ -8,6 +8,8 @@ endif
 dtb-$(CONFIG_UT_DM) += test.dtb
 dtb-$(CONFIG_CMD_EXTENSION) += overlay0.dtbo overlay1.dtbo
 
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 DTC_FLAGS += -R 4 -p 0x1000
index e423bfd566436d94be5efac5d013487bfe3521e2..144fd3e7d2242f47203884c3cf28511e464648cb 100644 (file)
@@ -1,5 +1,7 @@
 dtb-y += sh7751-r2dplus.dtb
 
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 # Add any required device tree compiler flags here
index 5c8c05ec4995016dbde1174dd614e11289f9eb0b..cd77f4c4e814629bbb3d2abce5fee615e0821701 100644 (file)
@@ -22,6 +22,8 @@ dtb-y += bayleybay.dtb \
        slimbootloader.dtb \
        baytrail_som-db5800-som-6867.dtb
 
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 DTC_FLAGS += -R 4 -p $(if $(CONFIG_EFI_APP),0x8000,0x1000)
index 06ee25d2da9ba4ef327d4b0b99cfb211b575f21b..fbbdefaf2cf138cab66052b6f6661e29a2211cdd 100644 (file)
@@ -2,6 +2,8 @@
 
 dtb-$(CONFIG_XTFPGA) += ml605.dtb ml605_nommu.dtb kc705.dtb kc705_nommu.dtb
 
+include $(srctree)/scripts/Makefile.dts
+
 targets += $(dtb-y)
 
 DTC_FLAGS +=
index 4de1a70efce50245436146645a3fd82ab1a486f8..b19912d10ddd15cb38b961f2169875aec044df97 100644 (file)
@@ -157,8 +157,8 @@ config DEVICE_TREE_INCLUDES
          .dtsi files that will also be used.
 
 config OF_LIST
-       string "List of device tree files to include for DT control"
-       depends on SPL_LOAD_FIT || MULTI_DTB_FIT
+       string "List of device tree files to include for DT control" if SPL_LOAD_FIT || MULTI_DTB_FIT
+       depends on OF_CONTROL
        default DEFAULT_DEVICE_TREE
        help
          This option specifies a list of device tree files to use for DT
@@ -264,8 +264,8 @@ config SPL_MULTI_DTB_FIT
          capabilities, pad configurations).
 
 config SPL_OF_LIST
-       string "List of device tree files to include for DT control in SPL"
-       depends on SPL_MULTI_DTB_FIT
+       string "List of device tree files to include for DT control in SPL" if SPL_MULTI_DTB_FIT
+       depends on SPL_OF_CONTROL
        default OF_LIST
        help
          This option specifies a list of device tree files to use for DT
diff --git a/scripts/Makefile.dts b/scripts/Makefile.dts
new file mode 100644 (file)
index 0000000..2561025
--- /dev/null
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+dtb-y += $(patsubst %,%.dtb,$(subst ",,$(CONFIG_$(SPL_)OF_LIST)))