Makefile.dtbinst 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # SPDX-License-Identifier: GPL-2.0
  2. # ==========================================================================
  3. # Installing dtb files
  4. #
  5. # Installs all dtb files listed in $(dtb-y) either in the
  6. # INSTALL_DTBS_PATH directory or the default location:
  7. #
  8. # $INSTALL_PATH/dtbs/$KERNELRELEASE
  9. #
  10. # Traverse through subdirectories listed in $(dts-dirs).
  11. # ==========================================================================
  12. src := $(obj)
  13. PHONY := __dtbs_install
  14. __dtbs_install:
  15. export dtbinst_root ?= $(obj)
  16. include include/config/auto.conf
  17. include scripts/Kbuild.include
  18. include $(src)/Makefile
  19. dtbinst-files := $(dtb-y)
  20. dtbinst-dirs := $(dts-dirs)
  21. # Helper targets for Installing DTBs into the boot directory
  22. quiet_cmd_dtb_install = INSTALL $<
  23. cmd_dtb_install = mkdir -p $(2); cp $< $(2)
  24. install-dir = $(patsubst $(dtbinst_root)%,$(INSTALL_DTBS_PATH)%,$(obj))
  25. $(dtbinst-files): %.dtb: $(obj)/%.dtb
  26. $(call cmd,dtb_install,$(install-dir))
  27. $(dtbinst-dirs):
  28. $(Q)$(MAKE) $(dtbinst)=$(obj)/$@
  29. PHONY += $(dtbinst-files) $(dtbinst-dirs)
  30. __dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
  31. .PHONY: $(PHONY)