8b6b80218b
As the number of schemas has increased, we're starting to hit the error
"execvp: /bin/sh: Argument list too long". This is due to passing all the
schema files on the command line to dt-mk-schema. It currently is only
with out of tree builds and is intermittent depending on the file path
lengths.
Commit 2ba06cd856
("kbuild: Always validate DT binding examples") made
hitting this proplem more likely since the example validation now always
gets the full list of schemas.
Fix this by passing the schema file list in a pipe and using xargs. We end
up doing the find twice, but the time is insignificant compared to the
dt-mk-schema time.
Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Rob Herring <robh@kernel.org>
48 lines
1.6 KiB
Makefile
48 lines
1.6 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
DT_DOC_CHECKER ?= dt-doc-validate
|
|
DT_EXTRACT_EX ?= dt-extract-example
|
|
DT_MK_SCHEMA ?= dt-mk-schema
|
|
DT_MK_SCHEMA_USERONLY_FLAG := $(if $(DT_SCHEMA_FILES), -u)
|
|
|
|
quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<)
|
|
cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \
|
|
$(DT_EXTRACT_EX) $< > $@
|
|
|
|
$(obj)/%.example.dts: $(src)/%.yaml FORCE
|
|
$(call if_changed,chk_binding)
|
|
|
|
# Use full schemas when checking %.example.dts
|
|
DT_TMP_SCHEMA := $(obj)/processed-schema-examples.yaml
|
|
|
|
find_cmd = find $(srctree)/$(src) \( -name '*.yaml' ! \
|
|
-name 'processed-schema*' ! \
|
|
-name '*.example.dt.yaml' \)
|
|
|
|
quiet_cmd_mk_schema = SCHEMA $@
|
|
cmd_mk_schema = rm -f $@ ; \
|
|
$(if $(DT_MK_SCHEMA_FLAGS), \
|
|
echo $(real-prereqs), \
|
|
$(find_cmd)) | \
|
|
xargs $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) >> $@
|
|
|
|
DT_DOCS = $(shell $(find_cmd) | sed -e 's|^$(srctree)/||')
|
|
|
|
DT_SCHEMA_FILES ?= $(DT_DOCS)
|
|
|
|
extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES))
|
|
extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES))
|
|
extra-$(CHECK_DT_BINDING) += processed-schema-examples.yaml
|
|
|
|
override DTC_FLAGS := \
|
|
-Wno-avoid_unnecessary_addr_size \
|
|
-Wno-graph_child_address
|
|
|
|
$(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE
|
|
$(call if_changed,mk_schema)
|
|
|
|
$(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := $(DT_MK_SCHEMA_USERONLY_FLAG)
|
|
$(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE
|
|
$(call if_changed,mk_schema)
|
|
|
|
extra-y += processed-schema.yaml
|