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
:"%"=%)
13 ifeq ($(CONFIG_OF_UPSTREAM
),y
)
14 ifeq ($(CONFIG_ARM64
),y
)
15 dt_dir
:= dts
/upstream
/src
/arm64
17 dt_dir
:= dts
/upstream
/src
/$(ARCH
)
20 dt_dir
:= arch
/$(ARCH
)/dts
26 DTB
:= $(dt_dir
)/$(DEVICE_TREE
).dtb
29 $(obj
)/dt-
$(SPL_NAME
).dtb
: dts
/dt.dtb
$(objtree
)/tools
/fdtgrep FORCE
31 $(call if_changed
,fdtgrep
)
33 ifeq ($(CONFIG_OF_DTB_PROPS_REMOVE
),y
)
34 $(obj
)/dt.dtb
: $(DTB
) $(objtree
)/tools
/fdtgrep FORCE
35 $(call if_changed
,fdt_rm_props
)
37 $(obj
)/dt.dtb
: $(DTB
) FORCE
38 $(call if_changed
,shipped
)
46 echo
>&2 "Device Tree Source ($@) is not correctly specified."; \
47 echo
>&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"; \
48 echo
>&2 "or build with 'DEVICE_TREE=<device_tree>' argument"; \
54 $(Q
)$(MAKE
) $(build
)=$(dt_dir
) dtbs
56 ifeq ($(CONFIG_SPL_BUILD
),y
)
57 obj-
$(CONFIG_OF_EMBED
) := dt-spl.dtb.o
58 # support "out-of-tree" build for dtb-spl
59 $(obj
)/dt-spl.dtb.o
: $(obj
)/dt-spl.dtb.S FORCE
60 $(call if_changed_dep
,as_o_S
)
62 obj-
$(CONFIG_OF_EMBED
) := dt.dtb.o
65 # Target for U-Boot proper
70 spl_dtbs
: $(obj
)/dt-
$(SPL_NAME
).dtb
73 clean-files
:= dt.dtb.S
75 # Let clean descend into dts directories
76 subdir-
+= ..
/arch
/arc
/dts ..
/arch
/arm
/dts ..
/arch
/m68k
/dts ..
/arch
/microblaze
/dts \
77 ..
/arch
/mips
/dts ..
/arch
/nios2
/dts ..
/arch
/powerpc
/dts ..
/arch
/riscv
/dts \
78 ..
/arch
/sandbox
/dts ..
/arch
/sh
/dts ..
/arch
/x86
/dts ..
/arch
/xtensa
/dts \
79 .
/upstream
/src
/arm64 .
/upstream
/src
/$(ARCH
)