]> Git Repo - J-u-boot.git/blob - dts/Makefile
Merge tag 'u-boot-imx-master-20250127' of https://gitlab.denx.de/u-boot/custodians...
[J-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 ($(CONFIG_OF_UPSTREAM_INCLUDE_LOCAL_FALLBACK_DTBOS),)
24 local_dtbos := local-dtbos
25 else
26 local_dtbos :=
27 endif
28
29 ifneq ($(EXT_DTB),)
30 DTB := $(EXT_DTB)
31 else
32 DTB := $(dt_dir)/$(DEVICE_TREE).dtb
33 endif
34
35 $(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE
36         mkdir -p $(dir $@)
37         $(call if_changed,fdtgrep)
38
39 ifeq ($(CONFIG_OF_DTB_PROPS_REMOVE),y)
40 $(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
41         $(call if_changed,fdt_rm_props)
42 else
43 $(obj)/dt.dtb: $(DTB) FORCE
44         $(call if_changed,shipped)
45 endif
46
47 targets += dt.dtb
48
49 $(DTB): arch-dtbs $(local_dtbos)
50         $(Q)test -e $@ || (                                             \
51         echo >&2;                                                       \
52         echo >&2 "Device Tree Source ($@) is not correctly specified."; \
53         echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'";          \
54         echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument";  \
55         echo >&2;                                                       \
56         /bin/false)
57
58 PHONY += arch-dtbs
59 arch-dtbs:
60         $(Q)$(MAKE) $(build)=$(dt_dir) dtbs
61
62 ifneq ($(CONFIG_OF_UPSTREAM_INCLUDE_LOCAL_FALLBACK_DTBOS),)
63 PHONY += local-dtbos
64 local-dtbos:
65         $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbos
66 endif
67
68 ifeq ($(CONFIG_XPL_BUILD),y)
69 obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
70 # support "out-of-tree" build for dtb-spl
71 $(obj)/dt-spl.dtb.o: $(obj)/dt-spl.dtb.S FORCE
72         $(call if_changed_dep,as_o_S)
73 else
74 obj-$(CONFIG_OF_EMBED) := dt.dtb.o
75 endif
76
77 # Target for U-Boot proper
78 dtbs: $(obj)/dt.dtb
79         @:
80
81 # Target for SPL/TPL
82 spl_dtbs: $(obj)/dt-$(SPL_NAME).dtb
83         @:
84
85 clean-files := dt.dtb.S
86
87 # Let clean descend into dts directories
88 subdir- += ../arch/arc/dts ../arch/arm/dts ../arch/m68k/dts ../arch/microblaze/dts      \
89            ../arch/mips/dts ../arch/nios2/dts ../arch/powerpc/dts ../arch/riscv/dts     \
90            ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts        \
91            ./upstream/src/arm64 ./upstream/src/$(ARCH)
This page took 0.032042 seconds and 4 git commands to generate.