Makefile.dtbinst 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #
  9. # Traverse through subdirectories listed in $(dts-dirs).
  10. # ==========================================================================
  11. src := $(obj)
  12. PHONY := __dtbs_install
  13. __dtbs_install:
  14. export dtbinst-root ?= $(obj)
  15. include include/config/auto.conf
  16. include scripts/Kbuild.include
  17. include $(src)/Makefile
  18. PHONY += __dtbs_install_prep
  19. __dtbs_install_prep:
  20. ifeq ("$(dtbinst-root)", "$(obj)")
  21. $(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi
  22. $(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi
  23. $(Q)mkdir -p $(INSTALL_DTBS_PATH)
  24. endif
  25. dtbinst-files := $(dtb-y)
  26. dtbinst-dirs := $(dts-dirs)
  27. # Helper targets for Installing DTBs into the boot directory
  28. quiet_cmd_dtb_install = INSTALL $<
  29. cmd_dtb_install = mkdir -p $(2); cp $< $(2)
  30. install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj))
  31. $(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep
  32. $(dtbinst-files): %.dtb: $(obj)/%.dtb
  33. $(call cmd,dtb_install,$(install-dir))
  34. $(dtbinst-dirs):
  35. $(Q)$(MAKE) $(dtbinst)=$(obj)/$@
  36. PHONY += $(dtbinst-files) $(dtbinst-dirs)
  37. __dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
  38. .PHONY: $(PHONY)