Skip to contentSkip to conversation

kernel: introduce python3-dtschema-wrapper

PATCH New Paul Barker 1 participant 1 message Jan 14, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel: introduce python3-dtschema-wrapper

From: Bruce Ashfield <[email protected]>

The 5.16 kernel introduced mandatory schema checking on any dtb file built through the kernel.

That funcionality is provided via python3-dt-schema.

The dependencies to enable that functionality is not small, and may not always be desired (in particular on architectures that do not support dtbs, or in development cycles). It may also be useful for allowing a non-conformant dts to be compiled.

This commit introduces a set of wrapper scripts that when added as a depenency to the kernel, can pass both the validation testing and validation steps of a dts.

Backported from oe-core commit 2566563ad49d.

---
 meta/conf/distro/include/maintainers.inc      |  1 +
 .../python3-dtschema-wrapper/dt-doc-validate  | 20 +++++++++++++++++++
 .../dtc/python3-dtschema-wrapper/dt-mk-schema | 20 +++++++++++++++++++
 .../dtc/python3-dtschema-wrapper/dt-validate  | 20 +++++++++++++++++++
 .../dtc/python3-dtschema-wrapper_2021.10.bb   | 17 ++++++++++++++++
 5 files changed, 78 insertions(+)
 create mode 100644 meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-doc-validate
 create mode 100644 meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-mk-schema
 create mode 100644 meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-validate
 create mode 100644 meta/recipes-kernel/dtc/python3-dtschema-wrapper_2021.10.bb
meta/conf/distro/include/maintainers.inc +1 -0
index 895cf894872b..1575fce8c715 100644
@@ -576,6 +576,7 @@ RECIPE_MAINTAINER_pn-python3 = "Oleksandr Kravchuk <open.source@oleksandr-kravch
 RECIPE_MAINTAINER_pn-python3-async = "Oleksandr Kravchuk <[email protected]>"
 RECIPE_MAINTAINER_pn-python3-dbus = "Oleksandr Kravchuk <[email protected]>"
 RECIPE_MAINTAINER_pn-python3-docutils = "Oleksandr Kravchuk <[email protected]>"
+RECIPE_MAINTAINER_pn-python3-dtschema-wrapper = "Bruce Ashfield <[email protected]>"
 RECIPE_MAINTAINER_pn-python3-pycryptodome = "Joshua Watt <[email protected]>"
 RECIPE_MAINTAINER_pn-python3-pycryptodomex = "Joshua Watt <[email protected]>"
 RECIPE_MAINTAINER_pn-python3-extras = "Oleksandr Kravchuk <[email protected]>"
meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-doc-validate new file +20 -0
new file mode 100644
index 000000000000..2aa57851c7e1
@@ -0,0 +1,20 @@
+#!/bin/sh
+# dt-doc-validate wrapper to allow kernel dt-validation to pass
+#
+# Copyright (C) 2021 Bruce Ashfield <[email protected]>
+# License: MIT (see COPYING.MIT at the root of the repository for terms)
+
+for arg; do
+    case "$arg" in
+        --version)
+            echo "v2021.10"
+            ;;
+    esac
+done
+
+# TBD: left for future consideration
+# exec dt-doc-validate.real "$@"
+
+# we always succeed
+exit 0
+
meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-mk-schema new file +20 -0
new file mode 100644
index 000000000000..24b89d861982
@@ -0,0 +1,20 @@
+#!/bin/sh
+# dt-mk-schema wrapper to allow kernel dt-validation to pass
+#
+# Copyright (C) 2021 Bruce Ashfield <[email protected]>
+# License: MIT (see COPYING.MIT at the root of the repository for terms)
+
+for arg; do
+    case "$arg" in
+        --version)
+            echo "v2021.10"
+            ;;
+    esac
+done
+
+# TBD: left for future consideration
+# exec dt-mk-schema.real "$@"
+
+# we always succeed
+exit 0
+
meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-validate new file +20 -0
new file mode 100644
index 000000000000..8a4710a7eda1
@@ -0,0 +1,20 @@
+#!/bin/sh
+# dt-validate wrapper to allow kernel dt-validation to pass
+#
+# Copyright (C) 2021 Bruce Ashfield <[email protected]>
+# License: MIT (see COPYING.MIT at the root of the repository for terms)
+
+for arg; do
+    case "$arg" in
+        --version)
+            echo "v2021.10"
+            ;;
+    esac
+done
+
+# TBD: left for future consideration
+# exec dt-validate.real "$@"
+
+# we always succeed
+exit 0
+
meta/recipes-kernel/dtc/python3-dtschema-wrapper_2021.10.bb new file +17 -0
new file mode 100644
index 000000000000..c869274d09fa
@@ -0,0 +1,17 @@
+DESCRIPTION = "Wrapper for tooling for devicetree validation using YAML and jsonschema"
+HOMEPAGE = "https://yoctoproject.org"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+SRC_URI = "file://dt-doc-validate \
+           file://dt-mk-schema \
+           file://dt-validate"
+
+do_install() {
+    install -d ${D}${bindir}/
+    install -m 755 ${WORKDIR}/dt-doc-validate ${D}${bindir}/
+    install -m 755 ${WORKDIR}/dt-mk-schema ${D}${bindir}/
+    install -m 755 ${WORKDIR}/dt-validate ${D}${bindir}/
+}
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.34.1