aboutsummaryrefslogtreecommitdiff
path: root/en/devices/architecture/dto
diff options
context:
space:
mode:
authorAndroid Partner Docs <noreply@android.com>2018-08-08 13:50:33 -0700
committerClay Murphy <claym@google.com>2018-08-08 14:05:32 -0700
commitea448b829ef3c5eefcadcd50fdf74c873eeadd86 (patch)
tree34c2647a8d8c2dffdbcdac2c5ba11d41d1426da8 /en/devices/architecture/dto
parent19a77ba572d415186ce503e4bf8be87fe45d08eb (diff)
downloadsource.android.com-ea448b829ef3c5eefcadcd50fdf74c873eeadd86.tar.gz
Docs: Changes to source.android.com
- 207940242 One more fix: add header for Television Requirements. by Gina Dimino <gdimino@google.com> - 207936055 Update health README link. by Android Partner Docs <noreply@android.com> - 207929938 Errata run for Android 9 CDD. by Gina Dimino <gdimino@google.com> - 207897850 Fix typos in Develop and Configure index pages by Kenneth Lau <kennethlau@google.com> - 207813977 Devsite localized content from translation request 958913. by Android Partner Docs <noreply@android.com> - 207813949 Devsite localized content from translation request 953118. by Android Partner Docs <noreply@android.com> - 207813941 Devsite localized content from translation request 961934. by Android Partner Docs <noreply@android.com> - 207813934 Devsite localized content from translation request 552632. by Android Partner Docs <noreply@android.com> - 207813463 Update line numbers in links by Kenneth Lau <kennethlau@google.com> - 207796341 Fixing the URL for the CDD link in versions file. by Gina Dimino <gdimino@google.com> - 207779392 Fix incorrect link by Kenneth Lau <kennethlau@google.com> - 207777680 Update build numbers for 2018/08 releases by Android Partner Docs <noreply@android.com> - 207775888 Update links to AOSP by Kenneth Lau <kennethlau@google.com> - 207769948 Update links to AOSP by Kenneth Lau <kennethlau@google.com> - 207763826 Clarify system for HIDL passthrough loading. by Android Partner Docs <noreply@android.com> - 207733156 Fixing malformed links in html for kernel patches, adding... by Heidi von Markham <hvm@google.com> - 207650104 Remove link by Heidi von Markham <hvm@google.com> - 207640627 Tags for Android P. by Android Partner Docs <noreply@android.com> - 207626815 Making link absolute by Clay Murphy <claym@google.com> - 207611166 Add Background Restrictions into Release Notes. by Christina Nguyen <cqn@google.com> - 207606267 Fixing unclosed tag, reformatting for clarity by Heidi von Markham <hvm@google.com> - 207604244 Fix malformed link by Clay Murphy <claym@google.com> - 207598416 adding subscript by Heidi von Markham <hvm@google.com> - 207595049 Fix link in section 3.5.1. by Gina Dimino <gdimino@google.com> - 207590813 Fix broken link due to file path change by Christina Nguyen <cqn@google.com> - 207588930 Update Power nav to include changes to mgmt page (broken ... by Christina Nguyen <cqn@google.com> - 207588102 Separate out the Power Management article into "Applicati... by Christina Nguyen <cqn@google.com> - 207583000 Fix broken links in HAL interface section by Kenneth Lau <kennethlau@google.com> - 207582699 Put index files in place as redirects are not taking hold by Clay Murphy <claym@google.com> - 207575443 P release notes: fix bad links, remove "P release" by Mark Hecomovich <mheco@google.com> - 207574657 Fix link typo from release notes to Carrier ID page by Christina Nguyen <cqn@google.com> - 207559561 Integrate SAC next branch into mainline for Android P/9 p... by Mark Hecomovich <mheco@google.com> - 207559252 Publish links to July localized versions within Japanese ... by Clay Murphy <claym@google.com> - 207122872 Devsite localized content from translation request 958912. by Android Partner Docs <noreply@android.com> - 207122854 Devsite localized content from translation request 961384. by Android Partner Docs <noreply@android.com> - 207007888 Add blurb about the SystemUpdateSampler app on SAC so use... by Christina Nguyen <cqn@google.com> - 206862073 Update Camera HAL testing page by Kenneth Lau <kennethlau@google.com> - 206805870 Devsite localized content from translation request 960240. by Android Partner Docs <noreply@android.com> - 206805861 Devsite localized content from translation request 954945. by Android Partner Docs <noreply@android.com> PiperOrigin-RevId: 207940242 Change-Id: I3dee204c744e2e6062ac56810b88aefabf84636a
Diffstat (limited to 'en/devices/architecture/dto')
-rw-r--r--en/devices/architecture/dto/compile.html457
-rw-r--r--en/devices/architecture/dto/index.html22
-rw-r--r--en/devices/architecture/dto/optimize.html261
-rw-r--r--en/devices/architecture/dto/partitions.html8
4 files changed, 582 insertions, 166 deletions
diff --git a/en/devices/architecture/dto/compile.html b/en/devices/architecture/dto/compile.html
index 65e3cbc2..aea2f3bc 100644
--- a/en/devices/architecture/dto/compile.html
+++ b/en/devices/architecture/dto/compile.html
@@ -1,10 +1,12 @@
-<html devsite>
- <head>
- <title>Compiling &amp; Verifying</title>
- <meta name="project_path" value="/_project.yaml" />
- <meta name="book_path" value="/_book.yaml" />
- </head>
- <body>
+<html devsite="">
+<head>
+ <title>Compiling & Verifying</title>
+ <meta name="project_path" value="/_project.yaml">
+ <meta name="book_path" value="/_book.yaml">
+</head>
+
+<body>
+ {% include "_versions.html" %}
<!--
Copyright 2017 The Android Open Source Project
@@ -21,83 +23,408 @@
limitations under the License.
-->
-<p>You can use Device Tree Compiler (DTC) to compile the Device Tree Source
-files. However, before applying the overlay DT on the target main DT, you should
-also verify the result by simulating the behavior of DTO.</p>
-<h2 id=compile>Compiling with DTC</h2>
-<p>When using <code>dtc</code> to compile <code>.dts</code>, you must add option
-<code>-@</code> to add a <code>__symbols__</code> node in the resulting
-<code>.dtbo</code>. The <code>__symbols__</code> node contains a list of all
-nodes that are marked with a label, which the DTO library can use for
-references.</p>
+ <p>You can use Device Tree Compiler (DTC) to compile the Device Tree Source
+ files. However, before applying the overlay DT on the target main DT, you
+ should also verify the result by simulating the behavior of DTO.</p>
+
+
+ <h2 id="compile">Compiling with DTC</h2>
+
+
+ <p>When using <code>dtc</code> to compile <code>.dts</code>, you must add
+ option <code>-@</code> to add a <code>__symbols__</code> node in the
+ resulting <code>.dtbo</code>. The <code>__symbols__</code> node contains a
+ list of all nodes that are marked with a label, which the DTO library can use
+ for references.</p>
-<p>Sample command to build main DT <code>.dts</code>:</p>
-<pre class="devsite-terminal">
+ <p>Sample command to build main DT <code>.dts</code>:</p>
+
+ <pre class="devsite-terminal">
dtc -@ -O dtb -o my_main_dt.dtb my_main_dt.dts
</pre>
-<p>Sample command to build the overlay DT <code>.dts</code>:</p>
+ <p>Sample command to build the overlay DT <code>.dts</code>:</p>
-<pre class="devsite-terminal">
+ <pre class="devsite-terminal">
dtc -@ -O dtb -o my_overlay_dt.dtbo my_overlay_dt.dts
</pre>
-<p class="note"><strong>Note:</strong> If you encounter the DTC build error:
-<code>invalid option --'@'</code>, you might need to update your DTC version.
-Upstream of AOSP, the official DTC supports DTO as of
-<a href="https://github.com/dgibson/dtc/tree/v1.4.4" class="external">version
-1.4.4</a> and most patches are merged after December 2016. For DTO support, we
-recommend using the
-<code><a href="https://android.googlesource.com/platform/external/dtc/" class="external">external/dtc</code></a>
-in AOSP, which is synced with the latest DTC (with DTO patches merged as
-needed).</p>
-
-<h2 id=verify>Verify DTO results on the host</h2>
-<p>Verification can help you identify errors that might occur when placing the
-overlay DT on the main DT. Before updating the target, you can verify the
-result of overlaying DT on the host by simulating the behavior of DTO using
-<code>/include/</code> in <code>.dts</code>.</p>
-
-<p class="note"><strong>Note:</strong> <code>/include/</code> does NOT support
-the use of <code>__overlay__</code> in overlay DT sources.</p>
-
-<p><img src="../images/treble_dto_simulate.png"></p>
-<p><strong>Figure 1.</strong> Use syntax <code>/include/</code> to simulate DTO
-on the host.</p>
-
-<ol>
-<li>Create a copy of the overlay <code>.dts</code>. In the copy, remove the
-first line header. Example:
-<pre>
+ <aside class="note"><strong>Note:</strong> If you encounter the DTC build error:
+ <code>invalid option --'@'</code>, you might need to update your DTC version.
+ Upstream of AOSP, the official DTC supports DTO as of <a href=
+ "https://github.com/dgibson/dtc/tree/v1.4.4" class="external">version
+ 1.4.4</a> and most patches are merged after December 2016. For DTO support,
+ we recommend using the <code><a href=
+ "https://android.googlesource.com/platform/external/dtc/" class=
+ "external">external/dtc</a></code> in AOSP, which is synced with the latest DTC
+ (with DTO patches merged as needed).</aside>
+
+
+ <h2 id="verify">Verify DTO results on the host</h2>
+
+
+ <p>Verification can help you identify errors that might occur when placing
+ the overlay DT on the main DT. Before updating the target, you can verify the
+ result of overlaying DT on the host by simulating the behavior of DTO using
+ <code>/include/</code> in <code>.dts</code>.</p>
+
+
+ <aside class="note"><strong>Note:</strong> <code>/include/</code> does NOT
+ support the use of <code>__overlay__</code> in overlay DT sources.</aside>
+
+
+ <p><img src="../images/treble_dto_simulate.png">
+ </p>
+
+
+ <figcaption><strong>Figure 1.</strong> Use syntax <code>/include/</code> to simulate
+ DTO on the host</figcaption>
+
+
+ <ol>
+ <li>Create a copy of the overlay <code>.dts</code>. In the copy, remove the
+ first line header. Example:
+
+ <pre>
/dts-v1/;
/plugin/;
-</pre>
-Save the file as <code>my_overlay_dt_wo_header.dts</code> (or any filename you
-want).</li>
+</pre>Save the file as <code>my_overlay_dt_wo_header.dts</code> (or any
+filename you want).
+ </li>
-<li>Create a copy of the main <code>.dts</code>. In the copy, after the last
-line, append the include syntax for the file you created in step 1. For example:
-<pre>
+
+ <li>Create a copy of the main <code>.dts</code>. In the copy, after the
+ last line, append the include syntax for the file you created in step 1.
+ For example:
+
+ <pre>
/include/ "my_overlay_dt_wo_header.dts"
-</pre>
-Save the file as <code>my_main_dt_with_include.dts</code> (or any filename you
-want).</li>
+</pre>Save the file as <code>my_main_dt_with_include.dts</code> (or any
+filename you want).
+ </li>
+
+
+ <li>Use <code>dtc</code> to compile
+ <code>my_main_dt_with_include.dts</code> to get the merged DT, which should
+ be the same result as DTO. For example:
-<li>Use <code>dtc</code> to compile <code>my_main_dt_with_include.dts</code> to
-get the merged DT, which should be the same result as DTO. For example:
-<pre class="devsite-terminal">
+ <pre class="devsite-terminal">
dtc -@ -O dtb -o my_merged_dt.dtb my_main_dt_with_include.dts
</pre>
-</li>
+ </li>
-<li>Use <code>dtc</code> to dump <code>my_merged_dt.dto</code>.
-<pre class="devsite-terminal">
+
+ <li>Use <code>dtc</code> to dump <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>
+ </li>
+ </ol>
+
+
+ <h2 id="verifying-DTO-in-p">Verifying DTO in Android {{ androidPVersionNumber }}</h2>
+
+
+ <p>Android {{ androidPVersionNumber}} requires a Device Tree Blob Overlay
+ (DTBO) partition. To add nodes or make changes to the properties in the SoC
+ DT, the bootloader must dynamically overlay a device specific DT over
+ the SoC DT.</p>
+
+
+ <h3 id="indicating-applied-overlays">Indicating applied overlays</h3>
+
+
+ <p>To enable the <a href="/compatibility/vts/">
+ Vendor Test Suite (VTS)</a> to assess the correctness of overlay
+ application, vendors must add a new kernel command line parameter
+ <code>androidboot.dtbo_idx</code> that indicates the overlays selected from
+ the DTBO partition. For example, the parameter <code>androidboot.
+ dtbo_idx=x,y,z</code> reports <code>x</code>, <code>y</code> and
+ <code>z</code> as the zero-based indices of the Device Tree Overlays (DTOs)
+ from the DTBO partition applied (in that order) by the bootloader to the base
+ Device Tree (DT).</p>
+
+
+ <p>Overlays can apply to nodes from the main device tree or add new nodes,
+ but <strong>cannot</strong> refer to a node added in a previous overlay. This
+ restriction is necessary because the overlay application does not merge the
+ overlay symbol table with the main DT symbol table (not merging avoids
+ conflicts in symbol names and complication of dependencies between
+ overlays).</p>
+
+
+ <h4 id="example-invalid-overlays">Example: Invalid overlays</h4>
+
+
+ <p>In this example, <code>overlay_2.dts</code> refers to node
+ <strong><code>e</code></strong> , which was added by
+ <code>overlay_1.dts</code>. After <code>overlay_1</code> is applied to the
+ main DT, if an attempt is made to apply <code>overlay_2</code> to the
+ resultant DT, the overlay application will fail with an error that the symbol
+ <strong><code>e</code></strong> is not present in the symbol table for the
+ base DT.</p>
+
+
+ <table>
+ <tr>
+ <th width="33%">main.dts</th>
+
+ <th>overlay_1.dts</th>
+
+ <th>overlay_2.dts</th>
+
+ </tr>
+ <tr>
+ <td>
+ <pre>
+<strong>[main.dts]</strong>
+
+/dts-v1/;
+
+/ {
+ a: a {};
+ b: b {};
+ c: c {};
+};
+</pre>
+ </td>
+
+ <td>
+ <pre>
+<strong>[overlay_1.dts]</strong>
+
+/dts-v1/;
+/plugin/;
+
+&amp;b { ref1 = <&a>;
+ e: e {
+ prop = <0x0a>;
+ phandle = <0x04>;
+ };
+};
+</pre>
+</td>
+
+ <td>
+<pre>
+<strong>[overlay_2.dts]</strong>
+
+/dts-v1/;
+/plugin/;
+
+/* invalid! */
+<font color="red">&amp;e</font> {
+ prop = <0x0b>;
+};
+</pre>
+ </td>
+ </tr>
+ </table>
+
+
+ <h4 id="example-valid-overlays">Example: Valid overlays</h4>
+
+
+ <p>In this example, <code>overlay_2.dts</code> refers only to node
+ <strong><code>b</code></strong> from the main DTS. When
+ <code>overlay_1</code> is applied to the base DT, then followed by the
+ application of <code>overlay_2</code>, the value of property
+ <strong><code>prop</code></strong> in node <strong><code>e</code></strong>
+ (set by <code>overlay_1.dts</code>) is overwritten by the value set by
+ <code>overlay_2.dts</code>.</p>
+
+
+ <table>
+ <tr>
+ <th width="33%">main.dts</th>
+
+ <th>overlay_1.dts</th>
+
+ <th>overlay_2.dts</th>
+
+ </tr>
+
+
+ <tr>
+ <td>
+ <pre>
+<strong>[final.dts]</strong>
+
+/dts-v1/;
+
+/ {
+ a: a {};
+ b: b {};
+ c: c {};
+};
+</pre>
+ </td>
+
+ <td>
+ <pre>
+<strong>[overlay_1.dts]</strong>
+
+/dts-v1/;
+/plugin/;
+
+
+&amp;b { ref1 = <&a>;
+ e {
+ prop = <0x0c>;
+ };
+};
+</pre>
+ </td>
+
+ <td>
+ <pre>
+<strong>[overlay_2.dts]</strong>
+
+/dts-v1/;
+/plugin/;
+
+/* valid */
+<font color="blue">&amp;b</font> { ref1 = <&c>;
+ e {
+ prop = <0x0d>;
+ };
+};
+</pre>
+ </td>
+ </tr>
+ </table>
+
+
+ <h3 id="implementing-the-dtbo-partition">Implementing the DTBO partition</h3>
+
+
+ <p>To implement the required DTBO partition, ensure the bootloader can do the
+ following:</p>
+
+
+ <ol>
+ <li>Identify the board it is running on and select the corresponding
+ overlay(s) to be applied.</li>
+
+
+ <li>Append the <code>androidboot.dtbo_idx</code> parameter to the kernel
+ command line.
+
+ <ul>
+ <li>The parameter must indicate, the zero-based indices of the DTOs
+ from the DTBO partition image it applied to the base DT (in the same
+ order).</li>
+
+
+ <li>The indices must refer to the position of the overlay in the DTBO
+ partition.</li>
+ </ul>
+ </li>
+ </ol>
+
+
+ <p>For details on the structure of the DTBO partition, refer to <a href=
+ "https://source.android.com/devices/architecture/dto/">Device Tree
+ Overlays</a> on source.android.com.</p>
+
+
+ <h3 id="validating-the-dtbo-partition">Validating the DTBO partition</h3>
+
+
+ <p>You can use VTS to verify the following:</p>
+
+
+ <ul>
+ <li>Existence of the kernel command line parameter
+ <code>androidboot.dtbo_idx</code> (by checking that <code>Init</code> has
+ automatically set up the corresponding <code>ro.boot.dtbo_idx</code> system
+ property).</li>
+
+
+ <li>Validity of the <code>ro.boot.dtbo_idx</code> system property (by
+ checking that the property specifies at least one valid DTBO image
+ index).</li>
+
+
+ <li>Validity of the DTBO partition (also verifies the overlays in the DTBO
+ partition that are applied to the base DT).</li>
+
+
+ <li>Additional nodes or property changes in the resulting DT are presented
+ to the Linux kernel.</li>
+ </ul>
+
+
+ <p>For example, in the following overlays and final DT, adding
+ <code>androidboot.dtbo_idx=5,3</code> to the kernel command line passes
+ validation but adding <code>androidboot.dtbo_idx=3,5</code> to the kernel
+ command line does not pass validation.</p>
+
+
+ <table>
+ <tr>
+ <th width="50%">Overlay DT at index 3</th>
+
+
+ <th>Overlay DT at index 5</th>
+
+<tr>
+<td>
+<pre>
+<strong>[overlay_1.dts]</strong>
+
+/dts-v1/;
+/plugin/;
+
+&amp;c <strong>{ prop = <0xfe>; }</strong>;
+</pre>
+ </td>
+
+ <td>
+ <pre>
+<strong>[overlay_2.dts]</strong>
+
+/dts-v1/;
+/plugin/;
+
+&amp;c { prop = <0xff>; };
+</pre>
+ </td>
+ </tr>
+
+<table>
+ <tr>
+ <th>Final DT</th>
+
+ <tr>
+ <td>
+ <pre>
+/dts-v1/;
+/ {
+
+ a {
+ phandle = <0x1>;
+ };
+
+ b {
+ phandle = <0x2>;
+ };
+
+ c {
+ phandle = <0x3>;
+ <strong>prop = <0xfe></strong>;
+ };
+
+ __symbols__ {
+ a = "/a";
+ b = "/b";
+ c = "/c";
+ };
+};
- </body>
+ </table>
+</body>
</html>
diff --git a/en/devices/architecture/dto/index.html b/en/devices/architecture/dto/index.html
index 3fdf3c28..8470b2ad 100644
--- a/en/devices/architecture/dto/index.html
+++ b/en/devices/architecture/dto/index.html
@@ -5,8 +5,9 @@
<meta name="book_path" value="/_book.yaml" />
</head>
<body>
+ {% include "_versions.html" %}
<!--
- Copyright 2017 The Android Open Source Project
+ Copyright 2018 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.
@@ -29,11 +30,11 @@ by Android-powered devices. Hardware vendors supply their own DT source files,
which Linux then compiles into the Device Tree Blob (DTB) file used by the
bootloader.</p>
-A <a href="https://lkml.org/lkml/2012/11/5/615" class="external">device tree
-overlay</a> (DTO) enables a central DTB to be overlaid on the device tree. A
-bootloader using DTO can maintain the system-on-chip (SoC) DT and dynamically
-overlay a device-specific DT, adding nodes to the tree and making changes to
-properties in the existing tree.</p>
+<p>A <a href="https://lkml.org/lkml/2012/11/5/615" class="external">device tree
+overlay</a> (DTO) enables a central device tree blob (DTB) to be overlaid on
+the device tree. A bootloader using DTO can maintain the system-on-chip (SoC)
+DT and dynamically overlay a device-specific DT, adding nodes to the tree and
+making changes to properties in the existing tree.</p>
<p>This page details a typical bootloader workflow for loading a DT and provides
a list of common DT terms. Other pages in this section describe how to
@@ -44,10 +45,15 @@ for DTO</a>, how to
implementation</a>, and how to
<a href="/devices/architecture/dto/multiple.html">use multiple DTs</a>. You can
also get details on <a href="/devices/architecture/dto/syntax.html">DTO
-syntax</a> and recommended
-<a href="/devices/architecture/dto/partition.html">DTO/DTBO partition
+syntax</a> and required
+<a href="/devices/architecture/dto/partitions.html">DTO/DTBO partition
formatting</a>.</p>
+<h2 id="p-update">Updates in Android {{ androidPVersionNumber }} Release</h2>
+<p>In Android {{ androidPVersionNumber }}, the bootloader must not modify the
+properties defined in the device tree overlays before passing the unified
+device tree blob to the kernel.</p>
+
<h2 id=load-dt>Loading a device tree</h2>
<p>Loading a device tree in bootloader involves building, partitioning, and
running.</p>
diff --git a/en/devices/architecture/dto/optimize.html b/en/devices/architecture/dto/optimize.html
index 7502d7ad..7624cc14 100644
--- a/en/devices/architecture/dto/optimize.html
+++ b/en/devices/architecture/dto/optimize.html
@@ -5,6 +5,7 @@
<meta name="book_path" value="/_book.yaml" />
</head>
<body>
+ {% include "_versions.html" %}
<!--
Copyright 2017 The Android Open Source Project
@@ -21,14 +22,21 @@
limitations under the License.
-->
-<p>This page details optimizations you can make to your DTO implementation,
-describes restrictions against overlaying the root node, and provides sample
-implementation instructions and code.</p>
+<p>
+ This page discusses optimizations you can make to your DTO implementation,
+ describes restrictions against overlaying the root node, and details how to
+ configure compressed overlays in the DTBO image. It also provides sample
+ implementation instructions and code.
+</p>
<h2 id=kernel>Kernel command line</h2>
-<p>The original kernel command line in device tree is located in the
-<code>chosen/bootargs</code> node. The bootloader must concatenate this location
-with other sources of kernel command line:</p>
+
+<p>
+ The original kernel command line in device tree is located in the
+ <code>chosen/bootargs</code> node. The bootloader must concatenate this
+ location with other sources of kernel command line:
+</p>
+
<pre class="prettyprint">
/dts-v1/;
@@ -39,11 +47,13 @@ with other sources of kernel command line:</p>
};
</pre>
-<p>DTO <strong>cannot</strong> concatenate values from main DT and overlay DT.
-We recommend putting the kernel command line of the main DT in
-<code>chosen/bootargs</code> and the kernel command line of the overlay DT in
-<code>chosen/bootargs_ext</code>. Bootloader can then concatenate these
-locations and pass the result to the kernel.</p>
+<p>
+ DTO <strong>cannot</strong> concatenate values from main DT and overlay DT, so
+ you must put the kernel command line of the main DT in
+ <code>chosen/bootargs</code> and the kernel command line of the overlay DT in
+ <code>chosen/bootargs_ext</code>. Bootloader can then concatenate these
+ locations and pass the result to the kernel.
+</p>
<table>
<tr>
@@ -77,47 +87,70 @@ locations and pass the result to the kernel.</p>
</table>
<h2 id=libufdt>libufdt</h2>
-<p>While the latest
-<code><a href="https://github.com/dgibson/dtc/tree/master/libfdt" class="external">libfdt</code></a>
-supports DTO, we recommend using <code>libufdt</code> to implement DTO (source
-at
-<code><a href="https://android.googlesource.com/platform/system/libufdt/+/refs/heads/master" class="external">platform/system/libufdt</code></a>
-in AOSP). <code>libufdt</code> builds a real tree structure (un-flattened device
-tree, or <em>ufdt</em>) from the flattened device tree (FDT), so it can improve
-the merging of two <code>.dtb</code> files from O(N2) to O(N), where N is the
-number of nodes in the tree.</p>
+
+<p>
+ While the latest
+ <code><a href="https://github.com/dgibson/dtc/tree/master/libfdt" class="external">libfdt</code></a>
+ supports DTO, is it recommended to use <code>libufdt</code> to implement DTO
+ (AOSP source at
+ <code><a href="https://android.googlesource.com/platform/system/libufdt/+/refs/heads/master" class="external">platform/system/libufdt</code></a>).
+ <code>libufdt</code> builds a real tree structure (un-flattened device tree,
+ or <em>ufdt</em>) from the flattened device tree (FDT), so it can improve the
+ merging of two <code>.dtb</code> files from O(N2) to O(N), where N is the
+ number of nodes in the tree.
+</p>
<h3 id=performance>Performance testing</h3>
-<p>In Google's internal testing, using <code>libufdt</code> on 2405
-<code>.dtb</code> and 283 <code>.dtbo</code> DT nodes results in file sizes of
-70,618 and 8,566 bytes after compilation. Compared with a
-<a href="http://fxr.watson.org/fxr/source/boot/fdt/" class="external">DTO
-implementation</a> ported from FreeBSD (124ms runtime), <code>libufdt</code>
-DTO runtime is 10ms.</p>
-
-<p>In performance testing for Pixel devices, we compared <code>libufdt</code>
-and <code>libfdt</code>. The number of base nodes effect is similar, but
-includes the following differences:</p>
+
+<p>
+ In Google's internal testing, using <code>libufdt</code> on 2405
+ <code>.dtb</code> and 283 <code>.dtbo</code> DT nodes results in file sizes of
+ 70,618 and 8,566 bytes after compilation. Compared with a
+ <a href="http://fxr.watson.org/fxr/source/boot/fdt/" class="external">DTO
+ implementation</a> ported from FreeBSD (124 ms runtime), <code>libufdt</code>
+ DTO runtime is 10 ms.
+</p>
+
+<p>
+ Performance testing for Pixel devices compared <code>libufdt</code> and
+ <code>libfdt</code>. The number of base nodes effect is similar, but includes
+ the following differences:
+</p>
+
<ul>
-<li>500 overlay (append or override) operations have 6~8x time difference</li>
-<li>1000 overlay (append or override) operations have 8~10x time difference</li>
+ <li>500 overlay (append or override) operations have 6x to 8x time
+ difference</li>
+ <li>1000 overlay (append or override) operations have 8x to 10x time
+ difference</li>
</ul>
-<p>Example with appending count set to X:</p>
+<p>
+ Example with appending count set to X:
+</p>
+
<p><img src="../images/treble_dto_appending.png"></p>
-<figcaption><strong>Figure 1.</strong> Appending count is X.</figcaption>
+<figcaption><strong>Figure 1.</strong> Appending count is X</figcaption>
+
+<p>
+ Example with overriding count set to X:
+</p>
-<p>Example with overriding count set to X:</p>
<p><img src="../images/treble_dto_overriding.png"></p>
-<figcaption><strong>Figure 2.</strong> Overriding count is X.</figcaption>
+<figcaption><strong>Figure 2.</strong> Overriding count is X</figcaption>
-<p><code>libufdt</code> is developed with some <code>libfdt</code> APIs and data
-structures. When using <code>libufdt</code>, you must include and link
-<code>libfdt</code> (however in your code you can use <code>libfdt</code> API to
-operate DTB or DTBO).</p>
+<p>
+ <code>libufdt</code> is developed with some <code>libfdt</code> APIs and data
+ structures. When using <code>libufdt</code>, you must include and link
+ <code>libfdt</code> (however, in your code you can use the <code>libfdt</code>
+ API to operate DTB or DTBO).
+</p>
<h3 id=api>libufdt DTO API</h3>
-<p>The main API to DTO in <code>libufdt</code> is as follows:</p>
+
+<p>
+ The main API to DTO in <code>libufdt</code> is as follows:
+</p>
+
<pre class="prettyprint">
struct fdt_header *ufdt_apply_overlay(
struct fdt_header *main_fdt_header,
@@ -126,30 +159,39 @@ struct fdt_header *ufdt_apply_overlay(
size_t overlay_size);
</pre>
-<p>The parameter <code>main_fdt_header</code> is the main DT and
-<code>overlay_fdt</code> is the buffer containing the contents of a
-<code>.dtbo</code> file. The return value is a new buffer containing the merged
-DT (or <code>null</code> in case of error). The merged DT is formated in FDT,
-which you can pass to the kernel when starting the kernel.</p>
-
-<p>The new buffer from the return value is created by <code>dto_malloc()</code>,
-which you should implement when porting <code>libufdt</code> into bootloader.
-For reference implementations, refer to
-<code>sysdeps/libufdt_sysdeps_*.c</code>.</p>
+<p>
+ The parameter <code>main_fdt_header</code> is the main DT and
+ <code>overlay_fdt</code> is the buffer containing the contents of a
+ <code>.dtbo</code> file. The return value is a new buffer containing the
+ merged DT (or <code>null</code> in case of error). The merged DT is formated
+ in FDT, which you can pass to the kernel when starting the kernel.
+</p>
+
+<p>
+ The new buffer from the return value is created by <code>dto_malloc()</code>,
+ which you should implement when porting <code>libufdt</code> into bootloader.
+ For reference implementations, refer to
+ <code>sysdeps/libufdt_sysdeps_*.c</code>.
+</p>
<h2 id=root>Root node restrictions</h2>
-<p>You cannot overlay a new node or property into the root node of main DT
-because overlay operations rely on labels. Because the main DT must define a
-label and the overlay DT assigns the nodes to be overlaid with labels, we
-cannot give a label for the root node (and therefore cannot overlay the root
-node).</p>
-
-<p>SoC vendors must define the overlaying ability of main DT; ODM/OEMs can only
-append or override nodes with labels defined by the SoC vendor. As a workaround,
-you can define a <strong><code>odm</code></strong> node under the root node in
-base DT, enabling all ODM nodes in overlay DT to add new nodes. Alternatively,
-you could put all SoC-related nodes in the base DT into a
-<strong><code>soc</code></strong> node under root node as described below:</p>
+
+<p>
+ You cannot overlay a new node or property into the root node of main DT
+ because overlay operations rely on labels. Because the main DT must define a
+ label and the overlay DT assigns the nodes to be overlaid with labels, you
+ cannot give a label for the root node (and therefore cannot overlay the root
+ node).
+</p>
+
+<p>
+ SoC vendors must define the overlaying ability of main DT; ODM/OEMs can only
+ append or override nodes with labels defined by the SoC vendor. As a
+ workaround, you can define an <strong><code>odm</code></strong> node under the
+ root node in base DT, enabling all ODM nodes in overlay DT to add new nodes.
+ Alternatively, you could put all SoC-related nodes in the base DT into an
+ <strong><code>soc</code></strong> node under root node as described below:
+</p>
<table>
<tr>
@@ -209,64 +251,103 @@ you could put all SoC-related nodes in the base DT into a
</tr>
</table>
+<h2 id="compressed-overlays">Using compressed overlays</h2>
+
+<p>
+ Android {{ androidPVersionNumber }} adds support for using compressed overlays
+ in the DTBO image when using version 1 of the device tree table header.
+ When using DTBO header v1, the four least significant bits of the flags field
+ in <em>dt_table_entry</em> indicate the compression format of the DT entry.
+</p>
+
+<pre class="prettyprint">struct dt_table_entry_v1 {
+ 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 flags; /* For version 1 of dt_table_header, the 4 least significant bits
+ of 'flags' will be used to indicate the compression
+ format of the DT entry as per the enum 'dt_compression_info' */
+ uint32_t custom[3]; /* optional, must be zero if unused */
+};
+</pre>
+
+<p>
+ Currently, <code>zlib</code> and <code>gzip</code> compressions are supported.
+</p>
+
+<pre class="prettyprint">enum dt_compression_info {
+ NO_COMPRESSION,
+ ZLIB_COMPRESSION,
+ GZIP_COMPRESSION
+};
+</pre>
+
+<p>
+ Android {{ androidPVersionNumber }} adds support for testing compressed
+ overlays to the <code>VtsFirmwareDtboVerification</code> test to help you
+ verify the correctness of overlay application.
+</p>
+
<h2 id=sample>Sample DTO implementation</h2>
-<p>The following instructions walk you through a sample implementation of DTO
-with <code>libufdt</code> (sample code below).</p>
+
+<p>
+ The following instructions walk you through a sample implementation of DTO
+ with <code>libufdt</code> (sample code below).
+</p>
<h3 id=sample-instructions>Sample DTO instructions</h3>
<ol>
-<li>Include libraries. To use <code>libufdt</code>, include <code>libfdt</code>
-for data structures and APIs:
+ <li>Include libraries. To use <code>libufdt</code>, include
+ <code>libfdt</code> for data structures and APIs:
<pre class="prettyprint">
#include &lt;libfdt.h&gt;
#include &lt;ufdt_overlay.h&gt;
</pre>
-</li>
-
-<li>Load main DT and overlay DT. Load <code>.dtb</code> and <code>.dtbo</code>
-from storage into memory (exact steps depend on your design). At this point, you
-should have the buffer and size of <code>.dtb</code>/<code>.dtbo</code>:
+ </li>
+ <li>Load main DT and overlay DT. Load <code>.dtb</code> and <code>.dtbo</code>
+ from storage into memory (exact steps depend on your design). At this point,
+ you should have the buffer and size of <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>Overlay the DTs:
-<ol>
-
-<li>Use <code>ufdt_install_blob()</code> to get the FDT header for main DT:
+ </li>
+ <li>Overlay the DTs:
+ <ol>
+ <li>Use <code>ufdt_install_blob()</code> to get the FDT header for main DT:
<pre class="prettyprint">
main_fdt_header = ufdt_install_blob(main_buf, main_size);
main_fdt_size = main_size;
</pre>
-</li>
-<li>Call <code>ufdt_apply_overlay()</code> to DTO to get a merged DT in FDT
-format:
+ </li>
+ <li>Call <code>ufdt_apply_overlay()</code> to DTO to get a merged DT in FDT
+ format:
<pre class="prettyprint">
merged_fdt = ufdt_apply_overlay(main_fdt_header, main_fdt_size,
overlay_buf, overlay_size);
</pre>
-</li>
-
-<li>To get the size of <code>merged_fdt</code>, use <code>dtc_totalsize()</code>:
+ </li>
+ <li>Use <code>merged_fdt</code> to get the size of
+ <code>dtc_totalsize()</code>:
<pre class="prettyprint">
merged_fdt_size = dtc_totalsize(merged_fdt);
</pre>
-</li>
-
-<li>Pass merged DT to start kernel. When you start the kernel, pass merged DT to
-kernel:
+ </li>
+ <li>Pass the merged DT to start the kernel:
<pre class="prettyprint">
my_kernel_entry(0, machine_type, merged_fdt);
</pre>
-</li>
-</ol></li></ol>
+ </li>
+ </ol>
+ </li>
+</ol>
<h3 id=sample-code>Sample DTO code</h3>
+
<pre class="prettyprint">
#include &lt;libfdt.h&gt;
#include &lt;ufdt_overlay.h&gt;
diff --git a/en/devices/architecture/dto/partitions.html b/en/devices/architecture/dto/partitions.html
index d18cda84..195f1192 100644
--- a/en/devices/architecture/dto/partitions.html
+++ b/en/devices/architecture/dto/partitions.html
@@ -6,7 +6,7 @@
</head>
<body>
<!--
- Copyright 2017 The Android Open Source Project
+ Copyright 2018 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.
@@ -54,7 +54,9 @@ struct dt_table_header {
// from head of dt_table_header
uint32_t page_size; // flash page size we assume
- uint32_t reserved[1]; // must be zero
+ uint32_t version; // DTBO image version, the current version is 0.
+ // The version will be incremented when the
+ // dt_table_header struct is updated.
};
struct dt_table_entry {
@@ -288,7 +290,7 @@ dt_table_header:
dt_entry_count = 3
dt_entries_offset = 32
page_size = 2048
- reserved[0] = 00000000
+ version = 0
dt_table_entry[0]:
dt_size = 380
dt_offset = 128