blob: 1f83e615e8aa9a07c97e6589a6ae87e25a874569 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001# SPDX-License-Identifier: GPL-2.0+
Simon Glass38d6b8d2011-10-15 05:48:21 +00002#
3# Copyright (c) 2011 The Chromium OS Authors.
Simon Glass38d6b8d2011-10-15 05:48:21 +00004
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
Masahiro Yamada43c08932014-02-05 11:28:25 +09008DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
9ifeq ($(DEVICE_TREE),)
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090010DEVICE_TREE := unset
Masahiro Yamada43c08932014-02-05 11:28:25 +090011endif
Stephen Warrenc198ef72013-07-24 10:09:19 -070012
Simon Glassc3b0de42014-06-12 07:24:43 -060013ifneq ($(EXT_DTB),)
14DTB := $(EXT_DTB)
Simon Glass67bce6b2014-06-02 22:04:50 -060015else
Masahiro Yamada43fa91f2019-03-14 14:58:36 +090016DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
Simon Glass67bce6b2014-06-02 22:04:50 -060017endif
Stephen Warrenc198ef72013-07-24 10:09:19 -070018
Goldschmidt Simon5e7a1c22017-11-21 12:29:56 +000019$(obj)/dt-spl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
20 $(call if_changed,fdtgrep)
21
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090022$(obj)/dt.dtb: $(DTB) FORCE
Masahiro Yamada97e101c2014-06-04 10:11:18 +090023 $(call if_changed,shipped)
Simon Glass38d6b8d2011-10-15 05:48:21 +000024
Goldschmidt Simon5e7a1c22017-11-21 12:29:56 +000025targets += dt.dtb dt-spl.dtb
Simon Glass38d6b8d2011-10-15 05:48:21 +000026
Masahiro Yamada43fa91f2019-03-14 14:58:36 +090027$(DTB): arch-dtbs
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090028 $(Q)test -e $@ || ( \
29 echo >&2; \
30 echo >&2 "Device Tree Source is not correctly specified."; \
31 echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"; \
32 echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument"; \
33 echo >&2; \
34 /bin/false)
35
Stephen Warrend2d742c2019-02-26 12:20:25 -070036PHONY += arch-dtbs
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090037arch-dtbs:
Masahiro Yamada43fa91f2019-03-14 14:58:36 +090038 $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
Simon Glass38d6b8d2011-10-15 05:48:21 +000039
Goldschmidt Simon5e7a1c22017-11-21 12:29:56 +000040ifeq ($(CONFIG_SPL_BUILD),y)
41obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
42# support "out-of-tree" build for dtb-spl
43$(obj)/dt-spl.dtb.o: $(obj)/dt-spl.dtb.S FORCE
44 $(call if_changed_dep,as_o_S)
45else
Masahiro Yamada43c08932014-02-05 11:28:25 +090046obj-$(CONFIG_OF_EMBED) := dt.dtb.o
Goldschmidt Simon5e7a1c22017-11-21 12:29:56 +000047endif
Simon Glass38d6b8d2011-10-15 05:48:21 +000048
Goldschmidt Simon5e7a1c22017-11-21 12:29:56 +000049dtbs: $(obj)/dt.dtb $(obj)/dt-spl.dtb
Masahiro Yamada43c08932014-02-05 11:28:25 +090050 @:
Simon Glass38d6b8d2011-10-15 05:48:21 +000051
Goldschmidt Simon5e7a1c22017-11-21 12:29:56 +000052clean-files := dt.dtb.S dt-spl.dtb.S
Masahiro Yamadae7a579f2014-02-05 11:28:27 +090053
54# Let clean descend into dts directories
Lukas Auerbad1b5e2018-11-22 11:26:11 +010055subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts ../arch/powerpc/dts ../arch/riscv/dts