2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
DTO の実装
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
デバイスツリー オーバーレイ(DTO)を実装する作業には、デバイスツリー(DT)の分割、ビルド、パーティショニング、実行が含まれます。また、実装を実行した後、2 つの DT 間の互換性を維持するとともに、各 DT パーティションのセキュリティを確保するための戦略を決定する必要があります。
DT を分割する
まず、DT を次の 2 つに分割します。
- メイン DT: SoC のみの部分と、SoC ベンダーが提供するデフォルトの設定。
- オーバーレイ DT: ODM / OEM が提供するデバイス固有の構成。
DT を分割した後、メイン DT とオーバーレイ DT をマージしたときにデバイスの完全な DT になるように、メイン DT とオーバーレイ DT 間の互換性を確保する必要があります。DTO の形式とルールの詳細については、DTO の構文をご覧ください。複数の DT の詳細については、複数の DT の使用 をご覧ください。
メイン DT とオーバーレイ DT をビルドする
メイン DT をビルドする手順は次のとおりです。
- メイン DT
.dts
を .dtb
ファイルにコンパイルします。
- ブートローダーが実行時にアクセスできるパーティションに
.dtb
ファイルを書き込みます(詳細は [パーティション DT](#partition) に記載しています)。
オーバーレイ DT をビルドする手順は次のとおりです。
- オーバーレイ DT
.dts
を .dtbo
ファイルにコンパイルします。このファイル形式は、フラット化された DT としてフォーマットされた .dtb
ファイルと同じですが、ファイル拡張子が異なるためメイン DT と区別できます。
- ブートローダーが実行時にアクセスできるパーティションに
.dtbo
ファイルを書き込みます(詳細は [パーティション DT](#partition) に記載しています)。
DTC を使用したコンパイルと、ホストでの DTO の結果の検証については、コンパイルと検証をご覧ください。
パーティション DT
.dtb
と .dtbo
を挿入するための、ブートローダーが実行時にアクセスできるフラッシュ メモリ内の信頼できる場所を決定します。
メイン DT の場所の例:
- カーネル(
image.gz
)に追加された、ブート パーティションの一部
- 専用パーティション(
dtb
)内の個別の DT blob(.dtb
)
オーバーレイ DT の場所の例:

図 1. odm パーティションに .dtbo を挿入します(これは、ブートローダーが odm パーティションのファイル システムからデータを読み込むことができる場合にのみ行います)。

図 2. dtbo パーティションなどの固有のパーティションに .dtbo を挿入します。
注: オーバーレイ DT パーティションのサイズは、デバイスと、メイン DT blob 上で必要な変更の量によって決まります。通常は 8 MB あれば十分です。将来的に、必要に応じてサイズを大きくすることもできます。
シームレス(A/B)アップデートをサポートするデバイスの場合、メイン DT とオーバーレイ DT のパーティション A/B を次のように作成します。

図 3. DTBO パーティション A/B、例 1

図 4. DTBO パーティション A/B、例 2
ブートローダーで実行する
以下の手順で実行します。

図 5. ブートローダーでの DTO の一般的なランタイム実装。
.dtb
をストレージからメモリに読み込みます。
.dtbo
をストレージからメモリに読み込みます。
.dtb
を .dtbo
でオーバーレイして、DT を統合します。
- 統合した DT のメモリアドレスを指定して、カーネルを起動します。
互換性を維持する
メイン DTB(SoC ベンダーが提供)は、DTBO の API サーフェスとして扱われます。DT を SoC 共通部分とデバイス固有部分に分割した後、将来的にこの 2 つの部分の互換性(たとえば、以下に関する互換性)を維持する必要があります。
- メイン DT での DT 定義。たとえば、ノード、プロパティ、ラベルなど。メイン DT の定義を変更すると、オーバーレイ DT でも変更が必要になる場合があります。たとえば、メイン DT のノード名を修正する場合、元のノード名にマッピングする「エイリアス」ラベルを定義することにより、オーバーレイ DT の変更を回避できます。
- オーバーレイ DT の保存場所。たとえば、パーティション名、保存形式など。
セキュリティを確保する
ブートローダーは、DTB または DTBO が安全で、変更されておらず、破損していないことを確認する必要があります。DTB または DTBO を保護するには、VBoot 1.0 のブートイメージ署名や AVB HASH フッター(VBoot 2.0)などの任意のソリューションを使用できます。
- DTB または DTBO が固有のパーティションにある場合、そのパーティションを AVB のトラスト チェーンに追加できます。トラスト チェーンはハードウェアで保護されたルート オブ トラストからスタートしてブートローダーまで進み、DTB または DTBO パーティションの整合性と真正性を検証します。
- DTB または DTBO が既存のパーティション(
odm
パーティションなど)にある場合、そのパーティションは AVB のトラスト チェーン内に存在する必要があります(DTBO パーティションは odm
パーティションと公開鍵を共有できます)。
詳細については、確認付きブートを参照してください。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-03 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-03 UTC。"],[],[],null,["# Implement DTOs\n\nImplementing device tree overlays (DTOs) involves dividing the device tree (DT), building,\npartitioning, and running. After you have a working implementation, you must also maintain\ncompatibility between the two DTs and determine a strategy for ensuring the\nsecurity of each DT partition.\n\nDivide the DT\n-------------\n\nStart by dividing the DT into two parts:\n\n- **Main DT**. The SoC-only part and the default configurations, provided by SoC vendor.\n- **Overlay DT**. The device-specific configurations, provided by ODM/OEM.\n\nAfter dividing the DTs, you must ensure compatibility between main\nDT and overlay DT so that merging main DT and overlay DT results in a complete\nDT for the device. For details on DTO format and rules, see\n[DTO syntax](/docs/core/architecture/dto/syntax). For details on\nmultiple DTs, see\n[Use multiple DTs](/docs/core/architecture/dto/multiple).\n\nBuild main and overlay DTs\n--------------------------\n\nTo build the main DT:\n\n1. Compile the main DT `.dts` into a `.dtb` file.\n2. Flash the `.dtb` file into a bootloader runtime-accessible partition (detailed in \\[Partition DTs\\](#partition)).\n\nTo build the overlay DT:\n\n1. Compile the overlay DT `.dts` into a `.dtbo` file. While this file format is the same as the `.dtb` file formatted as a flattened DT, the different file extension distinguishes it from the main DT.\n2. Flash the `.dtbo` file into a bootloader runtime-accessible partition (detailed in \\[Partition DTs\\](#partition)).\n\nFor details on compiling with DTC and verifying DTO results on the host, see\n[Compile and verify](/docs/core/architecture/dto/compile).\n\nPartition DTs\n-------------\n\nDetermine a bootloader runtime-accessible and trusted location in flash\nmemory to put `.dtb` and `.dtbo`.\n\nExample locations for the main DT:\n\n- Part of boot partition, appended to the kernel (`image.gz`)\n- Separate DT blobs (`.dtb`) in dedicated partition (`dtb`)\n\nExample locations for the overlay DT: \n\n**Figure 1.** Put .dtbo into an odm partition (do this only if your bootloader has\nthe capability to load data from the filesystem of an odm partition). \n\n**Figure 2.** Put .dtbo into a unique partition, such as a dtbo partition.\n\n**Note:** The size of the\noverlay DT partition depends on the device and the amount of changes needed on\ntop of the main DT blob. Typically, 8 MB is more than enough and allows room to\ngrow in the future if required.\n\nFor devices that support\n[seamless (A/B) updates](/docs/core/ota/ab_updates), A/B the\nmain DT and overlay DT partitions: \n\n**Figure 3.** DTBO partition A/B, example 1. \n\n**Figure 4.** DTBO partition A/B, example 2.\n\nRun in bootloader\n-----------------\n\nTo run:\n\n**Figure 5.** Typical runtime implementation for DTO in bootloader.\n\n1. Load `.dtb` from storage into memory.\n2. Load `.dtbo` from storage into memory.\n3. Overlay `.dtb` with `.dtbo` to be a merged DT.\n4. Start kernel given the memory address of the merged DT.\n\nMaintain compatibility\n----------------------\n\nThe main DTB (from SoC vendor) is treated as an API surface for DTBOs. After\nseparating the DT into a SoC-common part and a device-specific part,\nyou must keep the two parts mutually compatible in the future, including:\n\n- **DT definition in main DT.** For example, nodes, properties, labels. Any definition change in main DT could trigger changes in overlay DT. For example, to correct a node name in main DT, define an \"alias\" label that maps to the original node name (to avoid the change of overlay DT).\n- **Overlay DT store location.** For example, partition name, store format.\n\nEnsure security\n---------------\n\nBootloader must ensure the DTB or DTBO is secure, unmodified, and uncorrupted.\nYou could use any solution to secure DTB or DTBO, for example,\n[Boot image\nsignature](/docs/security/features/verifiedboot/verified-boot#signature_format) in VBoot 1.0 or\n[AVB\nHASH footer](https://android.googlesource.com/platform/external/avb/+/android16-release/README.md#The-VBMeta-struct) (VBoot 2.0).\n\n- If DTB or DTBO is in a unique partition, you can add that partition to the trust chain of AVB. The trust chain starts from a hardware-protected root of trust and goes to the bootloader, which verifies the integrity and authenticity of DTB or DTBO partition.\n- If DTB or DTBO is in an existing partition (such as the `odm` partition), that partition should be in the trust chain of AVB. (DTBO partition could share a public key with `odm` partition).\n\nFor details, refer to [Verified\nBoot](/docs/security/features/verifiedboot)."]]