Robert Richter | 9fb5e53 | 2014-09-03 15:29:24 +0200 | [diff] [blame] | 1 | # ========================================================================== |
| 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 Richter | 323a028 | 2014-09-03 16:17:02 +0200 | [diff] [blame] | 9 | # Traverse through subdirectories listed in $(dts-dirs). |
Robert Richter | 9fb5e53 | 2014-09-03 15:29:24 +0200 | [diff] [blame] | 10 | # ========================================================================== |
| 11 | |
| 12 | src := $(obj) |
| 13 | |
| 14 | PHONY := __dtbs_install |
| 15 | __dtbs_install: |
| 16 | |
Robert Richter | 323a028 | 2014-09-03 16:17:02 +0200 | [diff] [blame] | 17 | export dtbinst-root ?= $(obj) |
| 18 | |
Robert Richter | 9fb5e53 | 2014-09-03 15:29:24 +0200 | [diff] [blame] | 19 | include include/config/auto.conf |
| 20 | include scripts/Kbuild.include |
Masahiro Yamada | 5f655c7 | 2015-03-27 20:43:37 +0900 | [diff] [blame] | 21 | include $(src)/Makefile |
Robert Richter | 9fb5e53 | 2014-09-03 15:29:24 +0200 | [diff] [blame] | 22 | |
| 23 | PHONY += __dtbs_install_prep |
| 24 | __dtbs_install_prep: |
Robert Richter | 323a028 | 2014-09-03 16:17:02 +0200 | [diff] [blame] | 25 | ifeq ("$(dtbinst-root)", "$(obj)") |
Robert Richter | 9fb5e53 | 2014-09-03 15:29:24 +0200 | [diff] [blame] | 26 | $(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 Richter | 323a028 | 2014-09-03 16:17:02 +0200 | [diff] [blame] | 29 | endif |
Robert Richter | 9fb5e53 | 2014-09-03 15:29:24 +0200 | [diff] [blame] | 30 | |
| 31 | dtbinst-files := $(dtb-y) |
Robert Richter | 323a028 | 2014-09-03 16:17:02 +0200 | [diff] [blame] | 32 | dtbinst-dirs := $(dts-dirs) |
Robert Richter | 9fb5e53 | 2014-09-03 15:29:24 +0200 | [diff] [blame] | 33 | |
| 34 | # Helper targets for Installing DTBs into the boot directory |
| 35 | quiet_cmd_dtb_install = INSTALL $< |
Robert Richter | 323a028 | 2014-09-03 16:17:02 +0200 | [diff] [blame] | 36 | cmd_dtb_install = mkdir -p $(2); cp $< $(2) |
Robert Richter | 9fb5e53 | 2014-09-03 15:29:24 +0200 | [diff] [blame] | 37 | |
Robert Richter | 323a028 | 2014-09-03 16:17:02 +0200 | [diff] [blame] | 38 | install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj)) |
Robert Richter | 9fb5e53 | 2014-09-03 15:29:24 +0200 | [diff] [blame] | 39 | |
Robert Richter | 323a028 | 2014-09-03 16:17:02 +0200 | [diff] [blame] | 40 | $(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 | |
| 48 | PHONY += $(dtbinst-files) $(dtbinst-dirs) |
| 49 | __dtbs_install: $(dtbinst-files) $(dtbinst-dirs) |
Robert Richter | 9fb5e53 | 2014-09-03 15:29:24 +0200 | [diff] [blame] | 50 | |
| 51 | .PHONY: $(PHONY) |