GitHub - devicetree-org/dt-schema: Devicetree schema tools
Devicetree Schema Tools / 设备树模式工具
dtschema 模块包含使用 json-schema ( JSON Schema )词汇表验证 Devicetree 模式的工具和模式数据。这些工具使用 DT 绑定模式文件验证 Devicetree 文件。工具还能验证 DT 绑定模式文件。模式文件采用与 JSON 兼容的 YAML 子集编写,具有人机可读性。
The dtschema module contains tools and schema data for Devicetree schema validation using the json-schema vocabulary. The tools validate Devicetree files using DT binding schema files. The tools also validate the DT binding schema files. Schema files are written in a JSON compatible subset of YAML to be both human and machine readable. |
1,Data Model / 数据模型
要了解验证是如何工作的,就必须了解模式数据是如何组织和使用的。如果您正在阅读这篇文章,我想您已经熟悉 Devicetree 和 .dts 文件格式了。
在这个资源库中,你会发现两种数据文件:模式和元模式。
To understand how validation works, it is important to understand how schema data is organized and used. If you're reading this, I assume you're already familiar with Devicetree and the .dts file format. In this repository you will find 2 kinds of data files; Schemas and Meta-Schemas. |
Devicetree Schemas / 设备树模式
Found under ./dtschema/schemas
Devicetree 模式描述了 Devicetree 数据的格式。原始 Devicetree 文件格式非常开放,不限制数据的编码方式。所以,编写devietree时很容易犯错误。模式文件对可以放入 Devicetree 的数据施加了限制。
该资源库包含 "核心 "模式,其中包括 DT 规范中定义的 DT 属性以及 GPIO、时钟和 PHY 绑定等常见绑定。
该资源库不包含特定设备绑定。这些绑定目前与 Devicetree 文件(.dts)一起保存在 Linux 内核树中。
验证时,该工具将加载所有能找到的模式文件,然后遍历 Devicetree 的所有节点。对于每个节点,工具将确定哪些模式适用,并确保节点数据与模式约束相匹配。未通过模式测试的节点将显示错误。不匹配任何