blob: 9907463fc6344d524d9ea415db5112573c6e1a8b [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
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090015DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
Stephen Warrenc198ef72013-07-24 10:09:19 -070016
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090017quiet_cmd_copy = COPY $@
18 cmd_copy = cp $< $@
Simon Glass38d6b8d2011-10-15 05:48:21 +000019
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090020$(obj)/dt.dtb: $(DTB) FORCE
21 $(call if_changed,copy)
Simon Glass38d6b8d2011-10-15 05:48:21 +000022
Masahiro Yamada43c08932014-02-05 11:28:25 +090023targets += dt.dtb
Simon Glass38d6b8d2011-10-15 05:48:21 +000024
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090025$(DTB): arch-dtbs
26 $(Q)test -e $@ || ( \
27 echo >&2; \
28 echo >&2 "Device Tree Source is not correctly specified."; \
29 echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"; \
30 echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument"; \
31 echo >&2; \
32 /bin/false)
33
34arch-dtbs:
35 $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
Simon Glass38d6b8d2011-10-15 05:48:21 +000036
Masahiro Yamada43c08932014-02-05 11:28:25 +090037.SECONDARY: $(obj)/dt.dtb.S
Simon Glass38d6b8d2011-10-15 05:48:21 +000038
Masahiro Yamada43c08932014-02-05 11:28:25 +090039obj-$(CONFIG_OF_EMBED) := dt.dtb.o
Simon Glass38d6b8d2011-10-15 05:48:21 +000040
Masahiro Yamada43c08932014-02-05 11:28:25 +090041dtbs: $(obj)/dt.dtb
42 @:
Simon Glass38d6b8d2011-10-15 05:48:21 +000043
Masahiro Yamada43c08932014-02-05 11:28:25 +090044clean-files := dt.dtb.S
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090045
46# Let clean descend into dts directories
47subdir- += ../arch/*/dts