blob: dbde7035aa556d5f3060dfe81eac13a6e8b445b8 [file] [log] [blame]
Simon Glassbbb0b122011-10-15 05:48:21 +00001#
2# Copyright (c) 2011 The Chromium OS Authors.
3#
Wolfgang Denk1a459662013-07-08 09:37:19 +02004# SPDX-License-Identifier: GPL-2.0+
Simon Glassbbb0b122011-10-15 05:48:21 +00005#
6
7# This Makefile builds the internal U-Boot fdt if CONFIG_OF_CONTROL is
8# enabled. See doc/README.fdt-control for more details.
9
Masahiro Yamadaefcf8612014-02-04 17:24:40 +090010DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
11ifeq ($(DEVICE_TREE),)
Masahiro Yamada3284c8b2014-02-05 11:28:27 +090012DEVICE_TREE := unset
Masahiro Yamadaefcf8612014-02-04 17:24:40 +090013endif
Simon Glassbbb0b122011-10-15 05:48:21 +000014
Simon Glassd18926a2014-06-12 07:24:43 -060015ifneq ($(EXT_DTB),)
16DTB := $(EXT_DTB)
Simon Glass63b4b5b2014-06-02 22:04:50 -060017else
Masahiro Yamada3284c8b2014-02-05 11:28:27 +090018DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
Simon Glass63b4b5b2014-06-02 22:04:50 -060019endif
Simon Glassbbb0b122011-10-15 05:48:21 +000020
Masahiro Yamada3284c8b2014-02-05 11:28:27 +090021$(obj)/dt.dtb: $(DTB) FORCE
Masahiro Yamadab9d1dbd2014-06-04 10:11:18 +090022 $(call if_changed,shipped)
Simon Glassbbb0b122011-10-15 05:48:21 +000023
Masahiro Yamada6ab6b2a2014-02-05 11:28:25 +090024targets += dt.dtb
Simon Glassbbb0b122011-10-15 05:48:21 +000025
Masahiro Yamada3284c8b2014-02-05 11:28:27 +090026$(DTB): arch-dtbs
27 $(Q)test -e $@ || ( \
28 echo >&2; \
29 echo >&2 "Device Tree Source is not correctly specified."; \
30 echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"; \
31 echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument"; \
32 echo >&2; \
33 /bin/false)
34
35arch-dtbs:
36 $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
Masahiro Yamada6ab6b2a2014-02-05 11:28:25 +090037
38.SECONDARY: $(obj)/dt.dtb.S
39
40obj-$(CONFIG_OF_EMBED) := dt.dtb.o
41
42dtbs: $(obj)/dt.dtb
43 @:
44
45clean-files := dt.dtb.S
Masahiro Yamada3284c8b2014-02-05 11:28:27 +090046
47# Let clean descend into dts directories
Thomas Chou67871a52016-01-06 09:49:24 +080048subdir- += ../arch/*/dts