Skip to content

Commit

Permalink
kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
masahir0y authored and tobetter committed Apr 27, 2018
1 parent b80b5f7 commit a07046b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions scripts/Makefile.dtbinst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# INSTALL_DTBS_PATH directory or the default location:
#
# $INSTALL_PATH/dtbs/$KERNELRELEASE
#
# Traverse through subdirectories listed in $(dts-dirs).
# ==========================================================================

src := $(obj)
Expand All @@ -20,8 +18,8 @@ include include/config/auto.conf
include scripts/Kbuild.include
include $(src)/Makefile

dtbinst-files := $(dtb-y)
dtbinst-dirs := $(dts-dirs)
dtbinst-files := $(sort $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS), $(dtb-)))
dtbinst-dirs := $(subdir-y) $(subdir-m)

# Helper targets for Installing DTBs into the boot directory
quiet_cmd_dtb_install = INSTALL $<
Expand Down
5 changes: 5 additions & 0 deletions scripts/Makefile.lib
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ obj-dirs := $(dir $(multi-objs) $(obj-y))
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)
real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))

# DTB
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
extra-y += $(dtb-y)
extra-$(CONFIG_OF_ALL_DTBS) += $(dtb-)

# Add subdir path

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

0 comments on commit a07046b

Please sign in to comment.