Makefile.dtbinst 1.41 KB
Newer Older
1 2 3 4 5 6 7 8
# ==========================================================================
# 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
#
9
# Traverse through subdirectories listed in $(dts-dirs).
10 11 12 13 14 15 16
# ==========================================================================

src := $(obj)

PHONY := __dtbs_install
__dtbs_install:

17 18
export dtbinst-root ?= $(obj)

19 20
include include/config/auto.conf
include scripts/Kbuild.include
21
include $(src)/Makefile
22 23 24

PHONY += __dtbs_install_prep
__dtbs_install_prep:
25
ifeq ("$(dtbinst-root)", "$(obj)")
26 27 28
	$(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)
29
endif
30 31

dtbinst-files	:= $(dtb-y)
32
dtbinst-dirs	:= $(dts-dirs)
33 34 35

# Helper targets for Installing DTBs into the boot directory
quiet_cmd_dtb_install =	INSTALL $<
36 37 38 39 40 41 42 43
      cmd_dtb_install =	mkdir -p $(2); cp $< $(2)

install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj))

$(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep

$(dtbinst-files): %.dtb: $(obj)/%.dtb
	$(call cmd,dtb_install,$(install-dir))
44

45 46
$(dtbinst-dirs):
	$(Q)$(MAKE) $(dtbinst)=$(obj)/$@
47

48 49
PHONY += $(dtbinst-files) $(dtbinst-dirs)
__dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
50 51

.PHONY: $(PHONY)