]> Git Repo - u-boot.git/blame - dts/Makefile
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh
[u-boot.git] / dts / Makefile
CommitLineData
83d290c5 1# SPDX-License-Identifier: GPL-2.0+
bbb0b128
SG
2#
3# Copyright (c) 2011 The Chromium OS Authors.
bbb0b128
SG
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
6ab6b2af
MY
8DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
9ifeq ($(DEVICE_TREE),)
3284c8b8 10DEVICE_TREE := unset
6ab6b2af 11endif
c8391a0e 12
e3a9829c
SG
13ifeq ($(CONFIG_OF_UPSTREAM),y)
14ifeq ($(CONFIG_ARM64),y)
15dt_dir := dts/upstream/src/arm64
16else
17dt_dir := dts/upstream/src/$(ARCH)
18endif
19else
20dt_dir := arch/$(ARCH)/dts
21endif
22
a55c4836
MV
23ifneq ($(CONFIG_OF_UPSTREAM_INCLUDE_LOCAL_FALLBACK_DTBOS),)
24local_dtbos := local-dtbos
25else
26local_dtbos :=
27endif
28
d18926af
SG
29ifneq ($(EXT_DTB),)
30DTB := $(EXT_DTB)
63b4b5ba 31else
e3a9829c 32DTB := $(dt_dir)/$(DEVICE_TREE).dtb
63b4b5ba 33endif
c8391a0e 34
c7674fcb 35$(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE
de3e372a 36 mkdir -p $(dir $@)
9bd76b80
GS
37 $(call if_changed,fdtgrep)
38
43b6e38b
AG
39ifeq ($(CONFIG_OF_DTB_PROPS_REMOVE),y)
40$(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
41 $(call if_changed,fdt_rm_props)
42else
3284c8b8 43$(obj)/dt.dtb: $(DTB) FORCE
b9d1dbd4 44 $(call if_changed,shipped)
43b6e38b 45endif
bbb0b128 46
c7674fcb 47targets += dt.dtb
bbb0b128 48
a55c4836 49$(DTB): arch-dtbs $(local_dtbos)
3284c8b8
MY
50 $(Q)test -e $@ || ( \
51 echo >&2; \
1d55eb15 52 echo >&2 "Device Tree Source ($@) is not correctly specified."; \
3284c8b8
MY
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
2737dfe0 58PHONY += arch-dtbs
3284c8b8 59arch-dtbs:
e3a9829c 60 $(Q)$(MAKE) $(build)=$(dt_dir) dtbs
bbb0b128 61
a55c4836
MV
62ifneq ($(CONFIG_OF_UPSTREAM_INCLUDE_LOCAL_FALLBACK_DTBOS),)
63PHONY += local-dtbos
64local-dtbos:
65 $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbos
66endif
67
1d6132e2 68ifeq ($(CONFIG_XPL_BUILD),y)
9bd76b80
GS
69obj-$(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)
73else
6ab6b2af 74obj-$(CONFIG_OF_EMBED) := dt.dtb.o
9bd76b80 75endif
bbb0b128 76
c7674fcb
SG
77# Target for U-Boot proper
78dtbs: $(obj)/dt.dtb
79 @:
80
81# Target for SPL/TPL
82spl_dtbs: $(obj)/dt-$(SPL_NAME).dtb
6ab6b2af 83 @:
bbb0b128 84
c7674fcb 85clean-files := dt.dtb.S
3284c8b8
MY
86
87# Let clean descend into dts directories
3d3eeae9
TD
88subdir- += ../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 \
e3a9829c
SG
90 ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts \
91 ./upstream/src/arm64 ./upstream/src/$(ARCH)
This page took 0.309043 seconds and 4 git commands to generate.