blob: 1c15717e0d5686972c1130fb718d0bc445c08dad [file] [log] [blame]
Robert Richter9fb5e532014-09-03 15:29:24 +02001# ==========================================================================
2# Installing dtb files
3#
4# Installs all dtb files listed in $(dtb-y) either in the
5# INSTALL_DTBS_PATH directory or the default location:
6#
7# $INSTALL_PATH/dtbs/$KERNELRELEASE
8#
Robert Richter323a0282014-09-03 16:17:02 +02009# Traverse through subdirectories listed in $(dts-dirs).
Robert Richter9fb5e532014-09-03 15:29:24 +020010# ==========================================================================
11
12src := $(obj)
13
14PHONY := __dtbs_install
15__dtbs_install:
16
Robert Richter323a0282014-09-03 16:17:02 +020017export dtbinst-root ?= $(obj)
18
Robert Richter9fb5e532014-09-03 15:29:24 +020019include include/config/auto.conf
20include scripts/Kbuild.include
Masahiro Yamada5f655c72015-03-27 20:43:37 +090021include $(src)/Makefile
Robert Richter9fb5e532014-09-03 15:29:24 +020022
23PHONY += __dtbs_install_prep
24__dtbs_install_prep:
Robert Richter323a0282014-09-03 16:17:02 +020025ifeq ("$(dtbinst-root)", "$(obj)")
Robert Richter9fb5e532014-09-03 15:29:24 +020026 $(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi
27 $(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi
28 $(Q)mkdir -p $(INSTALL_DTBS_PATH)
Robert Richter323a0282014-09-03 16:17:02 +020029endif
Robert Richter9fb5e532014-09-03 15:29:24 +020030
31dtbinst-files := $(dtb-y)
Robert Richter323a0282014-09-03 16:17:02 +020032dtbinst-dirs := $(dts-dirs)
Robert Richter9fb5e532014-09-03 15:29:24 +020033
34# Helper targets for Installing DTBs into the boot directory
35quiet_cmd_dtb_install = INSTALL $<
Robert Richter323a0282014-09-03 16:17:02 +020036 cmd_dtb_install = mkdir -p $(2); cp $< $(2)
Robert Richter9fb5e532014-09-03 15:29:24 +020037
Robert Richter323a0282014-09-03 16:17:02 +020038install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj))
Robert Richter9fb5e532014-09-03 15:29:24 +020039
Robert Richter323a0282014-09-03 16:17:02 +020040$(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep
41
42$(dtbinst-files): %.dtb: $(obj)/%.dtb
43 $(call cmd,dtb_install,$(install-dir))
44
45$(dtbinst-dirs):
46 $(Q)$(MAKE) $(dtbinst)=$(obj)/$@
47
48PHONY += $(dtbinst-files) $(dtbinst-dirs)
49__dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
Robert Richter9fb5e532014-09-03 15:29:24 +020050
51.PHONY: $(PHONY)