| <html devsite> |
| <head> |
| <title>Using Multiple DTs</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>Many SoC vendors and ODMs support the use of multiple DTs on a device, |
| enabling one image to power multiple SKUs/configurations. In such cases, the |
| bootloader identifies the hardware and loads the corresponding DT at runtime: |
| </p> |
| |
| <p><img src="../images/treble_dto_multiple_dt.png"></p> |
| <figcaption><strong>Figure 1.</strong> Multiple device trees overlay in |
| bootloader.</figcaption> |
| |
| <p class="note"><strong>Note:</strong> Using multiple DTs is not mandatory.</p> |
| |
| <h2 id=setting>Setting up</h2> |
| <p>To add support for multiple DTs to the DTO model, set up a list of main DTs |
| and another list of overlay DTs.</p> |
| |
| <p><img src="../images/treble_dto_multiple_dt_runtime.png"></p> |
| <figcaption><strong>Figure 2.</strong> Runtime DTO implementation for multiple |
| DTs.</figcaption> |
| |
| <p>The bootloader should be able to:</p> |
| |
| <ul> |
| <li>read the SoC ID and select the main DT correspondingly, and</li> |
| <li>read the board ID and select the overlay DT accordingly.</li> |
| </ul> |
| |
| <p>Only one main DT and one overlay DT are selected for use at runtime, and the |
| selected pair must be compatible.</p> |
| |
| <h2 id=partition>Partitioning</h2> |
| <p>To partition, determine a bootloader runtime-accessible and trusted location |
| in flash memory to store the DTBs and DTBOs (bootloader must be able to locate |
| these files in the matching process). Keep in mind that DTBs and DTBOs can not |
| exist in the same partition. If your DTBs/DTBOs are in the |
| <code>dtb</code>/<code>dtbo</code> partition, use the table structure and header |
| format detailed in <a href="/devices/architecture/dto/partitions.html">DTB/DTBO |
| Partition Format</a>.</p> |
| |
| <h2 id=runtime>Running in bootloader</h2> |
| <p>To run:</p> |
| <ol> |
| <li><strong>Identify the SoC</strong> and load the corresponding .dtb from |
| storage into memory.</li> |
| <li><strong>Identify the board</strong> and load the corresponding |
| <code>.dtbo</code> from storage into memory.</li> |
| <li>Overlay the <code>.dtb</code> with the <code>.dtbo</code> to be a merged |
| DT.</li> |
| <li>Start kernel given the memory address of the merged DT.</li> |
| </ol> |
| |
| </body> |
| </html> |