]> git.ipfire.org Git - thirdparty/u-boot.git/blob - dts/Makefile
Merge tag 'u-boot-socfpga-next-20240319' of https://source.denx.de/u-boot/custodians...
[thirdparty/u-boot.git] / dts / Makefile
1 # SPDX-License-Identifier: GPL-2.0+
2 #
3 # Copyright (c) 2011 The Chromium OS Authors.
4
5 # This Makefile builds the internal U-Boot fdt if CONFIG_OF_CONTROL is
6 # enabled. See doc/README.fdt-control for more details.
7
8 DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
9 ifeq ($(DEVICE_TREE),)
10 DEVICE_TREE := unset
11 endif
12
13 ifeq ($(CONFIG_OF_UPSTREAM),y)
14 ifeq ($(CONFIG_ARM64),y)
15 dt_dir := dts/upstream/src/arm64
16 else
17 dt_dir := dts/upstream/src/$(ARCH)
18 endif
19 else
20 dt_dir := arch/$(ARCH)/dts
21 endif
22
23 ifneq ($(EXT_DTB),)
24 DTB := $(EXT_DTB)
25 else
26 DTB := $(dt_dir)/$(DEVICE_TREE).dtb
27 endif
28
29 $(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE
30 mkdir -p $(dir $@)
31 $(call if_changed,fdtgrep)
32
33 ifeq ($(CONFIG_OF_DTB_PROPS_REMOVE),y)
34 $(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
35 $(call if_changed,fdt_rm_props)
36 else
37 $(obj)/dt.dtb: $(DTB) FORCE
38 $(call if_changed,shipped)
39 endif
40
41 targets += dt.dtb
42
43 $(DTB): arch-dtbs
44 $(Q)test -e $@ || ( \
45 echo >&2; \
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"; \
49 echo >&2; \
50 /bin/false)
51
52 PHONY += arch-dtbs
53 arch-dtbs:
54 $(Q)$(MAKE) $(build)=$(dt_dir) dtbs
55
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)
61 else
62 obj-$(CONFIG_OF_EMBED) := dt.dtb.o
63 endif
64
65 # Target for U-Boot proper
66 dtbs: $(obj)/dt.dtb
67 @:
68
69 # Target for SPL/TPL
70 spl_dtbs: $(obj)/dt-$(SPL_NAME).dtb
71 @:
72
73 clean-files := dt.dtb.S
74
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)