Skip to content

Commit

Permalink
dts, kbuild: Factor out dtbs install rules to Makefile.dtbinst
Browse files Browse the repository at this point in the history
Move dtbs install rules to Makefile.dtbinst. This change is needed to
implement support for dts vendor subdirs. The change makes Makefiles
easier and smaller as no longer the dtbs_install rule needs to be
defined. Another advantage is that install goals are not encoded in
targets anymore (%.dtb_dtbinst_).

Signed-off-by: Robert Richter <[email protected]>
  • Loading branch information
Robert Richter committed Oct 21, 2014
1 parent 862f464 commit 9fb5e53
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 18 deletions.
6 changes: 5 additions & 1 deletion arch/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,13 @@ $(INSTALL_TARGETS):
$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@

PHONY += dtbs dtbs_install
dtbs dtbs_install: prepare scripts

dtbs: prepare scripts
$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $@

dtbs_install:
$(Q)$(MAKE) $(dtbinst)=$(boot)/dts MACHINE=$(MACHINE)

# We use MRPROPER_FILES and CLEAN_FILES now
archclean:
$(Q)$(MAKE) $(clean)=$(boot)
Expand Down
2 changes: 0 additions & 2 deletions arch/arm/boot/dts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -527,5 +527,3 @@ dtbs: $(addprefix $(obj)/, $(dtb-y))
$(Q)rm -f $(obj)/../*.dtb

clean-files := *.dtb

dtbs_install: $(addsuffix _dtbinst_, $(dtb-y))
6 changes: 5 additions & 1 deletion arch/arm64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@ zinstall install: vmlinux
$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@

PHONY += dtbs dtbs_install
dtbs dtbs_install: prepare scripts

dtbs: prepare scripts
$(Q)$(MAKE) $(build)=$(boot)/dts $@

dtbs_install:
$(Q)$(MAKE) $(dtbinst)=$(boot)/dts

PHONY += vdso_install
vdso_install:
$(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
Expand Down
2 changes: 0 additions & 2 deletions arch/arm64/boot/dts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ targets += $(dtb-y)
dtbs: $(addprefix $(obj)/, $(dtb-y))

clean-files := *.dtb

dtbs_install: $(addsuffix _dtbinst_, $(dtb-y))
6 changes: 6 additions & 0 deletions scripts/Kbuild.include
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ build := -f $(srctree)/scripts/Makefile.build obj
# $(Q)$(MAKE) $(modbuiltin)=dir
modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj

###
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
# Usage:
# $(Q)$(MAKE) $(dtbinst)=dir
dtbinst := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.dtbinst obj

# Prefix -I with $(srctree) if it is not an absolute path.
# skip if -I has no parameter
addtree = $(if $(patsubst -I%,%,$(1)), \
Expand Down
38 changes: 38 additions & 0 deletions scripts/Makefile.dtbinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ==========================================================================
# Installing dtb files
#
# Installs all dtb files listed in $(dtb-y) either in the
# INSTALL_DTBS_PATH directory or the default location:
#
# $INSTALL_PATH/dtbs/$KERNELRELEASE
#
# ==========================================================================

src := $(obj)

PHONY := __dtbs_install
__dtbs_install:

include include/config/auto.conf
include scripts/Kbuild.include
include $(srctree)/$(obj)/Makefile

PHONY += __dtbs_install_prep
__dtbs_install_prep:
$(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi
$(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi
$(Q)mkdir -p $(INSTALL_DTBS_PATH)

dtbinst-files := $(dtb-y)

# Helper targets for Installing DTBs into the boot directory
quiet_cmd_dtb_install = INSTALL $<
cmd_dtb_install = cp $< $(2)

$(dtbinst-files): %.dtb: $(obj)/%.dtb | __dtbs_install_prep
$(call cmd,dtb_install,$(INSTALL_DTBS_PATH))

PHONY += $(dtbinst-files)
__dtbs_install: $(dtbinst-files)

.PHONY: $(PHONY)
12 changes: 0 additions & 12 deletions scripts/Makefile.lib
Original file line number Diff line number Diff line change
Expand Up @@ -283,18 +283,6 @@ $(obj)/%.dtb: $(src)/%.dts FORCE

dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)

# Helper targets for Installing DTBs into the boot directory
quiet_cmd_dtb_install = INSTALL $<
cmd_dtb_install = cp $< $(2)

_dtbinst_pre_:
$(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi
$(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi
$(Q)mkdir -p $(INSTALL_DTBS_PATH)

%.dtb_dtbinst_: $(obj)/%.dtb _dtbinst_pre_
$(call cmd,dtb_install,$(INSTALL_DTBS_PATH))

# Bzip2
# ---------------------------------------------------------------------------

Expand Down

0 comments on commit 9fb5e53

Please sign in to comment.