Skip to content

Commit a07046b

Browse files
masahir0ytobetter
authored andcommitted
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/<soc>/. 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 <[email protected]> Acked-by: Arnd Bergmann <[email protected]> [robh: corrected BUILTIN_DTB to CONFIG_BUILTIN_DTB] Signed-off-by: Rob Herring <[email protected]>
1 parent b80b5f7 commit a07046b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

scripts/Makefile.dtbinst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
# INSTALL_DTBS_PATH directory or the default location:
66
#
77
# $INSTALL_PATH/dtbs/$KERNELRELEASE
8-
#
9-
# Traverse through subdirectories listed in $(dts-dirs).
108
# ==========================================================================
119

1210
src := $(obj)
@@ -20,8 +18,8 @@ include include/config/auto.conf
2018
include scripts/Kbuild.include
2119
include $(src)/Makefile
2220

23-
dtbinst-files := $(dtb-y)
24-
dtbinst-dirs := $(dts-dirs)
21+
dtbinst-files := $(sort $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS), $(dtb-)))
22+
dtbinst-dirs := $(subdir-y) $(subdir-m)
2523

2624
# Helper targets for Installing DTBs into the boot directory
2725
quiet_cmd_dtb_install = INSTALL $<

scripts/Makefile.lib

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ obj-dirs := $(dir $(multi-objs) $(obj-y))
6969
real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)
7070
real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
7171

72+
# DTB
73+
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
74+
extra-y += $(dtb-y)
75+
extra-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
76+
7277
# Add subdir path
7378

7479
extra-y := $(addprefix $(obj)/,$(extra-y))

0 commit comments

Comments
 (0)