Skip to contentSkip to conversation

scripts/dtc: drop yaml in DT validation

PATCH In review João Marcos Costa 4 participants 6 messages Apr 29 – Apr 30

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/dtc: drop yaml in DT validation

The build issues found in dtc/yamltree were partially mitigated by a previous commit (807bcd844a: "scripts/dtc: Fix pkg-config behavior under sysroot"), but upstream dtc simply disabled yaml, and the same should be done here in order to permanently avoid those issues.

Backport the change below from Linux v5.18 [1]:

ef8795f3f1c ("dt-bindings: kbuild: Use DTB files for validation")

I tested this patch with a couple Yocto builds: u-boot and u-boot-tools, using the current master branch (rev. "c53b0708f9"), having removed libyaml-native from u-boot-tools's dependencies.

[1] https://git.kernel.org/linus/ef8795f3f1ce

---
 scripts/Makefile.lib             | 6 ------
 scripts/dtc/Makefile             | 8 --------
 scripts/dtc/update-dtc-source.sh | 2 +-
 3 files changed, 1 insertion(+), 15 deletions(-)
scripts/Makefile.lib +0 -6
index b8969b7de54..d66f1ed13b1 100644
@@ -86,12 +86,6 @@ base-dtb-y := $(foreach m, $(multi-dtb-y), $(firstword $(call suffix-search, $m,
 extra-y				+= $(dtb-y)
 extra-$(CONFIG_OF_ALL_DTBS)	+= $(dtb-)
 
-# U-Boot specific
-ifneq ($(CHECK_DTBS),)
-extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
-extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
-endif
-
 # Add subdir path
 
 extra-y		:= $(addprefix $(obj)/,$(extra-y))
scripts/dtc/Makefile +0 -8
index 6f309b37e08..2ba8dba03be 100644
@@ -17,15 +17,7 @@ fdtoverlay-objs	:= $(libfdt) fdtoverlay.o util.o
 # Source files need to get at the userspace version of libfdt_env.h to compile
 HOST_EXTRACFLAGS := -I$(srctree)/$(src)/libfdt
 
-ifeq ($(wildcard $(PKG_CONFIG_SYSROOT_DIR)/usr/include/yaml.h),)
 HOST_EXTRACFLAGS += -DNO_YAML
-else
-dtc-objs	+= yamltree.o
-# To include <yaml.h> installed in a non-default path
-HOSTCFLAGS_yamltree.o := $(shell pkg-config --cflags yaml-0.1)
-# To link libyaml installed in a non-default path
-HOSTLDLIBS_dtc	:= $(shell pkg-config --libs yaml-0.1)
-endif
 
 # Generated files need one more search path to include headers in source tree
 HOSTCFLAGS_dtc-lexer.lex.o := -I$(src)
scripts/dtc/update-dtc-source.sh +1 -1
index 32ff17ffd08..94627541533 100755
@@ -32,7 +32,7 @@ DTC_UPSTREAM_PATH=`pwd`/../dtc
 DTC_LINUX_PATH=`pwd`/scripts/dtc
 
 DTC_SOURCE="checks.c data.c dtc.c dtc.h flattree.c fstree.c livetree.c srcpos.c \
-		srcpos.h treesource.c util.c util.h version_gen.h yamltree.c \
+		srcpos.h treesource.c util.c util.h version_gen.h \
 		dtc-lexer.l dtc-parser.y"
 LIBFDT_SOURCE="fdt.c fdt.h fdt_addresses.c fdt_empty_tree.c \
 		fdt_overlay.c fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c \
Signature · 1 line
2.47.0
Acked-by on v1 1/1
#1 lore raw

Hi Joaõ,

Quoted 7 lines · João Marcos Costa

The build issues found in dtc/yamltree were partially mitigated by a previous commit (807bcd844a: "scripts/dtc: Fix pkg-config behavior under sysroot"), but upstream dtc simply disabled yaml, and the same should be done here in order to permanently avoid those issues.

Backport the change below from Linux v5.18 [1]:

I'm kinda worried we've been missing other patches since our last sync claims we bumped to 6.1 so we should have had this commit.

It'd be nice to know which (if any) issues you encountered when backporting the patch (e.g. things you didn't backport on purpose and why).

The few missing pieces in this backport don't seem to be relevant to U-Boot, so

Thanks!
Quentin

#2 lore raw
Quoted 8 lines · Quentin Schulz

Hi Joaõ,

Quoted 5 lines · João Marcos Costa

The build issues found in dtc/yamltree were partially mitigated by a previous commit (807bcd844a: "scripts/dtc: Fix pkg-config behavior under sysroot"), but upstream dtc simply disabled yaml, and the same should be done here in order to permanently avoid those issues.

Quoted 4 lines
Quoted 2 lines

Backport the change below from Linux v5.18 [1]:

I'm kinda worried we've been missing other patches since our last sync claims we bumped to 6.1 so we should have had this commit.

The last DTC sync should put U-Boot at Linux 6.17.y , see:

0535e46d55d7 ("scripts/dtc: Update to upstream version v1.7.2-35-g52f07dcca47c")

So I wonder how this patch got missed or slipped through the cracks.

Quoted 1 line

It'd be nice to know which (if any) issues you encountered when backporting the patch (e.g. things you didn't backport on purpose and why).

I agree, and it would be very helpful to check for any other missing patches.

#3 lore raw

Hello,

On 4/29/26 18:08, Marek Vasut wrote:
(...)

Quoted 11 lines
Quoted 1 line

I'm kinda worried we've been missing other patches since our last sync claims we bumped to 6.1 so we should have had this commit.

The last DTC sync should put U-Boot at Linux 6.17.y , see:

0535e46d55d7 ("scripts/dtc: Update to upstream version v1.7.2-35-g52f07dcca47c")

So I wonder how this patch got missed or slipped through the cracks.

Quoted 1 line

It'd be nice to know which (if any) issues you encountered when backporting the patch (e.g. things you didn't backport on purpose and why).

I agree, and it would be very helpful to check for any other missing patches.

So, this is the list of changes in the original patch (i.e., git show --stat):

1) Documentation/devicetree/bindings/Makefile
2) .../devicetree/bindings/writing-schema.rst
3) scripts/Makefile.lib
4) scripts/dtc/Makefile
5) scripts/dtc/update-dtc-source.sh

As for (1), the first and third chunks were already applied. The second one (below) seemed to be N/A:

-always-$(CHECK_DT_BINDING) += $(patsubst $(srctree)/$(src)/%.yaml,%.example.dt.yaml, $(CHK_DT_DOCS)) +always-$(CHECK_DT_BINDING) += $(patsubst $(srctree)/$(src)/%.yaml,%.example.dtb, $(CHK_DT_DOCS))

About (2), it was already applied as well, nothing to be done there.

About (3), I might be wrong because I'm not familiar with this file, but I skipped this chunk because it also seemed to be N/A:

-$(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
- $(call if_changed_dep,dtc)
-
-$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
- $(call if_changed_dep,dtc)
-

another chunk I skipped in (3), because it seemed to be partially applied (e.g., the || true and the ifneq on top):

+ifneq ($(CHECK_DTBS)$(CHECK_DT_BINDING),)
DT_CHECKER ?= dt-validate
DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m) DT_BINDING_DIR := Documentation/devicetree/bindings DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json

 quiet_cmd_dtb_check =  CHECK   $@
-      cmd_dtb_check =  $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@
+      cmd_dtb_check =  $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true

+endif

but now I'm reconsidering...please let me know what you think.

Still regarding (3), I skipped the 4th chunk (already applied) and this last one (below, which now I'm also reconsidering):

+$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
+ $(call if_changed_dep,dtc)
+

Finally, (4) and (5) applied fine, so not much to say about them.

Honestly, I'm not familiar with the way you sync those files (how, when, where, etc), so I'm not sure how much I can be of help here.

I hope this clarifies my backport, but please reach back to me if it didn't.

Signature · 2 lines
Best regards,
João Marcos Costa
#4 lore raw

On 4/30/26 10:10 AM, Joao Marcos Costa wrote:

Hello everyone,

Quoted 3 lines
Quoted 1 line

I agree, and it would be very helpful to check for any other missing patches.

So, this is the list of changes in the original patch (i.e., git show -- stat):

Are there any other patches that might have been missed too ?

#5 lore raw
In reply to João Marcos Costa
Quoted 8 lines · João Marcos Costa

The build issues found in dtc/yamltree were partially mitigated by a previous commit (807bcd844a: "scripts/dtc: Fix pkg-config behavior under sysroot"), but upstream dtc simply disabled yaml, and the same should be done here in order to permanently avoid those issues.

Backport the change below from Linux v5.18 [1]:

[...]

Applied to u-boot/master, thanks!

[1/1] scripts/dtc: drop yaml in DT validation

      commit: 8ef8dee4f3a2b2021decfefd853dbd2a1632b77f
Signature · 1 line
Tom