]>
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 | |
27cb7300 JB |
13 | ARCH_PATH := arch/$(ARCH)/dts |
14 | dtb_depends := arch-dtbs | |
15 | ||
d18926af SG |
16 | ifneq ($(EXT_DTB),) |
17 | DTB := $(EXT_DTB) | |
63b4b5ba | 18 | else |
27cb7300 JB |
19 | DTB := $(ARCH_PATH)/$(DEVICE_TREE).dtb |
20 | dtb_depends += $(DTB:.dtb=.dts) | |
63b4b5ba | 21 | endif |
c8391a0e | 22 | |
9bd76b80 GS |
23 | $(obj)/dt-spl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE |
24 | $(call if_changed,fdtgrep) | |
25 | ||
3284c8b8 | 26 | $(obj)/dt.dtb: $(DTB) FORCE |
b9d1dbd4 | 27 | $(call if_changed,shipped) |
bbb0b128 | 28 | |
9bd76b80 | 29 | targets += dt.dtb dt-spl.dtb |
bbb0b128 | 30 | |
27cb7300 JB |
31 | $(DTB): $(dtb_depends) |
32 | ifeq ($(EXT_DTB),) | |
33 | $(Q)$(MAKE) $(build)=$(ARCH_PATH) $@ | |
34 | endif | |
3284c8b8 MY |
35 | $(Q)test -e $@ || ( \ |
36 | echo >&2; \ | |
37 | echo >&2 "Device Tree Source is not correctly specified."; \ | |
38 | echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"; \ | |
39 | echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument"; \ | |
40 | echo >&2; \ | |
41 | /bin/false) | |
42 | ||
43 | arch-dtbs: | |
27cb7300 | 44 | $(Q)$(MAKE) $(build)=$(ARCH_PATH) dtbs |
bbb0b128 | 45 | |
9bd76b80 | 46 | .SECONDARY: $(obj)/dt.dtb.S $(obj)/dt-spl.dtb.S |
bbb0b128 | 47 | |
9bd76b80 GS |
48 | |
49 | ifeq ($(CONFIG_SPL_BUILD),y) | |
50 | obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o | |
51 | # support "out-of-tree" build for dtb-spl | |
52 | $(obj)/dt-spl.dtb.o: $(obj)/dt-spl.dtb.S FORCE | |
53 | $(call if_changed_dep,as_o_S) | |
54 | else | |
6ab6b2af | 55 | obj-$(CONFIG_OF_EMBED) := dt.dtb.o |
9bd76b80 | 56 | endif |
bbb0b128 | 57 | |
9bd76b80 | 58 | dtbs: $(obj)/dt.dtb $(obj)/dt-spl.dtb |
6ab6b2af | 59 | @: |
bbb0b128 | 60 | |
9bd76b80 | 61 | clean-files := dt.dtb.S dt-spl.dtb.S |
3284c8b8 MY |
62 | |
63 | # Let clean descend into dts directories | |
7d7a8e99 | 64 | subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts ../arch/powerpc/dts |