kbuild: simplify dtbs_install by reading the list of compiled DTBs
Retrieve the list of *.dtb(o) files from arch/*/boot/dts/dtbs-list instead of traversing the directory tree again. Please note that 'make dtbs_install' installs *.dtb(o) files directly added to dtb-y because scripts/Makefile.dtbinst installs $(dtb-y) without expanding the -dtbs suffix. This commit preserves this behavior. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
24507871c3
commit
8f66864cee
2
Makefile
2
Makefile
|
@ -1411,7 +1411,7 @@ endif
|
||||||
dtbs_check: dtbs
|
dtbs_check: dtbs
|
||||||
|
|
||||||
dtbs_install:
|
dtbs_install:
|
||||||
$(Q)$(MAKE) $(dtbinst)=$(dtstree) dst=$(INSTALL_DTBS_PATH)
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.dtbinst obj=$(dtstree)
|
||||||
|
|
||||||
ifdef CONFIG_OF_EARLY_FLATTREE
|
ifdef CONFIG_OF_EARLY_FLATTREE
|
||||||
all: dtbs
|
all: dtbs
|
||||||
|
|
|
@ -113,12 +113,6 @@ endef
|
||||||
# $(Q)$(MAKE) $(build)=dir
|
# $(Q)$(MAKE) $(build)=dir
|
||||||
build := -f $(srctree)/scripts/Makefile.build obj
|
build := -f $(srctree)/scripts/Makefile.build obj
|
||||||
|
|
||||||
###
|
|
||||||
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
|
|
||||||
# Usage:
|
|
||||||
# $(Q)$(MAKE) $(dtbinst)=dir
|
|
||||||
dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=
|
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=
|
||||||
# Usage:
|
# Usage:
|
||||||
|
|
|
@ -8,32 +8,36 @@
|
||||||
# $INSTALL_PATH/dtbs/$KERNELRELEASE
|
# $INSTALL_PATH/dtbs/$KERNELRELEASE
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
|
|
||||||
src := $(obj)
|
|
||||||
|
|
||||||
PHONY := __dtbs_install
|
PHONY := __dtbs_install
|
||||||
__dtbs_install:
|
__dtbs_install:
|
||||||
|
|
||||||
include include/config/auto.conf
|
include include/config/auto.conf
|
||||||
include $(srctree)/scripts/Kbuild.include
|
include $(srctree)/scripts/Kbuild.include
|
||||||
include $(kbuild-file)
|
|
||||||
|
|
||||||
dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
|
dst := $(INSTALL_DTBS_PATH)
|
||||||
subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m))
|
|
||||||
|
|
||||||
__dtbs_install: $(dtbs) $(subdirs)
|
|
||||||
@:
|
|
||||||
|
|
||||||
quiet_cmd_dtb_install = INSTALL $@
|
quiet_cmd_dtb_install = INSTALL $@
|
||||||
cmd_dtb_install = install -D $< $@
|
cmd_dtb_install = install -D $< $@
|
||||||
|
|
||||||
$(dst)/%.dtb: $(obj)/%.dtb
|
$(dst)/%: $(obj)/%
|
||||||
$(call cmd,dtb_install)
|
$(call cmd,dtb_install)
|
||||||
|
|
||||||
$(dst)/%.dtbo: $(obj)/%.dtbo
|
dtbs := $(patsubst $(obj)/%,%,$(call read-file, $(obj)/dtbs-list))
|
||||||
$(call cmd,dtb_install)
|
|
||||||
|
|
||||||
PHONY += $(subdirs)
|
ifdef CONFIG_ARCH_WANT_FLAT_DTB_INSTALL
|
||||||
$(subdirs):
|
|
||||||
$(Q)$(MAKE) $(dtbinst)=$@ dst=$(if $(CONFIG_ARCH_WANT_FLAT_DTB_INSTALL),$(dst),$(patsubst $(obj)/%,$(dst)/%,$@))
|
define gen_install_rules
|
||||||
|
$(dst)/%: $(obj)/$(1)%
|
||||||
|
$$(call cmd,dtb_install)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d))))
|
||||||
|
|
||||||
|
dtbs := $(notdir $(dtbs))
|
||||||
|
|
||||||
|
endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL
|
||||||
|
|
||||||
|
__dtbs_install: $(addprefix $(dst)/, $(dtbs))
|
||||||
|
@:
|
||||||
|
|
||||||
.PHONY: $(PHONY)
|
.PHONY: $(PHONY)
|
||||||
|
|
Loading…
Reference in New Issue