HKG18-120 - Devicetree Schema Documentation and Validation

Linaro
LinaroLinaro
Devicetree Schema Documentation
and Validation
Grant Likely - Arm
Devicetree Schema Documentation and
Validation
The problem: too easy to get devicetree wrong
● Data must be encoded in very specific ways
● Toolchain provides little validation
● No checks against documented schema (aka. bindings)
○ Schemas are loosely structure prose
○ Not machine readable
● Steep learning curve
Project Goals
● Define a DT schema language
○ Human friendly
○ Machine readable
○ Include binding documentation
● Better tooling
○ Validate DTS files at build time
○ Validate DT Schema files are in the correct format
○ Useful error and warning messages
● Leverage existing technology
○ Use existing schema validation framework
■ Extended to handle quirks of DT
○ Don’t write a lot of code!
○ Don’t define an entirely new language!
● Generate Specification Documentation from Schema files
Prototype Implementation
http://github.com/robherring/yaml-bindings
Based on:
● Python3
● YAML 1.2 file format
● JSON Schema vocabulary
○ As implemented in Python jsonschema library
● Sphinx-Doc extension
~250 lines of python code
~250 lines of metaschema files
~250 lines of schema files
YAML File Format
http://www.yaml.org
● Human friendly
● Portable
● Structured
● Simple transcode DTS to YAML
● Extensible with custom datatypes
● Superset of JSON
%YAML 1.2
---
YAML: YAML Ain't Markup Language
What It Is: YAML is a human friendly data serialization
standard for all programming languages.
YAML Resources:
YAML 1.2 (3rd Edition): http://yaml.org/spec/1.2/spec.html
YAML 1.1 (2nd Edition): http://yaml.org/spec/1.1/
YAML 1.0 (1st Edition): http://yaml.org/spec/1.0/
YAML Issues Page: https://github.com/yaml/yaml/issues
YAML Mailing List: yaml-core@lists.sourceforge.net
YAML IRC Channel: "#yaml on irc.freenode.net"
YAML Cookbook (Ruby): http://yaml4r.sourceforge.net/cookbook/
(local)
YAML Reference Parser: http://ben-kiki.org/ypaste/
Projects:
C/C++ Libraries:
- libyaml # "C" Fast YAML 1.1
- Syck # (dated) "C" YAML 1.0
- yaml-cpp # C++ YAML 1.2 implementation
Python:
- PyYAML # YAML 1.1, pure python and libyaml binding
- ruamel.yaml # YAML 1.2, update of PyYAML with round-tripping
JSON Schema Vocabulary
http://json-schema.org
● Intended for and encoded in JSON
○ Works fine with YAML
● Defines vocabulary and processing
model for validation
○ Can extend with DT specific vocabulary
● JSON Schema nodes apply
constraints on target document
{
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
}
},
"required": ["firstName", "lastName"]
}
DT Schema Conceptual Model
Meta-
Schema
.dts
Schema.
Schema.
Schemaa
Schema
Examples -- (best to go look at project)
Meta Schema
%YAML 1.2
---
$id: "http://devicetree.org/meta-schemas/core.yaml#"
$schema: "http://json-schema.org/draft-06/schema#"
description: "Metaschema for devicetree binding documentation"
allOf: [ { $ref: "http://json-schema.org/draft-06/schema#" } ]
[...]
properties:
$id:
pattern: 'http://devicetree.org/(test/)?schemas/.*.yaml#'
$schema:
const: "http://devicetree.org/meta-schemas/core.yaml#"
[...]
Required: [$id, $schema, version, title, maintainers, description]
additionalProperties: false
Schema
%YAML 1.2
---
$id: http://devicetree.org/schemas/root-node.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Common root node
description: |
Common properties always required in the root node of the tree
maintainers:
- Device Tree <dt@kernel.org>
select:
required: ["$path"]
properties:
$path: {enum: ["/"]}
properties:
compatible: {}
model:
type: string
"#address-cells": {}
"#size-cells": {}
memory: {}
Generate Documentation
title: /aliases Node
description: |
A devicetree may have an aliases node (``/aliases``) that defines one or more
alias properties.
patternProperties:
"^[a-z][a-z0-9-]*$": { type: string }
additionalProperties: false
examples:
example1: |
aliases {
serial0 = "/simple-bus@fe000000/serial@11c500";
ethernet0 = "/simple-bus@fe000000/ethernet@31c000";
};
maintainers:
- Devicetree Specification Mailing List <devicetree-spec@vger.kernel.org>
Demonstration
● Devicetree Validation
$ ./dt-validate.py test/juno.cpp.yaml
● Devicetree Schema Validation
$ ./tools/dt-doc-validate test/schemas/good-example.yaml
$ ./tools/dt-doc-validate test/schemas/bad-example.yaml
● Running Testcases
$ make test
Next Steps
● Start requiring binding files to be YAML encoded
○ Can be enforced in kernel
● Add DTSchema support into DTC
○ Add YAML output filter to DTC, or
○ Update libfdt Python bindings to expose JSON object model
● Get working with DTS files in kernel
● Flush out core schema files
● Decide where code should live
○ Separate Repo?
○ In DTC repo?
○ In Devicetree-schema repo?
○ In kernel?
DTSchema hacking Tuesday and Wednesday mornings in Core Hacking Room
Thank You
#HKG18
HKG18 keynotes and videos on: connect.linaro.org
For further information: www.linaro.org
1 sur 12

Recommandé

U Boot or Universal Bootloader par
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal BootloaderSatpal Parmar
21.1K vues25 diapositives
Linux device drivers par
Linux device drivers Linux device drivers
Linux device drivers Emertxe Information Technologies Pvt Ltd
41.5K vues114 diapositives
Learning AOSP - Android Linux Device Driver par
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverNanik Tolaram
4.4K vues12 diapositives
Linux Initialization Process (2) par
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)shimosawa
6.8K vues44 diapositives
Jagan Teki - U-boot from scratch par
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchlinuxlab_conf
708 vues90 diapositives
Arm device tree and linux device drivers par
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device driversHoucheng Lin
17.5K vues19 diapositives

Contenu connexe

Tendances

Embedded Linux Kernel - Build your custom kernel par
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmertxe Information Technologies Pvt Ltd
3.9K vues50 diapositives
Android 10 par
Android 10Android 10
Android 10kpraveen_slideshare
933 vues18 diapositives
Linux Kernel Booting Process (1) - For NLKB par
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBshimosawa
12.5K vues73 diapositives
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03) par
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)William Liang
7.1K vues38 diapositives
Uboot startup sequence par
Uboot startup sequenceUboot startup sequence
Uboot startup sequenceHoucheng Lin
33.7K vues17 diapositives
U-Boot Porting on New Hardware par
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New HardwareRuggedBoardGroup
2K vues31 diapositives

Tendances(20)

Linux Kernel Booting Process (1) - For NLKB par shimosawa
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
shimosawa12.5K vues
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03) par William Liang
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
William Liang7.1K vues
Uboot startup sequence par Houcheng Lin
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
Houcheng Lin33.7K vues
Yocto Project introduction par Yi-Hsiu Hsu
Yocto Project introductionYocto Project introduction
Yocto Project introduction
Yi-Hsiu Hsu4.3K vues
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard par Anne Nicolas
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Anne Nicolas7.2K vues
The basic concept of Linux FIleSystem par HungWei Chiu
The basic concept of Linux FIleSystemThe basic concept of Linux FIleSystem
The basic concept of Linux FIleSystem
HungWei Chiu1K vues
U-Boot presentation 2013 par Wave Digitech
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
Wave Digitech18.7K vues
Linux booting process - Linux System Administration par Sreenatha Reddy K R
Linux booting process - Linux System AdministrationLinux booting process - Linux System Administration
Linux booting process - Linux System Administration
Fosdem 18: Securing embedded Systems using Virtualization par The Linux Foundation
Fosdem 18: Securing embedded Systems using VirtualizationFosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using Virtualization
Linux power management: are you doing it right? par Chris Simmonds
Linux power management: are you doing it right?Linux power management: are you doing it right?
Linux power management: are you doing it right?
Chris Simmonds3.8K vues
U boot porting guide for SoC par Macpaul Lin
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
Macpaul Lin11.9K vues
Embedded_Linux_Booting par Rashila Rr
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
Rashila Rr513 vues

Similaire à HKG18-120 - Devicetree Schema Documentation and Validation

Apache big data 2016 - Speaking the language of Big Data par
Apache big data 2016 - Speaking the language of Big DataApache big data 2016 - Speaking the language of Big Data
Apache big data 2016 - Speaking the language of Big Datatechmaddy
329 vues50 diapositives
Document Object Model par
Document Object ModelDocument Object Model
Document Object Modelchomas kandar
3.4K vues73 diapositives
Document Object Model par
Document Object ModelDocument Object Model
Document Object Modelchomas kandar
14.3K vues73 diapositives
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft... par
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft..."Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...Dataconomy Media
414 vues30 diapositives
Xml schema par
Xml schemaXml schema
Xml schemaTony Nguyen
95 vues24 diapositives

Similaire à HKG18-120 - Devicetree Schema Documentation and Validation (20)

Apache big data 2016 - Speaking the language of Big Data par techmaddy
Apache big data 2016 - Speaking the language of Big DataApache big data 2016 - Speaking the language of Big Data
Apache big data 2016 - Speaking the language of Big Data
techmaddy329 vues
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft... par Dataconomy Media
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft..."Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...
Dataconomy Media414 vues
RELAX NG to DTD and XSD Using the Open Toolkit par Contrext Solutions
RELAX NG to DTD and XSD Using the Open ToolkitRELAX NG to DTD and XSD Using the Open Toolkit
RELAX NG to DTD and XSD Using the Open Toolkit
Contrext Solutions1.7K vues
Semi Formal Model for Document Oriented Databases par Daniel Coupal
Semi Formal Model for Document Oriented DatabasesSemi Formal Model for Document Oriented Databases
Semi Formal Model for Document Oriented Databases
Daniel Coupal2.2K vues
Comparison with storing data using NoSQL(CouchDB) and a relational database. par eross77
Comparison with storing data using NoSQL(CouchDB) and a relational database.Comparison with storing data using NoSQL(CouchDB) and a relational database.
Comparison with storing data using NoSQL(CouchDB) and a relational database.
eross77377 vues
Data engineering Stl Big Data IDEA user group par Adam Doyle
Data engineering   Stl Big Data IDEA user groupData engineering   Stl Big Data IDEA user group
Data engineering Stl Big Data IDEA user group
Adam Doyle204 vues
Second Skin: Real-Time Retheming a Legacy Web Application with Diazo in the C... par Chris Shenton
Second Skin: Real-Time Retheming a Legacy Web Application with Diazo in the C...Second Skin: Real-Time Retheming a Legacy Web Application with Diazo in the C...
Second Skin: Real-Time Retheming a Legacy Web Application with Diazo in the C...
Chris Shenton407 vues

Plus de Linaro

Deep Learning Neural Network Acceleration at the Edge - Andrea Gallo par
Deep Learning Neural Network Acceleration at the Edge - Andrea GalloDeep Learning Neural Network Acceleration at the Edge - Andrea Gallo
Deep Learning Neural Network Acceleration at the Edge - Andrea GalloLinaro
7K vues54 diapositives
Arm Architecture HPC Workshop Santa Clara 2018 - Kanta Vekaria par
Arm Architecture HPC Workshop Santa Clara 2018 - Kanta VekariaArm Architecture HPC Workshop Santa Clara 2018 - Kanta Vekaria
Arm Architecture HPC Workshop Santa Clara 2018 - Kanta VekariaLinaro
3K vues8 diapositives
Huawei’s requirements for the ARM based HPC solution readiness - Joshua Mora par
Huawei’s requirements for the ARM based HPC solution readiness - Joshua MoraHuawei’s requirements for the ARM based HPC solution readiness - Joshua Mora
Huawei’s requirements for the ARM based HPC solution readiness - Joshua MoraLinaro
3.7K vues20 diapositives
Bud17 113: distribution ci using qemu and open qa par
Bud17 113: distribution ci using qemu and open qaBud17 113: distribution ci using qemu and open qa
Bud17 113: distribution ci using qemu and open qaLinaro
662 vues63 diapositives
OpenHPC Automation with Ansible - Renato Golin - Linaro Arm HPC Workshop 2018 par
OpenHPC Automation with Ansible - Renato Golin - Linaro Arm HPC Workshop 2018OpenHPC Automation with Ansible - Renato Golin - Linaro Arm HPC Workshop 2018
OpenHPC Automation with Ansible - Renato Golin - Linaro Arm HPC Workshop 2018Linaro
2.3K vues16 diapositives
HPC network stack on ARM - Linaro HPC Workshop 2018 par
HPC network stack on ARM - Linaro HPC Workshop 2018HPC network stack on ARM - Linaro HPC Workshop 2018
HPC network stack on ARM - Linaro HPC Workshop 2018Linaro
2.6K vues21 diapositives

Plus de Linaro(20)

Deep Learning Neural Network Acceleration at the Edge - Andrea Gallo par Linaro
Deep Learning Neural Network Acceleration at the Edge - Andrea GalloDeep Learning Neural Network Acceleration at the Edge - Andrea Gallo
Deep Learning Neural Network Acceleration at the Edge - Andrea Gallo
Linaro7K vues
Arm Architecture HPC Workshop Santa Clara 2018 - Kanta Vekaria par Linaro
Arm Architecture HPC Workshop Santa Clara 2018 - Kanta VekariaArm Architecture HPC Workshop Santa Clara 2018 - Kanta Vekaria
Arm Architecture HPC Workshop Santa Clara 2018 - Kanta Vekaria
Linaro3K vues
Huawei’s requirements for the ARM based HPC solution readiness - Joshua Mora par Linaro
Huawei’s requirements for the ARM based HPC solution readiness - Joshua MoraHuawei’s requirements for the ARM based HPC solution readiness - Joshua Mora
Huawei’s requirements for the ARM based HPC solution readiness - Joshua Mora
Linaro3.7K vues
Bud17 113: distribution ci using qemu and open qa par Linaro
Bud17 113: distribution ci using qemu and open qaBud17 113: distribution ci using qemu and open qa
Bud17 113: distribution ci using qemu and open qa
Linaro662 vues
OpenHPC Automation with Ansible - Renato Golin - Linaro Arm HPC Workshop 2018 par Linaro
OpenHPC Automation with Ansible - Renato Golin - Linaro Arm HPC Workshop 2018OpenHPC Automation with Ansible - Renato Golin - Linaro Arm HPC Workshop 2018
OpenHPC Automation with Ansible - Renato Golin - Linaro Arm HPC Workshop 2018
Linaro2.3K vues
HPC network stack on ARM - Linaro HPC Workshop 2018 par Linaro
HPC network stack on ARM - Linaro HPC Workshop 2018HPC network stack on ARM - Linaro HPC Workshop 2018
HPC network stack on ARM - Linaro HPC Workshop 2018
Linaro2.6K vues
It just keeps getting better - SUSE enablement for Arm - Linaro HPC Workshop ... par Linaro
It just keeps getting better - SUSE enablement for Arm - Linaro HPC Workshop ...It just keeps getting better - SUSE enablement for Arm - Linaro HPC Workshop ...
It just keeps getting better - SUSE enablement for Arm - Linaro HPC Workshop ...
Linaro1.9K vues
Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ... par Linaro
Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...
Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...
Linaro2.4K vues
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant... par Linaro
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Linaro2.4K vues
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su... par Linaro
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Linaro2.7K vues
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline par Linaro
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
Linaro4.4K vues
HKG18-100K1 - George Grey: Opening Keynote par Linaro
HKG18-100K1 - George Grey: Opening KeynoteHKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening Keynote
Linaro839 vues
HKG18-318 - OpenAMP Workshop par Linaro
HKG18-318 - OpenAMP WorkshopHKG18-318 - OpenAMP Workshop
HKG18-318 - OpenAMP Workshop
Linaro608 vues
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline par Linaro
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
Linaro866 vues
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all par Linaro
HKG18-315 - Why the ecosystem is a wonderful thing, warts and allHKG18-315 - Why the ecosystem is a wonderful thing, warts and all
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
Linaro219 vues
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor par Linaro
HKG18- 115 - Partitioning ARM Systems with the Jailhouse HypervisorHKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
Linaro1.5K vues
HKG18-TR08 - Upstreaming SVE in QEMU par Linaro
HKG18-TR08 - Upstreaming SVE in QEMUHKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMU
Linaro476 vues
HKG18-113- Secure Data Path work with i.MX8M par Linaro
HKG18-113- Secure Data Path work with i.MX8MHKG18-113- Secure Data Path work with i.MX8M
HKG18-113- Secure Data Path work with i.MX8M
Linaro1.4K vues
HKG18-223 - Trusted FirmwareM: Trusted boot par Linaro
HKG18-223 - Trusted FirmwareM: Trusted bootHKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted boot
Linaro1.4K vues
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D... par Linaro
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
Linaro243 vues

Dernier

Business Analyst Series 2023 - Week 3 Session 5 par
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5DianaGray10
248 vues20 diapositives
Scaling Knowledge Graph Architectures with AI par
Scaling Knowledge Graph Architectures with AIScaling Knowledge Graph Architectures with AI
Scaling Knowledge Graph Architectures with AIEnterprise Knowledge
30 vues15 diapositives
Mini-Track: Challenges to Network Automation Adoption par
Mini-Track: Challenges to Network Automation AdoptionMini-Track: Challenges to Network Automation Adoption
Mini-Track: Challenges to Network Automation AdoptionNetwork Automation Forum
12 vues27 diapositives
STPI OctaNE CoE Brochure.pdf par
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdfmadhurjyapb
14 vues1 diapositive
Case Study Copenhagen Energy and Business Central.pdf par
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdfAitana
16 vues3 diapositives
Data Integrity for Banking and Financial Services par
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial ServicesPrecisely
21 vues26 diapositives

Dernier(20)

Business Analyst Series 2023 - Week 3 Session 5 par DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10248 vues
STPI OctaNE CoE Brochure.pdf par madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb14 vues
Case Study Copenhagen Energy and Business Central.pdf par Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana16 vues
Data Integrity for Banking and Financial Services par Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely21 vues
PharoJS - Zürich Smalltalk Group Meetup November 2023 par Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi127 vues
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive par Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Igniting Next Level Productivity with AI-Infused Data Integration Workflows par Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software263 vues
Serverless computing with Google Cloud (2023-24) par wesley chun
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
wesley chun11 vues
Empathic Computing: Delivering the Potential of the Metaverse par Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Five Things You SHOULD Know About Postman par Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman33 vues
Special_edition_innovator_2023.pdf par WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2217 vues
Transcript: The Details of Description Techniques tips and tangents on altern... par BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada136 vues
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... par Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker37 vues
Unit 1_Lecture 2_Physical Design of IoT.pdf par StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec12 vues

HKG18-120 - Devicetree Schema Documentation and Validation

  • 1. Devicetree Schema Documentation and Validation Grant Likely - Arm
  • 2. Devicetree Schema Documentation and Validation The problem: too easy to get devicetree wrong ● Data must be encoded in very specific ways ● Toolchain provides little validation ● No checks against documented schema (aka. bindings) ○ Schemas are loosely structure prose ○ Not machine readable ● Steep learning curve
  • 3. Project Goals ● Define a DT schema language ○ Human friendly ○ Machine readable ○ Include binding documentation ● Better tooling ○ Validate DTS files at build time ○ Validate DT Schema files are in the correct format ○ Useful error and warning messages ● Leverage existing technology ○ Use existing schema validation framework ■ Extended to handle quirks of DT ○ Don’t write a lot of code! ○ Don’t define an entirely new language! ● Generate Specification Documentation from Schema files
  • 4. Prototype Implementation http://github.com/robherring/yaml-bindings Based on: ● Python3 ● YAML 1.2 file format ● JSON Schema vocabulary ○ As implemented in Python jsonschema library ● Sphinx-Doc extension ~250 lines of python code ~250 lines of metaschema files ~250 lines of schema files
  • 5. YAML File Format http://www.yaml.org ● Human friendly ● Portable ● Structured ● Simple transcode DTS to YAML ● Extensible with custom datatypes ● Superset of JSON %YAML 1.2 --- YAML: YAML Ain't Markup Language What It Is: YAML is a human friendly data serialization standard for all programming languages. YAML Resources: YAML 1.2 (3rd Edition): http://yaml.org/spec/1.2/spec.html YAML 1.1 (2nd Edition): http://yaml.org/spec/1.1/ YAML 1.0 (1st Edition): http://yaml.org/spec/1.0/ YAML Issues Page: https://github.com/yaml/yaml/issues YAML Mailing List: yaml-core@lists.sourceforge.net YAML IRC Channel: "#yaml on irc.freenode.net" YAML Cookbook (Ruby): http://yaml4r.sourceforge.net/cookbook/ (local) YAML Reference Parser: http://ben-kiki.org/ypaste/ Projects: C/C++ Libraries: - libyaml # "C" Fast YAML 1.1 - Syck # (dated) "C" YAML 1.0 - yaml-cpp # C++ YAML 1.2 implementation Python: - PyYAML # YAML 1.1, pure python and libyaml binding - ruamel.yaml # YAML 1.2, update of PyYAML with round-tripping
  • 6. JSON Schema Vocabulary http://json-schema.org ● Intended for and encoded in JSON ○ Works fine with YAML ● Defines vocabulary and processing model for validation ○ Can extend with DT specific vocabulary ● JSON Schema nodes apply constraints on target document { "title": "Person", "type": "object", "properties": { "firstName": { "type": "string" }, "lastName": { "type": "string" }, "age": { "description": "Age in years", "type": "integer", "minimum": 0 } }, "required": ["firstName", "lastName"] }
  • 7. DT Schema Conceptual Model Meta- Schema .dts Schema. Schema. Schemaa Schema
  • 8. Examples -- (best to go look at project) Meta Schema %YAML 1.2 --- $id: "http://devicetree.org/meta-schemas/core.yaml#" $schema: "http://json-schema.org/draft-06/schema#" description: "Metaschema for devicetree binding documentation" allOf: [ { $ref: "http://json-schema.org/draft-06/schema#" } ] [...] properties: $id: pattern: 'http://devicetree.org/(test/)?schemas/.*.yaml#' $schema: const: "http://devicetree.org/meta-schemas/core.yaml#" [...] Required: [$id, $schema, version, title, maintainers, description] additionalProperties: false Schema %YAML 1.2 --- $id: http://devicetree.org/schemas/root-node.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: Common root node description: | Common properties always required in the root node of the tree maintainers: - Device Tree <dt@kernel.org> select: required: ["$path"] properties: $path: {enum: ["/"]} properties: compatible: {} model: type: string "#address-cells": {} "#size-cells": {} memory: {}
  • 9. Generate Documentation title: /aliases Node description: | A devicetree may have an aliases node (``/aliases``) that defines one or more alias properties. patternProperties: "^[a-z][a-z0-9-]*$": { type: string } additionalProperties: false examples: example1: | aliases { serial0 = "/simple-bus@fe000000/serial@11c500"; ethernet0 = "/simple-bus@fe000000/ethernet@31c000"; }; maintainers: - Devicetree Specification Mailing List <devicetree-spec@vger.kernel.org>
  • 10. Demonstration ● Devicetree Validation $ ./dt-validate.py test/juno.cpp.yaml ● Devicetree Schema Validation $ ./tools/dt-doc-validate test/schemas/good-example.yaml $ ./tools/dt-doc-validate test/schemas/bad-example.yaml ● Running Testcases $ make test
  • 11. Next Steps ● Start requiring binding files to be YAML encoded ○ Can be enforced in kernel ● Add DTSchema support into DTC ○ Add YAML output filter to DTC, or ○ Update libfdt Python bindings to expose JSON object model ● Get working with DTS files in kernel ● Flush out core schema files ● Decide where code should live ○ Separate Repo? ○ In DTC repo? ○ In Devicetree-schema repo? ○ In kernel? DTSchema hacking Tuesday and Wednesday mornings in Core Hacking Room
  • 12. Thank You #HKG18 HKG18 keynotes and videos on: connect.linaro.org For further information: www.linaro.org