blob: d3122aa3b96eeaa8820300060c958bcb5cf1d6dd [file] [log] [blame]
Simon Glass38d6b8d2011-10-15 05:48:21 +00001#
2# Copyright (c) 2011 The Chromium OS Authors.
3#
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02004# SPDX-License-Identifier: GPL-2.0+
Simon Glass38d6b8d2011-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 Yamada43c08932014-02-05 11:28:25 +090010DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
11ifeq ($(DEVICE_TREE),)
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090012DEVICE_TREE := unset
Masahiro Yamada43c08932014-02-05 11:28:25 +090013endif
Stephen Warrenc198ef72013-07-24 10:09:19 -070014
Simon Glassc3b0de42014-06-12 07:24:43 -060015ifneq ($(EXT_DTB),)
16DTB := $(EXT_DTB)
Simon Glass67bce6b2014-06-02 22:04:50 -060017else
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090018DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
Simon Glass67bce6b2014-06-02 22:04:50 -060019endif
Stephen Warrenc198ef72013-07-24 10:09:19 -070020
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090021$(obj)/dt.dtb: $(DTB) FORCE
Masahiro Yamada97e101c2014-06-04 10:11:18 +090022 $(call if_changed,shipped)
Simon Glass38d6b8d2011-10-15 05:48:21 +000023
Masahiro Yamada43c08932014-02-05 11:28:25 +090024targets += dt.dtb
Simon Glass38d6b8d2011-10-15 05:48:21 +000025
Masahiro Yamadae7a579f2014-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
Simon Glass38d6b8d2011-10-15 05:48:21 +000037
Masahiro Yamada43c08932014-02-05 11:28:25 +090038.SECONDARY: $(obj)/dt.dtb.S
Simon Glass38d6b8d2011-10-15 05:48:21 +000039
Masahiro Yamada43c08932014-02-05 11:28:25 +090040obj-$(CONFIG_OF_EMBED) := dt.dtb.o
Simon Glass38d6b8d2011-10-15 05:48:21 +000041
Masahiro Yamada43c08932014-02-05 11:28:25 +090042dtbs: $(obj)/dt.dtb
43 @:
Simon Glass38d6b8d2011-10-15 05:48:21 +000044
Masahiro Yamada43c08932014-02-05 11:28:25 +090045clean-files := dt.dtb.S
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090046
47# Let clean descend into dts directories
Masahiro Yamada806adae2014-03-28 14:55:02 +090048subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/sandbox/dts ../arch/x86/dts