Makefile.dtbinst 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. src := $(obj)
  11. PHONY := __dtbs_install
  12. __dtbs_install:
  13. export dtbinst_root ?= $(obj)
  14. include include/config/auto.conf
  15. include scripts/Kbuild.include
  16. include $(src)/Makefile
  17. dtbinst-files := $(sort $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS), $(dtb-)))
  18. dtbinst-dirs := $(subdir-y) $(subdir-m)
  19. # Helper targets for Installing DTBs into the boot directory
  20. quiet_cmd_dtb_install = INSTALL $<
  21. cmd_dtb_install = mkdir -p $(2); cp $< $(2)
  22. install-dir = $(patsubst $(dtbinst_root)%,$(INSTALL_DTBS_PATH)%,$(obj))
  23. $(dtbinst-files): %.dtb: $(obj)/%.dtb
  24. $(call cmd,dtb_install,$(install-dir))
  25. $(dtbinst-dirs):
  26. $(Q)$(MAKE) $(dtbinst)=$(obj)/$@
  27. PHONY += $(dtbinst-files) $(dtbinst-dirs)
  28. __dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
  29. .PHONY: $(PHONY)