mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-11 07:24:46 +00:00

Currently the enablement of OF_UPSTREAM results on the build system searching for DTs only in dts/upstream/ . There are platforms which use U-Boot specific DTBOs applied on top of U-Boot control DT during SPL stage, and source DTs for these are located in arch/$(ARCH)/dtb. Add dedicated 'dtbos' target which builds only .dtbos and not .dtbs and in case CONFIG_OF_UPSTREAM_INCLUDE_LOCAL_FALLBACK_DTBOS is enabled, build this target for arch/$(ARCH)/dtb to generate local U-Boot specific DTBOs. Adjust top level Makefile so binman would search for .dtb and .dtbo in both OF_UPSTREAM specific paths and arch/$(ARCH)/dtb for the .dtbo case in case CONFIG_OF_UPSTREAM_INCLUDE_LOCAL_FALLBACK_DTBOS is enabled. Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Signed-off-by: Marek Vasut <marex@denx.de>
91 lines
2.2 KiB
Makefile
91 lines
2.2 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0+
|
|
#
|
|
# Copyright (c) 2011 The Chromium OS Authors.
|
|
|
|
# This Makefile builds the internal U-Boot fdt if CONFIG_OF_CONTROL is
|
|
# enabled. See doc/README.fdt-control for more details.
|
|
|
|
DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
|
|
ifeq ($(DEVICE_TREE),)
|
|
DEVICE_TREE := unset
|
|
endif
|
|
|
|
ifeq ($(CONFIG_OF_UPSTREAM),y)
|
|
ifeq ($(CONFIG_ARM64),y)
|
|
dt_dir := dts/upstream/src/arm64
|
|
else
|
|
dt_dir := dts/upstream/src/$(ARCH)
|
|
endif
|
|
else
|
|
dt_dir := arch/$(ARCH)/dts
|
|
endif
|
|
|
|
ifneq ($(CONFIG_OF_UPSTREAM_INCLUDE_LOCAL_FALLBACK_DTBOS),)
|
|
local_dtbos := local-dtbos
|
|
else
|
|
local_dtbos :=
|
|
endif
|
|
|
|
ifneq ($(EXT_DTB),)
|
|
DTB := $(EXT_DTB)
|
|
else
|
|
DTB := $(dt_dir)/$(DEVICE_TREE).dtb
|
|
endif
|
|
|
|
$(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE
|
|
mkdir -p $(dir $@)
|
|
$(call if_changed,fdtgrep)
|
|
|
|
ifeq ($(CONFIG_OF_DTB_PROPS_REMOVE),y)
|
|
$(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
|
|
$(call if_changed,fdt_rm_props)
|
|
else
|
|
$(obj)/dt.dtb: $(DTB) FORCE
|
|
$(call if_changed,shipped)
|
|
endif
|
|
|
|
targets += dt.dtb
|
|
|
|
$(DTB): arch-dtbs $(local_dtbos)
|
|
$(Q)test -e $@ || ( \
|
|
echo >&2; \
|
|
echo >&2 "Device Tree Source ($@) is not correctly specified."; \
|
|
echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"; \
|
|
echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument"; \
|
|
echo >&2; \
|
|
/bin/false)
|
|
|
|
PHONY += arch-dtbs
|
|
arch-dtbs:
|
|
$(Q)$(MAKE) $(build)=$(dt_dir) dtbs
|
|
|
|
ifneq ($(CONFIG_OF_UPSTREAM_INCLUDE_LOCAL_FALLBACK_DTBOS),)
|
|
PHONY += local-dtbos
|
|
local-dtbos:
|
|
$(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbos
|
|
endif
|
|
|
|
ifeq ($(CONFIG_XPL_BUILD),y)
|
|
obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
|
|
# support "out-of-tree" build for dtb-spl
|
|
$(obj)/dt-spl.dtb.o: $(obj)/dt-spl.dtb.S FORCE
|
|
$(call if_changed_dep,as_o_S)
|
|
else
|
|
obj-$(CONFIG_OF_EMBED) := dt.dtb.o
|
|
endif
|
|
|
|
# Target for U-Boot proper
|
|
dtbs: $(obj)/dt.dtb
|
|
@:
|
|
|
|
# Target for SPL/TPL
|
|
spl_dtbs: $(obj)/dt-$(SPL_NAME).dtb
|
|
@:
|
|
|
|
clean-files := dt.dtb.S
|
|
|
|
# Let clean descend into dts directories
|
|
subdir- += ../arch/arc/dts ../arch/arm/dts ../arch/m68k/dts ../arch/microblaze/dts \
|
|
../arch/mips/dts ../arch/nios2/dts ../arch/powerpc/dts ../arch/riscv/dts \
|
|
../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts \
|
|
./upstream/src/arm64 ./upstream/src/$(ARCH)
|