scripts/Makefile.dtbs

Source file repositories/reference/linux-study-clean/scripts/Makefile.dtbs

File Facts

System
Linux kernel
Corpus path
scripts/Makefile.dtbs
Extension
.dtbs
Size
5411 bytes
Lines
154
Domain
Support Tooling And Documentation
Bucket
scripts
Inferred role
Support Tooling And Documentation: build/configuration rule
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

# SPDX-License-Identifier: GPL-2.0-only

all-dtb := $(dtb-y) $(dtb-)

# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)

# Composite DTB (i.e. DTB constructed by overlay)
multi-dtb-y := $(call multi-search, $(dtb-y), .dtb, -dtbs)
# Primitive DTB compiled from *.dts
real-dtb-y := $(call real-search, $(dtb-y), .dtb, -dtbs)
# Base DTB that overlay is applied onto
base-dtb-y := $(filter %.dtb, $(call real-search, $(multi-dtb-y), .dtb, -dtbs))

# Ensure that any .dtbo is applied to at least one base .dtb. Otherwise, it
# does not get validated.
applied-dtbo := $(filter %.dtbo, \
	$(call real-search, $(call multi-search, $(all-dtb), .dtb, -dtbs), .dtb, -dtbs))
unapplied-dtbo := $(filter-out $(applied-dtbo),$(filter %.dtbo, $(dtb-y)))
$(if $(unapplied-dtbo), $(warning .dtbo is not applied to any base: $(unapplied-dtbo)))

dtb-y           := $(addprefix $(obj)/, $(dtb-y))
multi-dtb-y     := $(addprefix $(obj)/, $(multi-dtb-y))
real-dtb-y      := $(addprefix $(obj)/, $(real-dtb-y))

always-y        += $(dtb-y)
targets         += $(real-dtb-y)

# dtbs-list
# ---------------------------------------------------------------------------

ifdef need-dtbslist
subdir-dtbslist := $(addsuffix /dtbs-list, $(subdir-ym))
dtb-y           += $(subdir-dtbslist)
always-y        += $(obj)/dtbs-list
endif

$(subdir-dtbslist): $(obj)/%/dtbs-list: $(obj)/% ;

$(obj)/dtbs-list: $(dtb-y) FORCE
	$(call if_changed,gen_order)

# Assembly file to wrap dtb(o)
# ---------------------------------------------------------------------------

builtin-dtb-section = $(if $(filter arch/$(SRCARCH)/boot/dts%, $(obj)),.dtb.init.rodata,.rodata)

# Generate an assembly file to wrap the output of the device tree compiler
quiet_cmd_wrap_S_dtb = WRAP    $@
      cmd_wrap_S_dtb = {								\
		symbase=__$(patsubst .%,%,$(suffix $<))_$(subst -,_,$(notdir $*));	\
		echo '\#include <asm-generic/vmlinux.lds.h>';				\
		echo '.section $(builtin-dtb-section),"a"';				\
		echo '.balign STRUCT_ALIGNMENT';					\
		echo ".global $${symbase}_begin";					\
		echo "$${symbase}_begin:";						\
		echo '.incbin "$<" ';							\
		echo ".global $${symbase}_end";						\
		echo "$${symbase}_end:";						\
		echo '.balign STRUCT_ALIGNMENT';					\
	} > $@

$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
	$(call if_changed,wrap_S_dtb)

$(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE
	$(call if_changed,wrap_S_dtb)

# Schema check
# ---------------------------------------------------------------------------

Annotation

Implementation Notes