]>
Commit | Line | Data |
---|---|---|
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 |
8 | DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%) |
9 | ifeq ($(DEVICE_TREE),) | |
3284c8b8 | 10 | DEVICE_TREE := unset |
6ab6b2af | 11 | endif |
c8391a0e | 12 | |
d18926af SG |
13 | ifneq ($(EXT_DTB),) |
14 | DTB := $(EXT_DTB) | |
63b4b5ba | 15 | else |
a3444bd0 | 16 | DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb |
63b4b5ba | 17 | endif |
c8391a0e | 18 | |
c7674fcb | 19 | $(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE |
de3e372a | 20 | mkdir -p $(dir $@) |
9bd76b80 GS |
21 | $(call if_changed,fdtgrep) |
22 | ||
43b6e38b AG |
23 | ifeq ($(CONFIG_OF_DTB_PROPS_REMOVE),y) |
24 | $(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE | |
25 | $(call if_changed,fdt_rm_props) | |
26 | else | |
3284c8b8 | 27 | $(obj)/dt.dtb: $(DTB) FORCE |
b9d1dbd4 | 28 | $(call if_changed,shipped) |
43b6e38b | 29 | endif |
bbb0b128 | 30 | |
c7674fcb | 31 | targets += dt.dtb |
bbb0b128 | 32 | |
a3444bd0 | 33 | $(DTB): arch-dtbs |
3284c8b8 MY |
34 | $(Q)test -e $@ || ( \ |
35 | echo >&2; \ | |
1d55eb15 | 36 | echo >&2 "Device Tree Source ($@) is not correctly specified."; \ |
3284c8b8 MY |
37 | echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"; \ |
38 | echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument"; \ | |
39 | echo >&2; \ | |
40 | /bin/false) | |
41 | ||
2737dfe0 | 42 | PHONY += arch-dtbs |
3284c8b8 | 43 | arch-dtbs: |
a3444bd0 | 44 | $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs |
bbb0b128 | 45 | |
9bd76b80 GS |
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) | |
51 | else | |
6ab6b2af | 52 | obj-$(CONFIG_OF_EMBED) := dt.dtb.o |
9bd76b80 | 53 | endif |
bbb0b128 | 54 | |
c7674fcb SG |
55 | # Target for U-Boot proper |
56 | dtbs: $(obj)/dt.dtb | |
57 | @: | |
58 | ||
59 | # Target for SPL/TPL | |
60 | spl_dtbs: $(obj)/dt-$(SPL_NAME).dtb | |
6ab6b2af | 61 | @: |
bbb0b128 | 62 | |
c7674fcb | 63 | clean-files := dt.dtb.S |
3284c8b8 MY |
64 | |
65 | # Let clean descend into dts directories | |
17f2ffea | 66 | subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts ../arch/powerpc/dts ../arch/riscv/dts |