Makefile.dtbinst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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)mkdir -p $(INSTALL_DTBS_PATH)
  22. endif
  23. dtbinst-files := $(dtb-y)
  24. dtbinst-dirs := $(dts-dirs)
  25. # Helper targets for Installing DTBs into the boot directory
  26. quiet_cmd_dtb_install = INSTALL $<
  27. cmd_dtb_install = mkdir -p $(2); cp $< $(2)
  28. install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj))
  29. $(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep
  30. $(dtbinst-files): %.dtb: $(obj)/%.dtb
  31. $(call cmd,dtb_install,$(install-dir))
  32. $(dtbinst-dirs):
  33. $(Q)$(MAKE) $(dtbinst)=$(obj)/$@
  34. PHONY += $(dtbinst-files) $(dtbinst-dirs)
  35. __dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
  36. .PHONY: $(PHONY)