aboutsummaryrefslogtreecommitdiff
path: root/zh-cn/devices/architecture/dto
diff options
context:
space:
mode:
Diffstat (limited to 'zh-cn/devices/architecture/dto')
-rw-r--r--zh-cn/devices/architecture/dto/compile.html72
-rw-r--r--zh-cn/devices/architecture/dto/implement.html140
-rw-r--r--zh-cn/devices/architecture/dto/index.html108
-rw-r--r--zh-cn/devices/architecture/dto/multiple.html57
-rw-r--r--zh-cn/devices/architecture/dto/optimize.html246
-rw-r--r--zh-cn/devices/architecture/dto/partitions.html252
-rw-r--r--zh-cn/devices/architecture/dto/syntax.html315
7 files changed, 1190 insertions, 0 deletions
diff --git a/zh-cn/devices/architecture/dto/compile.html b/zh-cn/devices/architecture/dto/compile.html
new file mode 100644
index 00000000..d861ad4f
--- /dev/null
+++ b/zh-cn/devices/architecture/dto/compile.html
@@ -0,0 +1,72 @@
+<html devsite><head>
+ <title>编译和验证</title>
+ <meta name="project_path" value="/_project.yaml"/>
+ <meta name="book_path" value="/_book.yaml"/>
+ </head>
+ <body>
+ <!--
+ Copyright 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<p>您可以使用设备树编译器 (DTC) 来编译设备树源文件。不过,在将叠加 DT 应用于目标主 DT 之前,您还应该通过模拟 DTO 的行为来验证结果。</p>
+
+<h2 id="compile">通过 DTC 进行编译</h2>
+<p>使用 <code>dtc</code> 编译 <code>.dts</code> 时,您必须添加选项 <code>-@</code> 以在生成的 <code>.dtbo</code> 中添加 <code>__symbols__</code> 节点。<code>__symbols__</code> 节点包含带标签的所有节点的列表,DTO 库可使用这个列表作为参考。</p>
+
+<p>编译主 <code>.dts</code> 的示例命令:</p>
+
+<pre class="devsite-terminal">
+dtc -@ -O dtb -o my_main_dt.dtb my_main_dt.dts
+</pre>
+
+<p>编译叠加 DT <code>.dts</code> 的示例命令:</p>
+
+<pre class="devsite-terminal">
+dtc -@ -O dtb -o my_overlay_dt.dtbo my_overlay_dt.dts
+</pre>
+
+<p class="note"><strong>注意</strong>:如果您遇到 DTC 编译错误:<code>invalid option --'@'</code>,则可能需要更新 DTC 版本。在 AOSP 上游,官方 DTC 对 DTO 的支持从<a href="https://github.com/dgibson/dtc/tree/v1.4.4" class="external">版本 1.4.4</a> 开始,而且大部分补丁程序在 2016 年 12 月后就完成了合并。为了支持 DTO,建议您使用 AOSP 中的 <code><a href="https://android.googlesource.com/platform/external/dtc/" class="external">external/dtc</a></code>,它已与最新的 DTC 同步(已视需要合并 DTO 补丁程序)。</p>
+
+<h2 id="verify">在主机上验证 DTO 结果</h2>
+<p>验证流程可以帮助您识别将叠加 DT 放在主 DT 上时可能发生的错误。更新目标之前,您可以通过在 <code>.dts</code> 中使用 <code>/include/</code> 来模拟 DTO 行为,从而在主机上验证叠加 DT 的结果。</p>
+
+<p class="note"><strong>注意</strong>:<code>/include/</code> 不支持在叠加 DT 源中使用 <code>__overlay__</code>。</p>
+
+<p><img src="../images/treble_dto_simulate.png"/></p>
+<p><strong>图 1</strong> 使用语法 <code>/include/</code> 来模拟主机上的 DTO。</p>
+
+<ol>
+<li>创建叠加 <code>.dts</code> 的副本。在副本中,移除第一行头文件。例如:<pre>
+/dts-v1/;
+/plugin/;
+</pre>将文件另存为 <code>my_overlay_dt_wo_header.dts</code>(或您希望的任何文件名)。</li>
+
+<li>创建主 <code>.dts</code> 的副本。在副本中的最后一行后,为您在第 1 步中创建的文件附加包含语法。例如:<pre>
+/include/ "my_overlay_dt_wo_header.dts"
+</pre>将文件另存为 <code>my_main_dt_with_include.dts</code>(或您希望的任何文件名)。</li>
+
+<li>使用 <code>dtc</code> 编译 <code>my_main_dt_with_include.dts</code> 以获得合并的 DT,这应该与使用 DTO 进行编译所得到的结果相同。例如:<pre class="devsite-terminal">
+dtc -@ -O dtb -o my_merged_dt.dtb my_main_dt_with_include.dts
+</pre>
+</li>
+
+<li>使用 <code>dtc</code> 转储 <code>my_merged_dt.dto</code>。
+<pre class="devsite-terminal">
+dtc -O dts -o my_merged_dt.dts my_merged_dt.dtb
+</pre>
+</li>
+</ol>
+
+</body></html> \ No newline at end of file
diff --git a/zh-cn/devices/architecture/dto/implement.html b/zh-cn/devices/architecture/dto/implement.html
new file mode 100644
index 00000000..3be4594a
--- /dev/null
+++ b/zh-cn/devices/architecture/dto/implement.html
@@ -0,0 +1,140 @@
+<html devsite><head>
+ <title>实现 DTO</title>
+ <meta name="project_path" value="/_project.yaml"/>
+ <meta name="book_path" value="/_book.yaml"/>
+ </head>
+ <body>
+ <!--
+ Copyright 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<p>实现 DTO 包括分割设备树、编译、分区和运行。在实现可以正常工作之后,您还必须保持两个 DT 之间的兼容性,并确定用于确保每个 DT 分区安全性的策略。</p>
+
+<h2 id="divide">分割 DT</h2>
+<p>首先将设备树分割成两 (2) 部分:</p>
+<ul>
+<li><strong>主 DT</strong>。由 SoC 供应商提供的 SoC 公用部分和默认配置。</li>
+<li><strong>叠加 DT</strong>。由原始设计制造商 (ODM)/原始设备制造商(OEM) 提供的设备专属配置。</li>
+</ul>
+<p>分割设备树之后,您必须确保主 DT 和叠加 DT 之间的兼容性,以便通过合并主 DT 和叠加 DT 为设备生成完整的 DT。有关 DTO 格式和规则的详细信息,请参阅 <a href="/devices/architecture/dto/syntax.html">DTO 语法</a>。有关多个设备树的详细信息,请参阅<a href="/devices/architecture/dto/multiple.html">多个 DT</a>。</p>
+
+<h2 id="build">编译主 DT 和叠加 DT</h2>
+<p>要编译主 DT,请执行以下操作:</p>
+<ol>
+<li>将主 <code>.dts</code> 编译为 <code>.dtb</code> 文件。</li>
+<li>将 <code>.dtb</code> 文件刷写到引导加载程序在运行时可访问的分区(详见下文)。</li>
+</ol>
+
+<p>要编译叠加 DT,请执行以下操作:</p>
+<ol>
+<li>将叠加 DT <code>.dts</code> 编译为 <code>.dtbo</code> 文件。虽然此文件格式与已格式化为扁平化设备树的 <code>.dtb</code> 文件相同,但是不同的文件扩展名可以将其与主 DT 区分开来。</li>
+<li>将 <code>.dtbo</code> 文件刷写到引导加载程序在运行时可访问的分区(详见下文)。</li>
+</ol>
+
+<p>要详细了解如何使用 DTC 进行编译并在主机上验证 DTO 结果,请参阅<a href="/devices/architecture/dto/compile.html">编译和验证</a>。
+</p>
+
+<h2 id="partition">对 DT 进行分区</h2>
+<p>在闪存中确定引导加载程序在运行时可访问和可信的位置信息以放入 <code>.dtb</code> 和 <code>.dtbo</code>。</p>
+
+<p>主 DT 的示例位置:</p>
+<ul>
+<li>引导分区的一部分,已附加到内核 (<code>image.gz</code>)。</li>
+<li>单独的 DT blob (<code>.dtb</code>),位于专用分区 (<code>dtb</code>) 中。</li>
+</ul>
+
+<p>叠加 DT 的示例位置:</p>
+
+<div style="width:75%">
+<div class="attempt-left">
+<table><tbody><tr><th style="text-align: center;">唯一分区</th></tr></tbody></table>
+<figure id="treble_dto_dtbo_partition_1">
+<img src="../images/treble_dto_dtbo_partition_1.png" style="display:block; margin:0 auto"/>
+<figcaption>
+<strong>图 1</strong> 将 <code>.dtbo</code> 放在唯一的分区(例如 <code>dtbo</code> 分区)中。
+</figcaption>
+</figure>
+</div>
+<div class="attempt-right">
+<figure id="treble_dto_dtbo_partition_2">
+<table><tbody><tr><th style="text-align: center;">ODM 分区</th></tr></tbody></table>
+<img src="../images/treble_dto_dtbo_partition_2.png" style="display:block; margin:0 auto"/>
+<figcaption>
+<strong>图 2.</strong> 将 <code>.dtbo</code> 放入 <code>odm</code> 分区中(仅在您的引导加载程序能够从 <code>odm</code> 分区的文件系统中加载数据时才这样做)。
+</figcaption>
+</figure>
+</div>
+</div>
+
+<p class="note" style="clear:both"><strong>注意</strong>:叠加 DT 分区的大小取决于设备和主 DT blob 上所需的更改量。通常,8 MB 已足够当前使用并已为未来扩展留出了空间(如果需要的话)。</p>
+
+<p>对于支持<a href="https://source.android.com/devices/tech/ota/ab_updates.html">无缝 (A/B) 更新</a>的设备,请用 A/B 来标识主 DT 和叠加 DT 分区:</p>
+
+<div style="width:75%">
+<div class="attempt-left">
+<table><tbody><tr><th style="text-align: center;">示例 1</th></tr></tbody></table>
+<figure id="treble_dto_dtbo_ab_1">
+<img src="../images/treble_dto_dtbo_ab_1.png" style="display:block; margin:0 auto"/>
+<figcaption>
+<strong>图 3.</strong> DTBO 分区 A/B,示例 1。
+</figcaption>
+</figure>
+</div>
+<div class="attempt-right">
+<table><tbody><tr><th style="text-align: center;">示例 2</th></tr></tbody></table>
+<figure id="treble_dto_dtbo_ab_2">
+<img src="../images/treble_dto_dtbo_ab_2.png" style="display:block; margin:0 auto"/>
+<figcaption>
+<strong>图 4.</strong> DTBO 分区 A/B,示例 2。
+</figcaption>
+</figure>
+</div>
+</div>
+
+<h2 id="run" style="clear:both">在引导加载程序中运行</h2>
+<p>要运行,请执行以下操作:</p>
+
+<figure id="treble_dto_dtbo">
+<img src="../images/treble_dto_dtbo.png"/>
+<figcaption><strong>图 5.</strong> 引导加载程序中设备树叠加层的典型运行时实现。</figcaption>
+</figure>
+
+<ol>
+<li>将 <code>.dtb</code> 从存储加载到内存中。</li>
+<li>将 <code>.dtbo</code> 从存储加载到内存中。</li>
+<li>用 <code>.dtbo</code> 叠加 <code>.dtb</code> 以形成合并的 DT。</li>
+<li>启动内核(已给定合并 DT 的内存地址)。</li>
+</ol>
+
+<h2 id="maintain">保持兼容性</h2>
+<p>主 DTB(来自 SoC 供应商)会被视为 DTBO 的 API 表面。将设备树分离为 SoC 通用部件和设备专用部件后,您必须确保这两个部件以后相互兼容,包括:</p>
+
+<ul>
+<li><strong>主 DT 中的 DT 定义</strong><em>(例如,节点、属性、标签)</em>。主 DT 中的任何定义更改都可能会触发叠加 DT 中的更改。例如,要更正主 DT 中的某个节点名称,请定义映射到原始节点名称的“别名”标签(以避免更改叠加 DT)。</li>
+<li><strong>叠加 DT 的存储位置</strong><em>(例如,分区名称、存储格式)</em>。</li>
+</ul>
+
+<h2 id="security">确保安全</h2>
+<p>引导加载程序必须确保 DTB/DTBO 安全无虞、未被修改且未被损坏。您可以使用任何解决方案来保护 DTB/DTBO,例如,VBoot 1.0 中的<a href="/security/verifiedboot/verified-boot#signature_format">启动映像签名</a>或 <a href="https://android.googlesource.com/platform/external/avb/+/master/README.md#The-VBMeta-struct" class="external">AVB 哈希页脚</a> (VBoot 2.0)。
+</p>
+
+<ul>
+<li>如果 DTB/DTBO 位于唯一的分区中,则可以将该分区添加到 AVB 的信任链。信任链从硬件保护的信任根开始,并进入引导加载程序,从而验证 DTB/DTBO 分区的完整性和真实性。</li>
+<li>如果 DTB/DTBO 位于现有分区(如 <code>odm</code> 分区)中,则该分区应位于 AVB 的信任链中。(DTBO 分区可以与 <code>odm</code> 分区共享一个公共密钥)。</li>
+</ul>
+
+<p>有关详细信息,请参阅<a href="/security/verifiedboot/index.html">验证启动</a>。</p>
+
+</body></html> \ No newline at end of file
diff --git a/zh-cn/devices/architecture/dto/index.html b/zh-cn/devices/architecture/dto/index.html
new file mode 100644
index 00000000..6f4e2d87
--- /dev/null
+++ b/zh-cn/devices/architecture/dto/index.html
@@ -0,0 +1,108 @@
+<html devsite><head>
+ <title>设备树叠加层</title>
+ <meta name="project_path" value="/_project.yaml"/>
+ <meta name="book_path" value="/_book.yaml"/>
+ </head>
+ <body>
+ <!--
+ Copyright 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<p>设备树 (DT) 是用于描述“不可发现”硬件的命名节点和属性的数据结构。操作系统(例如在 Android 中使用的 Linux 内核)会使用 DT 来支持 Android 设备使用的各种硬件配置。硬件供应商会提供自己的 DT 源文件,接下来 Linux 会将这些文件编译到引导加载程序使用的设备树 Blob (DTB) 文件中。</p><a href="https://lkml.org/lkml/2012/11/5/615" class="external">设备树叠加层</a> (DTO) 可让主要的 DTB 叠加在设备树上。使用 DTO 的引导加载程序可以维护系统芯片 (SoC) DT,并动态叠加设备特定的 DT,从而向树中添加节点并对现有树中的属性进行更改。<p></p>
+
+<p>本页详细介绍了引导加载程序加载 DT 的典型工作流程,并列出了常见的 DT 术语。本节的其他页介绍了如何<a href="/devices/architecture/dto/implement.html">为 DTO 实现引导加载程序支持</a>,如何<a href="/devices/architecture/dto/compile.html">编译</a>、验证和<a href="/devices/architecture/dto/optimize.html">优化 DTO 实现</a>以及如何<a href="/devices/architecture/dto/multiple.html">使用多个 DT</a>。您还可以获取关于 <a href="/devices/architecture/dto/syntax.html">DTO 语法</a>和推荐的 <a href="/devices/architecture/dto/partition.html">DTO/DTBO 分区格式的详细信息</a>。</p>
+
+<h2 id="load-dt">加载设备树</h2>
+<p>在引导加载程序中加载设备树会涉及到编译、分区和运行。</p>
+
+<figure id="treble_dto_bootloader">
+<img src="../images/treble_dto_bootloader.png"/>
+<figcaption><strong>图 1</strong> 用于在引导加载程序中加载设备树的典型实现。</figcaption>
+</figure>
+
+<ol>
+<li>要进行编译,请执行以下操作:<ul>
+<li>使用设备树编译器 (<code>dtc</code>) 将设备树源 (<code>.dts</code>) 编译为设备树 blob (<code>.dtb</code>)(格式化为扁平设备树)。</li>
+<li>将 <code>.dtb</code> 文件刷写到引导加载程序在运行时可访问的位置(详见下文)。</li>
+</ul>
+</li>
+<li>要进行分区,请确定闪存中引导加载程序在运行时可访问和可信的位置以放入 <code>.dtb</code>。位置示例:
+
+<div style="width:75%">
+<div class="attempt-left">
+<table><tbody><tr><th style="text-align: center;">启动分区</th></tr></tbody></table>
+<figure id="treble_dto_partition_1">
+<img src="../images/treble_dto_partition_1.png" style="display:block; margin:0 auto"/>
+<figcaption>
+<strong>图 2.</strong> 将 <code>.dtb</code> 附加到 <code>image.gz</code> 并作为“<code>kernel</code>”传递到 <code>mkbootimg</code>,从而将其放入启动分区。
+</figcaption>
+</figure>
+</div>
+<div class="attempt-right">
+<table><tbody><tr><th style="text-align: center;">唯一的分区</th></tr></tbody></table>
+<figure id="treble_dto_partition_2">
+<img src="../images/treble_dto_partition_2.png" style="display:block; margin:0 auto"/>
+<figcaption>
+<strong>图 3.</strong> 将 <code>.dtb</code> 放在唯一的分区(例如 <code>dtb</code> 分区)中。
+</figcaption>
+</figure>
+</div>
+</div>
+</li>
+
+<li style="clear:both">要运行,请执行以下操作:
+<ul>
+<li>将 <code>.dtb</code> 从存储加载到内存中。</li>
+<li>启动内核(已给定所加载 DT 的内存地址)。</li>
+</ul>
+</li>
+</ol>
+
+<h2 id="terms">术语</h2>
+<p>本节使用以下设备树术语:</p>
+<table>
+<tbody>
+<tr>
+<th>DT</th>
+<td>设备树</td>
+</tr>
+<tr>
+<th>DTB</th>
+<td>设备树 Blob</td>
+</tr>
+<tr>
+<th>DTBO</th>
+<td>用于叠加的设备树 Blob</td>
+</tr>
+<tr>
+<th>DTC</th>
+<td>设备树编译器</td>
+</tr>
+<tr>
+<th>DTO</th>
+<td>设备树叠加层</td>
+</tr>
+<tr>
+<th>DTS</th>
+<td>设备树源</td>
+</tr>
+<tr>
+<th>FDT</th>
+<td>扁平化设备树,包含在 <code>.dtb</code> blob 文件中的二进制格式</td>
+</tr>
+</tbody>
+</table>
+
+</body></html> \ No newline at end of file
diff --git a/zh-cn/devices/architecture/dto/multiple.html b/zh-cn/devices/architecture/dto/multiple.html
new file mode 100644
index 00000000..2f1a9a26
--- /dev/null
+++ b/zh-cn/devices/architecture/dto/multiple.html
@@ -0,0 +1,57 @@
+<html devsite><head>
+ <title>使用多个 DT</title>
+ <meta name="project_path" value="/_project.yaml"/>
+ <meta name="book_path" value="/_book.yaml"/>
+ </head>
+ <body>
+ <!--
+ Copyright 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<p>很多 SoC 供应商和原始设计制造商 (ODM) 都支持在一台设备上使用多个 DT,从而使一个映像能够为多个 SKU/配置提供支持。在这种情况下,引导加载程序会在运行时识别硬件,并加载相应的 DT:</p>
+
+<p><img src="../images/treble_dto_multiple_dt.png"/></p>
+<figcaption><strong>图 1</strong> 引导加载程序中的多个设备树叠加层。</figcaption>
+
+<p class="note"><strong>注意</strong>:使用多个 DT 不是强制性要求。</p>
+
+<h2 id="setting">设置</h2>
+<p>要向 DTO 模型添加对多个 DT 的支持,请设置一个主 DT 列表和另一个叠加 DT 列表。</p>
+
+<p><img src="../images/treble_dto_multiple_dt_runtime.png"/></p>
+<figcaption><strong>图 2.</strong> 多个 DT 的运行时 DTO 实现。</figcaption>
+
+<p>引导加载程序应该能够:</p>
+
+<ul>
+<li>读取 SoC ID 并选择相应的主 DT,并</li>
+<li>读取板 ID 并选择相应的叠加 DT。</li>
+</ul>
+
+<p>仅选择一个主 DT 和一个叠加 DT 以便在运行时使用,并且所选择的对必须是兼容的。</p>
+
+<h2 id="partition">分区</h2>
+<p>要进行分区,请在闪存中确定引导加载程序在运行时可访问和可信的位置,以存储 DTB 和 DTBO(引导加载程序必须能够在匹配的进程中找到这些文件)。请记住,DTB 和 DTBO 不能存在于同一个分区中。如果您的 DTB/DTBO 位于 <code>dtb</code>/<code>dtbo</code> 分区中,请使用 <a href="/devices/architecture/dto/partitions.html">DTB/DTBO 分区格式</a>中详细列出的表结构和头文件格式。</p>
+
+<h2 id="runtime">在引导加载程序中运行</h2>
+<p>要运行,请执行以下操作:</p>
+<ol>
+<li><strong>标识 SoC</strong> 并将相应的 .dtb 从存储加载到内存中。</li>
+<li><strong>标识板</strong>并将相应的 <code>.dtbo</code> 从存储加载到内存中。</li>
+<li>用 <code>.dtbo</code> 叠加 <code>.dtb</code> 以形成合并的 DT。</li>
+<li>启动内核(已给定合并 DT 的内存地址)。</li>
+</ol>
+
+</body></html> \ No newline at end of file
diff --git a/zh-cn/devices/architecture/dto/optimize.html b/zh-cn/devices/architecture/dto/optimize.html
new file mode 100644
index 00000000..3fca0732
--- /dev/null
+++ b/zh-cn/devices/architecture/dto/optimize.html
@@ -0,0 +1,246 @@
+<html devsite><head>
+ <title>优化 DTO</title>
+ <meta name="project_path" value="/_project.yaml"/>
+ <meta name="book_path" value="/_book.yaml"/>
+ </head>
+ <body>
+ <!--
+ Copyright 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<p>本页详细介绍了您可以对 DTO 实现进行哪些优化,描述了针对叠加根节点的限制,并提供了示例实现说明和代码。</p>
+
+<h2 id="kernel">内核命令行</h2>
+<p>设备树中的原始内核命令行位于 <code>chosen/bootargs</code> 节点中。引导加载程序必须将此位置与内核命令行的其他源进行串联:</p>
+<pre class="prettyprint">
+/dts-v1/;
+
+/ {
+ chosen: chosen {
+ bootargs = "...";
+ };
+};
+</pre>
+
+<p>DTO <strong>无法</strong>串联主 DT 和叠加 DT 的值。建议您将主 DT 的内核命令行置入 <code>chosen/bootargs</code> 中,将叠加 DT 的内核命令行置入 <code>chosen/bootargs_ext</code> 中。接下来,引导加载程序会合并这些位置,并将结果传递给内核。</p>
+
+<table>
+<tbody><tr>
+<th width="50%">main.dts</th>
+<th>overlay.dts</th>
+</tr>
+<tr>
+<td>
+<pre class="prettyprint">
+
+/dts-v1/;
+
+/ {
+ chosen: chosen {
+ bootargs = "...";
+ };
+};
+</pre>
+</td>
+
+<td class="alt">
+<pre class="prettyprint">
+
+/dts-v1/;
+/plugin/;
+
+&amp;chosen {
+ bootargs_ext = "...";
+};
+</pre>
+</td>
+</tr>
+</tbody></table>
+
+<h2 id="libufdt">libufdt</h2>
+<p>虽然最新的 <code><a href="https://github.com/dgibson/dtc/tree/master/libfdt" class="external">libfdt</a></code> 支持 DTO,但是我们建议您使用 <code>libufdt</code> 来实现 DTO(源文件位于 AOSP 中的 <code><a href="https://android.googlesource.com/platform/system/libufdt/+/refs/heads/master" class="external">platform/system/libufdt</a></code> 下)。<code>libufdt</code> 会从扁平化设备树 (FDT) 编译真实的树结构(非扁平化设备树,简称为 <em>ufdt</em>),因而可以改善两个 <code>.dtb</code> 文件(从 O(N2) 到 O(N),其中 N 是树中的节点编号)的合并。</p>
+
+<h3 id="performance">性能测试</h3>
+<p>在 Google 的内部测试中,进行编译后,在 2405 <code>.dtb</code> 和 283 <code>.dtbo</code> DT 节点上使用 <code>libufdt</code> 生成了 70,618 字节和 8,566 字节的文件大小。与从 FreeBSD 移植的 <a href="http://fxr.watson.org/fxr/source/boot/fdt/" class="external">DTO 实现</a>(运行时为 124 毫秒)相比,<code>libufdt</code> DTO 运行时为 10 毫秒。</p>
+
+<p>在 Pixel 设备的性能测试中,我们比较了 <code>libufdt</code> 和 <code>libfdt</code>。基本节点数量带来的影响相似,但包含以下差异:</p>
+<ul>
+<li>500 次叠加(附加或覆盖)操作具有 6〜8 倍的时间差异</li>
+<li>1000 次叠加(附加或覆盖)操作具有 8〜10 倍的时间差异</li>
+</ul>
+
+<p>附加计数设置为 X 的示例:</p>
+<p><img src="../images/treble_dto_appending.png"/></p>
+<figcaption><strong>图 1</strong> 附加计数为 X。</figcaption>
+
+<p>覆盖计数设置为 X 的示例:</p>
+<p><img src="../images/treble_dto_overriding.png"/></p>
+<figcaption><strong>图 2.</strong> 覆盖计数为 X。</figcaption>
+
+<p><code>libufdt</code> 是用一些 <code>libfdt</code> API 和数据结构开发的。使用 <code>libufdt</code> 时,您必须包含并链接 <code>libfdt</code>(不过,您可以在代码中使用 <code>libfdt</code> API 来操作 DTB 或 DTBO)。</p>
+
+<h3 id="api">libufdt DTO API</h3>
+<p><code>libufdt</code> 中适用于 DTO 的主要 API 如下:</p>
+<pre class="prettyprint">
+struct fdt_header *ufdt_apply_overlay(
+ struct fdt_header *main_fdt_header,
+ size_t main_fdt_size,
+ void *overlay_fdt,
+ size_t overlay_size);
+</pre>
+
+<p>参数 <code>main_fdt_header</code> 是主 DT,<code>overlay_fdt</code> 是包含 <code>.dtbo</code> 文件内容的缓冲区。返回值是一个包含合并的 DT 的新缓冲区(如果出现错误,则返回 <code>null</code>)。合并的 DT 会在 FDT 中进行格式化,您可以在启动内核时将其传递给内核。</p>
+
+<p>来自返回值的新缓冲区由 <code>dto_malloc()</code>(您应在将 <code>libufdt</code> 移植到引导加载程序时加以实现)创建。有关参考实现,请参阅 <code>sysdeps/libufdt_sysdeps_*.c</code>。</p>
+
+<h2 id="root">根节点限制</h2>
+<p>您不能将新节点或属性叠加到主 DT 的根节点,因为叠加操作依赖于标签。由于主 DT 必须定义一个标签,而叠加 DT 则会分配要叠加标签的节点,因此,我们无法为根节点提供标签(因而不能叠加根节点)。</p>
+
+<p>SoC 供应商必须定义主 DT 的叠加能力;ODM/OEM 只能使用由 SoC 供应商定义的标签附加或叠加节点。要解决这个问题,您可以在基础 DT 中的根节点下定义一个 <strong><code>odm</code></strong> 节点,使叠加 DT 中的所有 ODM 节点都能够添加新节点。或者,您也可以将基础 DT 中的所有 SoC 相关节点放在根节点下的 <strong><code>soc</code></strong> 节点中,如下所述:</p>
+
+<table>
+<tbody><tr>
+<th width="50%">main.dts</th>
+<th>overlay.dts</th>
+</tr>
+<tr>
+<td>
+<pre>
+
+/dts-v1/;
+
+/ {
+ compatible = "corp,bar";
+ ...
+
+ chosen: chosen {
+ bootargs = "...";
+ };
+
+ /* nodes for all soc nodes */
+ soc {
+ ...
+ soc_device@0: soc_device@0 {
+ compatible = "corp,bar";
+ ...
+ };
+ ...
+ };
+
+ odm: odm {
+ /* reserved for overlay by odm */
+ };
+};
+</pre>
+</td>
+
+<td class="alt">
+<pre class="prettyprint">
+
+/dts-v1/;
+/plugin/;
+
+/ {
+};
+
+&amp;chosen {
+ bootargs_ex = "...";
+};
+
+&amp;odm {
+ odm_device@0 {
+ ...
+ };
+ ...
+};
+</pre>
+</td>
+</tr>
+</tbody></table>
+
+<h2 id="sample">DTO 实现示例</h2>
+<p>以下说明介绍了使用 <code>libufdt</code> 进行 DTO 实现的示例过程(示例代码如下)。</p>
+
+<h3 id="sample-instructions">示例 DTO 说明</h3>
+
+<ol>
+<li>包含库。要使用 <code>libufdt</code>,请包含 <code>libfdt</code> 以用于数据结构和 API:<pre class="prettyprint">
+#include &lt;libfdt.h&gt;
+#include &lt;ufdt_overlay.h&gt;
+</pre>
+</li>
+
+<li>加载主 DT 和叠加 DT。将 <code>.dtb</code> 和 <code>.dtbo</code> 从存储加载到内存中(确切的步骤取决于您的设计)。此时,您应该设置 <code>.dtb</code>/<code>.dtbo</code> 的缓冲区和大小:<pre class="prettyprint">
+main_size = my_load_main_dtb(main_buf, main_buf_size)
+</pre>
+<pre class="prettyprint">
+overlay_size = my_load_overlay_dtb(overlay_buf, overlay_buf_size);
+</pre>
+</li>
+
+<li>叠加 DT:<ol>
+
+<li>使用 <code>ufdt_install_blob()</code> 获取主 DT 的 FDT 头文件:<pre class="prettyprint">
+main_fdt_header = ufdt_install_blob(main_buf, main_size);
+main_fdt_size = main_size;
+</pre>
+</li>
+<li>对 DTO 调用 <code>ufdt_apply_overlay()</code> 以获取采用 FDT 格式的合并 DT:<pre class="prettyprint">
+merged_fdt = ufdt_apply_overlay(main_fdt_header, main_fdt_size,
+ overlay_buf, overlay_size);
+</pre>
+</li>
+
+<li>要获取 <code>merged_fdt</code> 的大小,请使用 <code>dtc_totalsize()</code>:<pre class="prettyprint">
+merged_fdt_size = dtc_totalsize(merged_fdt);
+</pre>
+</li>
+
+<li>传递合并的 DT 以启动内核。当您启动内核时,请将合并的 DT 传递给内核:<pre class="prettyprint">
+my_kernel_entry(0, machine_type, merged_fdt);
+</pre>
+</li>
+</ol></li></ol>
+
+<h3 id="sample-code">示例 DTO 代码</h3>
+<pre class="prettyprint">
+#include &lt;libfdt.h&gt;
+#include &lt;ufdt_overlay.h&gt;
+
+…
+
+{
+ struct fdt_header *main_fdt_header;
+ struct fdt_header *merged_fdt;
+
+ /* load main dtb into memory and get the size */
+ main_size = my_load_main_dtb(main_buf, main_buf_size);
+
+ /* load overlay dtb into memory and get the size */
+ overlay_size = my_load_overlay_dtb(overlay_buf, overlay_buf_size);
+
+ /* overlay */
+ main_fdt_header = ufdt_install_blob(main_buf, main_size);
+ main_fdt_size = main_size;
+ merged_fdt = ufdt_apply_overlay(main_fdt_header, main_fdt_size,
+ overlay_buf, overlay_size);
+ merged_fdt_size = dtc_totalsize(merged_fdt);
+
+ /* pass to kernel */
+ my_kernel_entry(0, machine_type, merged_fdt);
+}
+</pre>
+
+</body></html> \ No newline at end of file
diff --git a/zh-cn/devices/architecture/dto/partitions.html b/zh-cn/devices/architecture/dto/partitions.html
new file mode 100644
index 00000000..a5fb8bea
--- /dev/null
+++ b/zh-cn/devices/architecture/dto/partitions.html
@@ -0,0 +1,252 @@
+<html devsite><head>
+ <title>DTB/DTBO 分区</title>
+ <meta name="project_path" value="/_project.yaml"/>
+ <meta name="book_path" value="/_book.yaml"/>
+ </head>
+ <body>
+ <!--
+ Copyright 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<p>如果您的 DTB/DTBO 位于专属的分区(例如 <code>dtb</code> 和 <code>dtbo</code> 分区)中,请使用以下表格结构和头文件格式:</p>
+
+<p><img src="../images/treble_dto_partition_layout.png"/></p>
+<figcaption><strong>图 1</strong> <code>dtb</code>/<code>dtbo</code> 分区布局示例(要了解 AVB 签名相关信息,请参阅<a href="/devices/architecture/dto/implement.html#security">安全性</a>)。
+</figcaption>
+
+<h2 id="structures">数据结构</h2>
+<p><code>dt_table_header</code> <strong>仅</strong>适用于 <code>dtb</code>/<code>dtbo</code> 分区;您不能在 <code>image.gz</code> 末尾处附加此格式。如果您有一个 DTB/DTBO,则仍必须使用此格式(并且,<code>dt_table_header</code> 中的 <code>dt_entry_size</code> 为 1)。</p>
+
+<pre class="prettyprint">
+#define DT_TABLE_MAGIC 0xd7b7ab1e
+
+struct dt_table_header {
+ uint32_t magic; // DT_TABLE_MAGIC
+ uint32_t total_size; // includes dt_table_header + all dt_table_entry
+ // and all dtb/dtbo
+ uint32_t header_size; // sizeof(dt_table_header)
+
+ uint32_t dt_entry_size; // sizeof(dt_table_entry)
+ uint32_t dt_entry_count; // number of dt_table_entry
+ uint32_t dt_entries_offset; // offset to the first dt_table_entry
+ // from head of dt_table_header
+
+ uint32_t page_size; // flash page size we assume
+ uint32_t reserved[1]; // must be zero
+};
+
+struct dt_table_entry {
+ uint32_t dt_size;
+ uint32_t dt_offset; // offset from head of dt_table_header
+
+ uint32_t id; // optional, must be zero if unused
+ uint32_t rev; // optional, must be zero if unused
+ uint32_t custom[4]; // optional, must be zero if unused
+};
+</pre>
+
+<p>要读取所有 <code>dt_table_entry</code>,请使用 <code>dt_entry_size</code>、<code>dt_entry_count</code> 和 <code>dt_entries_offset</code>。示例:</p>
+<pre class="prettyprint">
+my_read(entries_buf,
+ header_addr + header-&gt;dt_entries_offset,
+ header-&gt;dt_entry_size * header-&gt;dt_entry_count);
+</pre>
+
+<p><code>dt_table_entry</code> 中的 <code>id</code>、<code>rev</code>、<code>custom</code> 是设备树的可选硬件标识,引导加载程序可以使用这些标识有效地识别要加载的 DTB/DTBO。如果引导加载程序需要获取更多信息,请将其放在 DTB/DTBO 中,引导加载程序可在这里解析 DTB/DTBO,从而读取这些信息(参见下面的示例代码)。</p>
+
+<h2 id="sample-code">示例代码</h2>
+<p>以下示例代码可检查引导加载程序中的硬件标识。
+</p>
+
+<ul>
+<li><code>check_dtbo()</code> 函数用于检查硬件标识。首先它会检查结构 <code>dt_table_entry</code> 中的数据(<code>id</code>、<code>rev</code> 等)。如果这种数据未能提供充足的信息,它会将 <code>dtb</code> 数据加载到内存中,并检查 <code>dtb</code> 中的值。</li>
+<li><code>my_hw_information</code> 和 <code>soc_id</code> 属性的值会在根节点进行解析(请参见 <code>my_dtbo_1.dts</code> 中的示例)。
+
+<pre class="prettyprint">
+[my_dtbo_1.dts]
+/dts-v1/;
+/plugin/;
+
+/ {
+ /* As DTS design, these properties only for loader, won't overlay */
+ compatible = "board_manufacturer,board_model";
+
+ /* These properties are examples */
+ board_id = &lt;0x00010000&gt;;
+ board_rev = &lt;0x00010001&gt;;
+ another_hw_information = "some_data";
+ soc_id = &lt;0x68000000&gt;;
+ ...
+};
+
+&amp;device@0 {
+ value = &lt;0x1&gt;;
+ status = "okay";
+};
+
+[my_bootloader.c]
+int check_dtbo(const dt_table_entry *entry, uint32_t header_addr) {
+ ...
+ if (entry-&gt;id != ... || entry-&gt;rev != ...) {
+ ...
+ }
+ ...
+ void * fdt_buf = my_load_dtb(header_addr + entry-&gt;dt_offset, entry-&gt;dt_size);
+ int root_node_off = fdt_path_offset(fdt_buf, "/");
+ ...
+ const char *my_hw_information =
+ (const char *)fdt_getprop(fdt_buf, root_node_off, "my_hw_information", NULL);
+ if (my_hw_information != NULL &amp;&amp; strcmp(my_hw_information, ...) != 0) {
+ ...
+ }
+ const fdt32_t *soc_id = fdt_getprop(fdt_buf, root_node_off, "soc_id", NULL);
+ if (soc_id != NULL &amp;&amp; *soc_id != ...) {
+ ...
+ }
+ ...
+}
+</pre></li></ul>
+
+<h2 id="mkdtimg">mkdtimg</h2>
+<p><code>mkdtimg</code> 是用于创建 <code>dtb</code>/<code>dtbo</code> 映像(AOSP 中 <code>system/libufdt</code> 下的<a href="https://android-review.googlesource.com/#/q/topic:mkdtimg+(status:open+OR+status:merged+OR+status:pending)" class="external">源代码</a>)的工具。<code>mkdtimg</code> 支持多个命令,包括 <code>create</code>、<code>cfg_create</code> 和 <code>dump</code>。</p>
+
+<h3 id="create">create</h3>
+<p>使用 <code>create</code> 命令创建 <code>dtb</code>/<code>dtbo</code> 映像:</p>
+<pre class="prettyprint">
+$mkdtimg create &lt;image_filename&gt; (&lt;global-option&gt;...) \
+ &lt;ftb1_filename&gt; (&lt;entry1_option&gt;...) \
+ &lt;ftb2_filename&gt; (&lt;entry2_option&gt;...) \
+ ...
+</pre>
+
+<p><code>ftbX_filename</code> 会在映像中生成一个 <code>dt_table_entry</code>。<code>entryX_option</code> 是分配给 <code>dt_table_entry</code> 的值。这些值可以是以下任一值:</p>
+<pre class="prettyprint">
+--id=&lt;number|path&gt;
+--rev=&lt;number|path&gt;
+--custom0=&lt;number|path&gt;
+--custom1=&lt;number|path&gt;
+--custom2=&lt;number|path&gt;
+--custom3=&lt;number|path&gt;
+</pre>
+
+<p>数字值可以是 32 位数字(如 68000)或十六进制数字(如 0x6800)。或者,您也可以使用以下格式指定路径:</p>
+<pre class="prettyprint">
+&lt;full_node_path&gt;:&lt;property_name&gt;
+</pre>
+
+<p>例如,<code>/board/:id</code>。<code>mkdtimg</code> 从 DTB/DTBO 文件中的路径读取值,并将值(32 位)分配给 <code>dt_table_entry</code> 中的相对属性。或者,您也可以将 <code>global_option</code> 作为所有条目的默认选项。<code>dt_table_header</code> 中 <code>page_size</code> 的默认值为 2048;可使用 <code>global_option --page_size=&lt;number&gt;</code> 分配不同的值。</p>
+
+<p>示例:</p>
+<pre class="prettyprint">
+[board1.dts]
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "board_manufacturer,board_model";
+ board_id = &lt;0x00010000&gt;;
+ board_rev = &lt;0x00010001&gt;;
+ another_hw_information = "some_data";
+ ...
+};
+
+&amp;device@0 {
+ value = &lt;0x1&gt;;
+ status = "okay";
+};
+
+$mkdtimg create dtbo.img --id=/:board_id --custom0=0xabc \
+ board1.dtbo \
+ board2.dtbo --id=0x6800 \
+ board3.dtbo --id=0x6801 --custom0=0x123
+</pre>
+
+<ul>
+<li>第一个 <code>dt_table_entry</code> (<code>board1.dtbo</code>) <code>id</code> 为 <code>0x00010000</code>,<code>custom[0]</code> 为 <code>0x00000abc</code>。</li>
+<li>第二个 <code>id</code> 为 <code>0x00006800</code>,<code>custom[0]</code> 为 <code>0x00000abc</code>。</li>
+<li>第三个 <code>id</code> 为 <code>0x00006801</code>,<code>custom[0]</code> 为 <code>0x00000123</code>。</li>
+<li>所有其他项均使用默认值 (<code>0</code>)。</li>
+</ul>
+
+<h3 id="cfg-create">cfg_create</h3>
+<p><code>cfg_create</code> 命令可创建具有采用以下格式的配置文件的映像:</p>
+<pre class="prettyprint">
+# global options
+ &lt;global_option&gt;
+ ...
+# entries
+&lt;ftb1_filename&gt; # comment
+ &lt;entry1_option&gt; # comment
+ ...
+&lt;ftb2_filename&gt;
+ &lt;entry2_option&gt;
+ ...
+...
+</pre>
+
+<p>选项 <code>global_option</code> 和 <code>entryX_option</code> 必须以一个或多个空格字符开头(这些选项与 <code>create</code> 选项相同,不带 <code>--</code> 前缀)。空行或者以 <code>#</code> 开头的行将被忽略。</p>
+
+<p>示例:</p>
+<pre class="prettyprint">
+[dtboimg.cfg]
+# global options
+ id=/:board_id
+ rev=/:board_rev
+ custom0=0xabc
+
+board1.dtbo
+
+board2.dtbo
+ id=0x6800 # override the value of id in global options
+
+board2.dtbo
+ id=0x6801 # override the value of id in global options
+ custom0=0x123 # override the value of custom0 in global options
+
+$mkdtimg cfg_create dtbo.img dtboimg.cfg
+</pre>
+
+<p><code>mkdtimg</code> 不会处理 <code>.dtb</code>/<code>.dtbo</code> 文件的对齐方式,而是将它们附加到映像上。当您使用 <code>dtc</code> 将 <code>.dts</code> 编译为 <code>.dtb</code>/<code>.dtbo</code> 时,必须添加选项 <code>-a</code>。例如,添加选项 <code>-a 4</code> 会添加内边距,因此 <code>.dtb</code>/<code>.dtbo</code> 的大小将调整为 4 个字节。</p>
+
+<p>多个 DT 表格条目可以共享一个 <code>.dtb</code>/<code>.dtbo</code>。如果您为不同的条目使用同一个文件名,则系统只会在具有相同 <code>dt_offset</code> 和 <code>dt_size</code> 的映像中存储一份内容。使用具有相同 DT 的不同硬件时,这种方式非常有用。</p>
+
+<h3 id="dump">转储</h3>
+<p>对于 <code>dtb</code>/<code>dtbo</code> 映像,请使用 <code>dump</code> 命令打印映像中的信息。示例:</p>
+<pre class="prettyprint">
+$mkdtimg dump dtbo.img
+dt_table_header:
+ magic = d7b7ab1e
+ total_size = 1300
+ header_size = 32
+ dt_entry_size = 32
+ dt_entry_count = 3
+ dt_entries_offset = 32
+ page_size = 2048
+ reserved[0] = 00000000
+dt_table_entry[0]:
+ dt_size = 380
+ dt_offset = 128
+ id = 00010000
+ rev = 00010001
+ custom[0] = 00000abc
+ custom[1] = 00000000
+ custom[2] = 00000000
+ custom[3] = 00000000
+ (FDT)size = 380
+ (FDT)compatible = board_manufacturer,board_model
+...
+</pre>
+
+</body></html> \ No newline at end of file
diff --git a/zh-cn/devices/architecture/dto/syntax.html b/zh-cn/devices/architecture/dto/syntax.html
new file mode 100644
index 00000000..d1482a0b
--- /dev/null
+++ b/zh-cn/devices/architecture/dto/syntax.html
@@ -0,0 +1,315 @@
+<html devsite><head>
+ <title>DTO 语法</title>
+ <meta name="project_path" value="/_project.yaml"/>
+ <meta name="book_path" value="/_book.yaml"/>
+ </head>
+ <body>
+ <!--
+ Copyright 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<p>设备树源 (DTS) 格式是设备树的文本表示形式。设备树编译器 (DTC) 可将这种格式处理为二进制设备树,这是 Linux 内核要求的形式。</p>
+
+<h2 id="reference">使用引用</h2>
+
+<p><a href="https://github.com/pantoniou/dtc" class="external">DTC</a>(设备树编译器 + 叠加补丁程序)项目在 <a href="https://android.googlesource.com/platform/external/dtc/+/refs/heads/master/Documentation/dts-format.txt" class="external">dtc-format.txt</a>
+和 <a href="https://android.googlesource.com/platform/external/dtc/+/refs/heads/master/Documentation/manual.txt" class="external">manual.txt</a> 中说明了 DTS 格式。DTO 格式和规则在 <a href="https://android.googlesource.com/platform/external/dtc/+/refs/heads/master/Documentation/dt-object-internal.txt" class="external">dt-object-internal.txt</a> 中有相关说明。这些文档描述了如何使用叠加 DT 中的节点 <code>fragment@x</code> 和语法 <code>__overlay__</code> 来更新主 DT。例如:</p>
+<pre class="prettyprint">
+/ {
+ fragment@0 {
+ target = &lt;&amp;some_node&gt;;
+ __overlay__ {
+ some_prop = "okay";
+ ...
+ };
+ };
+};
+</pre>
+
+<p>不过,Google 强烈建议您<strong>不要</strong>使用 <code>fragment@x</code> 和语法 <code>__overlay__</code>,而是使用引用语法。例如:</p>
+<pre class="prettyprint">
+&amp;some_node {
+ some_prop = "okay";
+ ...
+};
+</pre>
+
+<p><code>dtc</code> 会将引用语法编译成与使用语法 <code>__overlay__</code> 所生成的上述对象相同的对象。此语法不强制您对片段进行编号,让您能够轻松地读取和写入叠加 DTS。如果您的 <code>dtc</code> 不支持此语法糖,请使用 <a href="https://android.googlesource.com/platform/external/dtc" class="external">AOSP 中的 dtc
+</a>。</p>
+
+<h2 id="labels">使用标签</h2>
+<p>为了允许在编译时不编译针对节点的未定义引用,叠加 DT <code>.dts</code> 文件必须在其头文件中具有标签 <code>/plugin/</code>。例如:</p>
+
+<pre class="prettyprint">
+/dts-v1/;
+/plugin/;
+</pre>
+
+<p>在这里,您可以使用引用来定位要叠加的节点,该引用是以和符号 (&) 作为前缀的绝对节点路径。例如,对于主 DT 中的 <code>node@0</code>:</p>
+
+<table>
+<tbody><tr>
+<th width="50%">在主 DT 中定义标签...</th>
+<th>...然后使用标签。</th>
+</tr>
+
+<tr>
+<td>
+<pre class="prettyprint">
+
+[my_main_dt.dts]
+
+/dts-v1/;
+
+/ {
+ my_node: node@0 {
+ status = "disabled";
+
+ my_child: child@0 {
+ value = &lt;0xffffffff&gt;;
+ };
+ };
+};
+</pre>
+</td>
+
+<td class="alt">
+<pre class="prettyprint">
+
+[my_overlay_dt.dts]
+
+/dts-v1/;
+/plugin/;
+
+&amp;my_node {
+ status = "okay";
+};
+
+&amp;my_child {
+ value = &lt;0x1&gt;;
+};
+</pre>
+</td>
+</tr>
+</tbody></table>
+
+<h2 id="override">叠加</h2>
+<p>如果引用目标属性存在于主 DT 中,则在 DTO 之后被叠加;否则,系统会对其进行附加。例如:</p>
+
+<table>
+<tbody><tr>
+<th width="33%">main.dts</th>
+<th width="33%">overlay.dts</th>
+<th>合并结果</th>
+</tr>
+
+<tr>
+<td>
+<pre class="prettyprint">
+
+[my_main_dt.dts]
+
+/dts-v1/;
+
+/ {
+ compatible = "corp,foo";
+
+ my_node: node@0 {
+ status = "disabled";
+ };
+};
+</pre>
+</td>
+
+<td class="alt">
+<pre class="prettyprint">
+
+[my_overlay_dt.dts]
+
+/dts-v1/;
+/plugin/;
+
+&amp;my_node {
+ status = "okay";
+};
+</pre>
+</td>
+
+<td>
+<pre class="prettyprint">
+
+/dts-v1/;
+
+/ {
+ compatible = "corp,foo";
+
+ ...
+
+ node@0 {
+ linux,phandle = &lt;0x1&gt;;
+ phandle = &lt;0x1&gt;;
+ status = "okay";
+ };
+};
+</pre>
+</td>
+</tr>
+</tbody></table>
+
+<h2 id="append">附加</h2>
+<p>如果引用目标属性不存在于主 DT 中,则在 DTO 之后被附加。例如:</p>
+
+<table>
+<tbody><tr>
+<th width="33%">main.dts</th>
+<th width="33%">overlay.dts</th>
+<th>合并结果</th>
+</tr>
+
+<tr>
+<td>
+<pre class="prettyprint">
+
+[my_main_dt.dts]
+
+/dts-v1/;
+
+/ {
+ compatible = "corp,foo";
+
+ my_node: node@0 {
+ status = "okay";
+ };
+};
+</pre>
+</td>
+
+<td class="alt">
+<pre class="prettyprint">
+
+[my_overlay_dt.dts]
+
+/dts-v1/;
+/plugin/;
+
+&amp;my_node {
+ new_prop = "bar";
+};
+</pre>
+</td>
+
+<td>
+<pre class="prettyprint">
+
+/dts-v1/;
+
+/ {
+ compatible = "corp,foo";
+
+ ...
+
+ node@0 {
+ linux,phandle = &lt;0x1&gt;;
+ phandle = &lt;0x1&gt;;
+ status = "okay";
+ new_prop = "bar";
+ };
+};
+</pre>
+</td>
+</tr>
+</tbody></table>
+
+<h2 id="child">子节点</h2>
+<p>子节点语法示例:</p>
+
+<table>
+<tbody><tr>
+<th width="33%">main.dts</th>
+<th width="33%">overlay.dts</th>
+<th>合并结果</th>
+</tr>
+
+<tr>
+<td>
+<pre class="prettyprint">
+
+[my_main_dt.dts]
+
+/dts-v1/;
+
+/ {
+ compatible = "corp,foo";
+
+ my_nodes: nodes {
+ compatible = "corp,bar";
+
+ node@0 {
+ status = "disabled";
+ };
+ };
+};
+</pre>
+</td>
+
+<td class="alt">
+<pre class="prettyprint">
+
+[my_overlay_dt.dts]
+
+/dts-v1/;
+/plugin/;
+
+&amp;my_nodes {
+ new_prop1 = "abc";
+
+ node@0 {
+ status = "okay";
+ new_prop2 = "xyz";
+ };
+};
+</pre>
+</td>
+
+<td>
+<pre class="prettyprint">
+
+/dts-v1/;
+
+/ {
+ compatible = "corp,foo";
+
+ ...
+
+ nodes {
+ linux,phandle = &lt;0x1&gt;;
+ phandle = &lt;0x1&gt;;
+ compatible = "corp,bar";
+ new_prop1 = "abc";
+
+ node@0 {
+ linux,phandle = &lt;0x2&gt;;
+ phandle = &lt;0x2&gt;;
+ status = "okay";
+ new_prop2 = "xyz";
+ };
+ };
+};
+</pre>
+</td>
+</tr>
+</tbody></table>
+
+</body></html> \ No newline at end of file