| <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 并选择相应的主设备树,并</li> |
| <li>读取板 ID 并选择相应的叠加设备树。 |
| </li> |
| </ul> |
| |
| <p>只能选择一个主 DT 供在运行时使用。可选择多个叠加 DT,但它们必须与选定的主 DT 兼容。使用多个叠加层有助于避免 DTBO 分区内的每块板上都存储一个叠加层,并能让引导加载程序根据板 ID 或通过探测外设来确定所需叠加层的子集。例如,板 A 可能需要通过叠加层 1、3 和 5 添加的设备,而板 B 可能需要通过叠加层 1、4 和 5 添加的设备。</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> |