blob: e59550c9d2e6e06a8fb9f1f729db10358480ff64 [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
Masahiro Yamada3284c8b2014-02-05 11:28:27 +090015DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
Simon Glassbbb0b122011-10-15 05:48:21 +000016
Masahiro Yamada3284c8b2014-02-05 11:28:27 +090017quiet_cmd_copy = COPY $@
18 cmd_copy = cp $< $@
Simon Glassbbb0b122011-10-15 05:48:21 +000019
Masahiro Yamada3284c8b2014-02-05 11:28:27 +090020$(obj)/dt.dtb: $(DTB) FORCE
21 $(call if_changed,copy)
Simon Glassbbb0b122011-10-15 05:48:21 +000022
Masahiro Yamada6ab6b2a2014-02-05 11:28:25 +090023targets += dt.dtb
Simon Glassbbb0b122011-10-15 05:48:21 +000024
Masahiro Yamada3284c8b2014-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
Masahiro Yamada6ab6b2a2014-02-05 11:28:25 +090036
37.SECONDARY: $(obj)/dt.dtb.S
38
39obj-$(CONFIG_OF_EMBED) := dt.dtb.o
40
41dtbs: $(obj)/dt.dtb
42 @:
43
44clean-files := dt.dtb.S
Masahiro Yamada3284c8b2014-02-05 11:28:27 +090045
46# Let clean descend into dts directories
Masahiro Yamada6bd04bb2014-03-28 14:55:02 +090047subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/sandbox/dts ../arch/x86/dts