From 7e7962dd1a5307bca1793a3f9a98ad5514306c7a Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sun, 5 Nov 2017 14:30:53 +0900 Subject: kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile. It could be a race problem when building DTBS in parallel. Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor sub-directories, so this broke when Broadcom added one more hierarchy in arch/arm64/boot/dts/broadcom//. One idea to fix the issues in a clean way is to move DTB handling to Kbuild core scripts. Makefile.dtbinst already recognizes dtb-y natively, so it should not hurt to do so. Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is enabled. All clutter things in Makefiles go away. As a bonus clean-up, I also removed dts-dirs. Just use subdir-y directly to traverse sub-directories. Signed-off-by: Masahiro Yamada Acked-by: Arnd Bergmann [robh: corrected BUILTIN_DTB to CONFIG_BUILTIN_DTB] Signed-off-by: Rob Herring --- arch/mips/boot/dts/Makefile | 32 +++++++++++++------------------ arch/mips/boot/dts/brcm/Makefile | 2 -- arch/mips/boot/dts/cavium-octeon/Makefile | 2 -- arch/mips/boot/dts/img/Makefile | 2 -- arch/mips/boot/dts/ingenic/Makefile | 2 -- arch/mips/boot/dts/lantiq/Makefile | 2 -- arch/mips/boot/dts/mti/Makefile | 2 -- arch/mips/boot/dts/netlogic/Makefile | 2 -- arch/mips/boot/dts/ni/Makefile | 2 -- arch/mips/boot/dts/pic32/Makefile | 2 -- arch/mips/boot/dts/qca/Makefile | 2 -- arch/mips/boot/dts/ralink/Makefile | 2 -- arch/mips/boot/dts/xilfpga/Makefile | 2 -- 13 files changed, 13 insertions(+), 43 deletions(-) (limited to 'arch/mips') diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile index 7891ffa487d6..bc4ce85db136 100644 --- a/arch/mips/boot/dts/Makefile +++ b/arch/mips/boot/dts/Makefile @@ -1,20 +1,14 @@ -dts-dirs += brcm -dts-dirs += cavium-octeon -dts-dirs += img -dts-dirs += ingenic -dts-dirs += lantiq -dts-dirs += mti -dts-dirs += netlogic -dts-dirs += ni -dts-dirs += pic32 -dts-dirs += qca -dts-dirs += ralink -dts-dirs += xilfpga +subdir-y += brcm +subdir-y += cavium-octeon +subdir-y += img +subdir-y += ingenic +subdir-y += lantiq +subdir-y += mti +subdir-y += netlogic +subdir-y += ni +subdir-y += pic32 +subdir-y += qca +subdir-y += ralink +subdir-y += xilfpga -obj-y := $(addsuffix /, $(dts-dirs)) - -dtstree := $(srctree)/$(src) -dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(foreach d,$(dts-dirs), $(wildcard $(dtstree)/$(d)/*.dts))) - -always := $(dtb-y) -subdir-y := $(dts-dirs) +obj-$(CONFIG_BUILTIN_DTB) := $(addsuffix /, $(subdir-y)) diff --git a/arch/mips/boot/dts/brcm/Makefile b/arch/mips/boot/dts/brcm/Makefile index ad76130e8ca0..bacb13159857 100644 --- a/arch/mips/boot/dts/brcm/Makefile +++ b/arch/mips/boot/dts/brcm/Makefile @@ -37,5 +37,3 @@ obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) # Force kbuild to make empty built-in.o if necessary obj- += dummy.o - -always := $(dtb-y) diff --git a/arch/mips/boot/dts/cavium-octeon/Makefile b/arch/mips/boot/dts/cavium-octeon/Makefile index a6fb331de0ff..e9592a995349 100644 --- a/arch/mips/boot/dts/cavium-octeon/Makefile +++ b/arch/mips/boot/dts/cavium-octeon/Makefile @@ -4,5 +4,3 @@ obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) # Force kbuild to make empty built-in.o if necessary obj- += dummy.o - -always := $(dtb-y) diff --git a/arch/mips/boot/dts/img/Makefile b/arch/mips/boot/dts/img/Makefile index 135f98761671..a46d77390aed 100644 --- a/arch/mips/boot/dts/img/Makefile +++ b/arch/mips/boot/dts/img/Makefile @@ -5,5 +5,3 @@ obj-$(CONFIG_MACH_PISTACHIO) += pistachio_marduk.dtb.o # Force kbuild to make empty built-in.o if necessary obj- += dummy.o - -always := $(dtb-y) diff --git a/arch/mips/boot/dts/ingenic/Makefile b/arch/mips/boot/dts/ingenic/Makefile index e3d0ec1bf577..ddd0fafd120e 100644 --- a/arch/mips/boot/dts/ingenic/Makefile +++ b/arch/mips/boot/dts/ingenic/Makefile @@ -5,5 +5,3 @@ obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) # Force kbuild to make empty built-in.o if necessary obj- += dummy.o - -always := $(dtb-y) diff --git a/arch/mips/boot/dts/lantiq/Makefile b/arch/mips/boot/dts/lantiq/Makefile index 5976f089d038..586b1c9e580b 100644 --- a/arch/mips/boot/dts/lantiq/Makefile +++ b/arch/mips/boot/dts/lantiq/Makefile @@ -4,5 +4,3 @@ obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) # Force kbuild to make empty built-in.o if necessary obj- += dummy.o - -always := $(dtb-y) diff --git a/arch/mips/boot/dts/mti/Makefile b/arch/mips/boot/dts/mti/Makefile index 9a1a6dc2ef36..faf7ac44725a 100644 --- a/arch/mips/boot/dts/mti/Makefile +++ b/arch/mips/boot/dts/mti/Makefile @@ -5,5 +5,3 @@ obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) # Force kbuild to make empty built-in.o if necessary obj- += dummy.o - -always := $(dtb-y) diff --git a/arch/mips/boot/dts/netlogic/Makefile b/arch/mips/boot/dts/netlogic/Makefile index 6b2cf492db18..77ffb30c591b 100644 --- a/arch/mips/boot/dts/netlogic/Makefile +++ b/arch/mips/boot/dts/netlogic/Makefile @@ -8,5 +8,3 @@ obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) # Force kbuild to make empty built-in.o if necessary obj- += dummy.o - -always := $(dtb-y) diff --git a/arch/mips/boot/dts/ni/Makefile b/arch/mips/boot/dts/ni/Makefile index 094da7219905..6cd9c606f025 100644 --- a/arch/mips/boot/dts/ni/Makefile +++ b/arch/mips/boot/dts/ni/Makefile @@ -2,5 +2,3 @@ dtb-$(CONFIG_FIT_IMAGE_FDT_NI169445) += 169445.dtb # Force kbuild to make empty built-in.o if necessary obj- += dummy.o - -always := $(dtb-y) diff --git a/arch/mips/boot/dts/pic32/Makefile b/arch/mips/boot/dts/pic32/Makefile index 0ee591b15720..5a08e48dbabb 100644 --- a/arch/mips/boot/dts/pic32/Makefile +++ b/arch/mips/boot/dts/pic32/Makefile @@ -7,5 +7,3 @@ obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) # Force kbuild to make empty built-in.o if necessary obj- += dummy.o - -always := $(dtb-y) diff --git a/arch/mips/boot/dts/qca/Makefile b/arch/mips/boot/dts/qca/Makefile index 87cf351cff45..181db5d824ea 100644 --- a/arch/mips/boot/dts/qca/Makefile +++ b/arch/mips/boot/dts/qca/Makefile @@ -7,5 +7,3 @@ dtb-$(CONFIG_ATH79) += ar9331_tl_mr3020.dtb # Force kbuild to make empty built-in.o if necessary obj- += dummy.o - -always := $(dtb-y) diff --git a/arch/mips/boot/dts/ralink/Makefile b/arch/mips/boot/dts/ralink/Makefile index e0e3a9db8d76..7b64654c958c 100644 --- a/arch/mips/boot/dts/ralink/Makefile +++ b/arch/mips/boot/dts/ralink/Makefile @@ -9,5 +9,3 @@ obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) # Force kbuild to make empty built-in.o if necessary obj- += dummy.o - -always := $(dtb-y) diff --git a/arch/mips/boot/dts/xilfpga/Makefile b/arch/mips/boot/dts/xilfpga/Makefile index 8b9ea11bf730..77c809645d75 100644 --- a/arch/mips/boot/dts/xilfpga/Makefile +++ b/arch/mips/boot/dts/xilfpga/Makefile @@ -4,5 +4,3 @@ obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y)) # Force kbuild to make empty built-in.o if necessary obj- += dummy.o - -always := $(dtb-y) -- cgit v1.2.3