Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. ifeq ($(CONFIG_OF_DTB_PROPS_REMOVE),y)
  18. $(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
  19. $(call if_changed,fdt_rm_props)
  20. else
  21. $(obj)/dt.dtb: $(DTB) FORCE
  22. $(call if_changed,shipped)
  23. endif
  24. targets += dt.dtb dt-spl.dtb
  25. $(DTB): arch-dtbs
  26. $(Q)test -e $@ || ( \
  27. echo >&2; \
  28. echo >&2 "Device Tree Source is not correctly specified."; \
  29. echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"; \
  30. echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument"; \
  31. echo >&2; \
  32. /bin/false)
  33. PHONY += arch-dtbs
  34. arch-dtbs:
  35. $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
  36. ifeq ($(CONFIG_SPL_BUILD),y)
  37. obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
  38. # support "out-of-tree" build for dtb-spl
  39. $(obj)/dt-spl.dtb.o: $(obj)/dt-spl.dtb.S FORCE
  40. $(call if_changed_dep,as_o_S)
  41. else
  42. obj-$(CONFIG_OF_EMBED) := dt.dtb.o
  43. endif
  44. dtbs: $(obj)/dt.dtb $(obj)/dt-spl.dtb
  45. @:
  46. clean-files := dt.dtb.S dt-spl.dtb.S
  47. # Let clean descend into dts directories
  48. subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts ../arch/powerpc/dts ../arch/riscv/dts