在设备树(devicetree)中,删除语法用于从现有设备树中删除属性或节点。这通常在设备树覆盖文件(DTS)或片段文件中完成。该语法使用 `/delete-property/` 和 `/delete-node/` 指令。
以下是如何使用这些指令的示例:
In Device Tree (devicetree), the delete syntax is used to remove properties or nodes from an existing device tree. This is typically done in Device Tree Overlay files (DTS) or fragment files. The syntax uses the `/delete-property/` and `/delete-node/` directives. Here are examples of how to use these directives: |
Deleting a Property
要从节点中删除一个属性,需要使用 `/delete-property/` 指令,后面跟上属性名称。
To delete a property from a node, you use the `/delete-property/` directive followed by the property name.
&node {
/delete-property/ property-name;
};
例如,要删除标号为 `uart1` 的节点中的 `status` 属性:
For example, to delete the `status` property from a node with the label `uart1`:
&uart1 {
/delete-property/ status;
};
Deleting a Node
要删除整个节点,可使用 `/delete-node/`指令,后跟节点名称。
To delete an entire node, you use the `/delete-node/` directive followed by the node's name.
/delete-node/ &node;
例如,删除标号为 `i2c1` 的节点:
For example, to delete a node with the label `i2c1`:
/delete-node/ &i2c1;
通过这些指令,可以修改现有的设备树结构,以满足硬件配置需求。
These directives allow you to modify existing device tree structures to suit your hardware configuration needs.
所以,device tree文件既能方便修改覆盖节点的属性,还支持删除节点和属性,为其使用提供了极大的灵活性。