diff options
author | Rasmus Villemoes | 2022-01-10 14:34:41 +0100 |
---|---|---|
committer | Simon Glass | 2022-02-09 12:26:12 -0700 |
commit | 3609e1dc5f4d4c238dcd23e045ba6223310feffa (patch) | |
tree | 4996807e7871356e6b2f361cf57ca621c675999f | |
parent | 859703251251d9567f29ab10c0a29f98eb0aff5c (diff) |
dts: automatically build necessary .dtb files
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>
-rw-r--r-- | arch/arc/dts/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/dts/Makefile | 2 | ||||
-rw-r--r-- | arch/m68k/dts/Makefile | 2 | ||||
-rw-r--r-- | arch/microblaze/dts/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/dts/Makefile | 2 | ||||
-rw-r--r-- | arch/nds32/dts/Makefile | 2 | ||||
-rw-r--r-- | arch/nios2/dts/Makefile | 2 | ||||
-rw-r--r-- | arch/powerpc/dts/Makefile | 2 | ||||
-rw-r--r-- | arch/riscv/dts/Makefile | 2 | ||||
-rw-r--r-- | arch/sandbox/dts/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/dts/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/dts/Makefile | 2 | ||||
-rw-r--r-- | arch/xtensa/dts/Makefile | 2 | ||||
-rw-r--r-- | dts/Kconfig | 8 | ||||
-rw-r--r-- | scripts/Makefile.dts | 3 |
15 files changed, 33 insertions, 4 deletions
diff --git a/arch/arc/dts/Makefile b/arch/arc/dts/Makefile index 515fe1fe535..532a8131c59 100644 --- a/arch/arc/dts/Makefile +++ b/arch/arc/dts/Makefile @@ -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 diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 5a5706918ae..c1cec726cf0 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -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 diff --git a/arch/m68k/dts/Makefile b/arch/m68k/dts/Makefile index fdd435bc345..7988522eb98 100644 --- a/arch/m68k/dts/Makefile +++ b/arch/m68k/dts/Makefile @@ -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 diff --git a/arch/microblaze/dts/Makefile b/arch/microblaze/dts/Makefile index 4690dc1b9f0..427a8f9aaca 100644 --- a/arch/microblaze/dts/Makefile +++ b/arch/microblaze/dts/Makefile @@ -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 diff --git a/arch/mips/dts/Makefile b/arch/mips/dts/Makefile index 215283cfa05..95144b24dcf 100644 --- a/arch/mips/dts/Makefile +++ b/arch/mips/dts/Makefile @@ -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 diff --git a/arch/nds32/dts/Makefile b/arch/nds32/dts/Makefile index a8e23ad9ad8..5a09e3b45b3 100644 --- a/arch/nds32/dts/Makefile +++ b/arch/nds32/dts/Makefile @@ -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 diff --git a/arch/nios2/dts/Makefile b/arch/nios2/dts/Makefile index 0014acfdfb7..2b29fa90f6c 100644 --- a/arch/nios2/dts/Makefile +++ b/arch/nios2/dts/Makefile @@ -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 diff --git a/arch/powerpc/dts/Makefile b/arch/powerpc/dts/Makefile index 66d22ae8a45..a4b0d7ddc4f 100644 --- a/arch/powerpc/dts/Makefile +++ b/arch/powerpc/dts/Makefile @@ -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 diff --git a/arch/riscv/dts/Makefile b/arch/riscv/dts/Makefile index 90d3f35e6e3..5c15a0f303a 100644 --- a/arch/riscv/dts/Makefile +++ b/arch/riscv/dts/Makefile @@ -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 diff --git a/arch/sandbox/dts/Makefile b/arch/sandbox/dts/Makefile index 3e5dc67d53e..6cbc9bbcaa1 100644 --- a/arch/sandbox/dts/Makefile +++ b/arch/sandbox/dts/Makefile @@ -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 diff --git a/arch/sh/dts/Makefile b/arch/sh/dts/Makefile index e423bfd5664..144fd3e7d22 100644 --- a/arch/sh/dts/Makefile +++ b/arch/sh/dts/Makefile @@ -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 diff --git a/arch/x86/dts/Makefile b/arch/x86/dts/Makefile index 5c8c05ec499..cd77f4c4e81 100644 --- a/arch/x86/dts/Makefile +++ b/arch/x86/dts/Makefile @@ -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) diff --git a/arch/xtensa/dts/Makefile b/arch/xtensa/dts/Makefile index 06ee25d2da9..fbbdefaf2cf 100644 --- a/arch/xtensa/dts/Makefile +++ b/arch/xtensa/dts/Makefile @@ -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 += diff --git a/dts/Kconfig b/dts/Kconfig index 4de1a70efce..b19912d10dd 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -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 index 00000000000..2561025da82 --- /dev/null +++ b/scripts/Makefile.dts @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +dtb-y += $(patsubst %,%.dtb,$(subst ",,$(CONFIG_$(SPL_)OF_LIST))) |