aboutsummaryrefslogtreecommitdiff
path: root/en/devices/architecture/dto/multiple.html
blob: f431a9d701006fc4f2b6df0ba549321343e08ddd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<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 corresponding main device tree, and</li>
<li>Read the board ID and select the set of overlay device trees accordingly.
</li>
</ul>

<p>Only one main DT should be selected for use at runtime. Multiple overlay DTs
may be selected but they must be compatible with the chosen main DT. Using
multiple overlays can help avoid storing one overlay per board within the DTBO
partition and enable the bootloader to determine the subset of required overlays
based on the board ID (or possibly by probing the peripherals). For
example, Board A may need the devices added by the overlays 1, 3, and 5 while
Board B may need the devices added by the overlays 1, 4, and 5.</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>