1 # SPDX-License-Identifier: GPL-2.0+
3 # Copyright (c) 2011 The Chromium OS Authors.
5 # This Makefile builds the internal U-Boot fdt if CONFIG_OF_CONTROL is
6 # enabled. See doc/README.fdt-control for more details.
8 DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
16 DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
19 $(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE
21 $(call if_changed,fdtgrep)
23 ifeq ($(CONFIG_OF_DTB_PROPS_REMOVE),y)
24 $(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
25 $(call if_changed,fdt_rm_props)
27 $(obj)/dt.dtb: $(DTB) FORCE
28 $(call if_changed,shipped)
36 echo >&2 "Device Tree Source ($@) is not correctly specified."; \
37 echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"; \
38 echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument"; \
44 $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
46 ifeq ($(CONFIG_SPL_BUILD),y)
47 obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
48 # support "out-of-tree" build for dtb-spl
49 $(obj)/dt-spl.dtb.o: $(obj)/dt-spl.dtb.S FORCE
50 $(call if_changed_dep,as_o_S)
52 obj-$(CONFIG_OF_EMBED) := dt.dtb.o
55 # Target for U-Boot proper
60 spl_dtbs: $(obj)/dt-$(SPL_NAME).dtb
63 clean-files := dt.dtb.S
65 # Let clean descend into dts directories
66 subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts ../arch/powerpc/dts ../arch/riscv/dts