Makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # SPDX-License-Identifier: GPL-2.0+
  2. #
  3. # Copyright (c) 2011 The Chromium OS Authors.
  4. # This Makefile builds the internal U-Boot fdt if CONFIG_OF_CONTROL is
  5. # enabled. See doc/README.fdt-control for more details.
  6. DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
  7. ifeq ($(DEVICE_TREE),)
  8. DEVICE_TREE := unset
  9. endif
  10. ifneq ($(EXT_DTB),)
  11. DTB := $(EXT_DTB)
  12. else
  13. DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
  14. endif
  15. $(obj)/dt-spl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
  16. $(call if_changed,fdtgrep)
  17. $(obj)/dt.dtb: $(DTB) FORCE
  18. $(call if_changed,shipped)
  19. targets += dt.dtb dt-spl.dtb
  20. $(DTB): arch-dtbs
  21. $(Q)test -e $@ || ( \
  22. echo >&2; \
  23. echo >&2 "Device Tree Source is not correctly specified."; \
  24. echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"; \
  25. echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument"; \
  26. echo >&2; \
  27. /bin/false)
  28. PHONY += arch-dtbs
  29. arch-dtbs:
  30. $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
  31. ifeq ($(CONFIG_SPL_BUILD),y)
  32. obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
  33. # support "out-of-tree" build for dtb-spl
  34. $(obj)/dt-spl.dtb.o: $(obj)/dt-spl.dtb.S FORCE
  35. $(call if_changed_dep,as_o_S)
  36. else
  37. obj-$(CONFIG_OF_EMBED) := dt.dtb.o
  38. endif
  39. dtbs: $(obj)/dt.dtb $(obj)/dt-spl.dtb
  40. @:
  41. clean-files := dt.dtb.S dt-spl.dtb.S
  42. # Let clean descend into dts directories
  43. subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts ../arch/powerpc/dts ../arch/riscv/dts ../arch/csky/dts