uboot/dts/Makefile
<<
>>
Prefs
   1# SPDX-License-Identifier: GPL-2.0+
   2#
   3# Copyright (c) 2011 The Chromium OS Authors.
   4
   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
   8DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
   9ifeq ($(DEVICE_TREE),)
  10DEVICE_TREE := unset
  11endif
  12
  13ifneq ($(EXT_DTB),)
  14DTB := $(EXT_DTB)
  15else
  16DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
  17endif
  18
  19$(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE
  20        mkdir -p $(dir $@)
  21        $(call if_changed,fdtgrep)
  22
  23ifeq ($(CONFIG_OF_DTB_PROPS_REMOVE),y)
  24$(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
  25        $(call if_changed,fdt_rm_props)
  26else
  27$(obj)/dt.dtb: $(DTB) FORCE
  28        $(call if_changed,shipped)
  29endif
  30
  31targets += dt.dtb
  32
  33$(DTB): arch-dtbs
  34        $(Q)test -e $@ || (                                             \
  35        echo >&2;                                                       \
  36        echo >&2 "Device Tree Source ($@) is not correctly specified."; \
  37        echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'";          \
  38        echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument";  \
  39        echo >&2;                                                       \
  40        /bin/false)
  41
  42PHONY += arch-dtbs
  43arch-dtbs:
  44        $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
  45
  46ifeq ($(CONFIG_SPL_BUILD),y)
  47obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
  48# support "out-of-tree" build for dtb-spl
  49$(obj)/dt-spl.dtb.o: $(obj)/dt-spl.dtb.S FORCE
  50        $(call if_changed_dep,as_o_S)
  51else
  52obj-$(CONFIG_OF_EMBED) := dt.dtb.o
  53endif
  54
  55# Target for U-Boot proper
  56dtbs: $(obj)/dt.dtb
  57        @:
  58
  59# Target for SPL/TPL
  60spl_dtbs: $(obj)/dt-$(SPL_NAME).dtb
  61        @:
  62
  63clean-files := dt.dtb.S
  64
  65# Let clean descend into dts directories
  66subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts ../arch/powerpc/dts ../arch/riscv/dts
  67