2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
DTB イメージ
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Android の実装には、ブートローダーが使用するデバイスツリー blob(DTB)イメージを含めることができます。DTB イメージの場所(および DTB イメージのパラメータを指定するためのオプション)は、Android リリースごとに異なります。
Android 11 では、汎用カーネル イメージ(GKI)を使用するデバイスはベンダー ブート パーティションをサポートしている必要があります。これには、ブート パーティションから再配置されたすべてのベンダー固有情報が含まれます。DTB イメージは、ベンダー固有のデータを含んでいるため、現在はベンダー ブート パーティションの一部になっています。DTB イメージのパラメータを指定するには、ベンダー ブートヘッダーをご覧ください。
Android 10 搭載デバイスでは、ブート パーティションに DTB イメージを含めることができます。DTB イメージのパラメータを指定するには、ブートイメージに DTB イメージを含めるをご覧ください。
Android 9 以前では、DTB イメージが独自のパーティションに配置されるか、カーネル image.gz
に追加されるかして、カーネル + DTB イメージが作成されます(その後、mkbootimg
に渡され boot.img
が作成されます)。
Android 10 以降では、DTB イメージは次のいずれかの形式を使用する必要があります。
連続して結合されている DT blob。。ブートローダーは、各 FDT ヘッダーで totalsize
フィールドを使用して、対応する blob の読み取りと解析を行います。
DTB/DTBO パーティション。ブートローダーでは、エントリのハードウェア識別情報を格納できる dt_table_entry
構造体(id
、rev
、custom
の各フィールドが格納されている)を調べることにより、適切な DT blob を効率的に選択できます。詳しくは、DTB/DTBO パーティションをご覧ください。
ブートイメージに DTB イメージを含める
Android 10 搭載デバイスでは、DTB イメージをブートイメージに含めることができます。これにより、カーネルで DTB イメージを image.gz
に追加するスクリプトを Android がサポートする必要がなくなり、ベンダー テストスイート(VTS)テストを使用して DTB プレースメントを検証(および標準化)できるようになりました。
さらに、非 A/B デバイスの場合、DTB を個別のパーティションに入れずにリカバリ イメージの一部にする方が、OTA の中断による問題を安全に防止できます。OTA の実行中、DTB パーティションのアップデート後(かつアップデート全体の完了前)に問題が発生すると、デバイスは OTA を完了するためにリカバリモードで起動しようとします。ただし、DTB パーティションがすでにアップデートされているため、まだアップデートされていないリカバリ イメージとの不一致が生じる可能性があります。DTB イメージをブートイメージ形式の一部にすることで、リカバリ イメージを自立させる(他のパーティションに依存しないようにする)ことができ、前述のような問題の発生を防ぐことができます。
ブートイメージの構造
Android 10 搭載デバイスでは、次のブートイメージ構造を使用して DTB イメージを含めることができます。
ブートイメージ セクション |
ページ数 |
ブートヘッダー(1 ページ) |
1 |
カーネル(l ページ) |
l = (kernel_size + page_size -
1) / page_size |
Ramdisk(m ページ) |
m = (ramdisk_size + page_size -
1) / page_size |
第 2 段階のブートローダー(n ページ) |
n = (second_size + page_size -
1) / page_size |
リカバリ DTBO(o ページ) |
o = (recovery_dtbo_size + page_size -
1) / page_size |
DTB(p ページ) |
p = (dtb_size + page_size -
1) / page_size |
DTB イメージパス
Android 10 搭載デバイスでは、mkbootimg.py
ツールと以下の引数を使用して DTB イメージのパスを指定できます。
引数 |
説明 |
dtb |
ブート / リカバリ イメージに含める DTB イメージのパス。 |
dtb_offset |
base 引数に追加した場合、最終的なデバイスツリーの物理ロードアドレスを表します。たとえば、base 引数が 0x10000000 で dtb_offset 引数が 0x01000000 の場合、ブートイメージ ヘッダーの dtb_addr_field には 0x11000000 が代入されます。 |
DTB イメージのパスの指定にはボード構成変数 BOARD_PREBUILT_DTBIMAGE_DIR
を使用する必要があります。拡張子が *.dtb
であるファイルがディレクトリ BOARD_PREBUILT_DTBIMAGE_DIR
に複数存在する場合、Android ビルドシステムはこれらのファイルを連結して、ブートイメージ作成に使用する最終的な DTB イメージを作成します。
BOARD_PREBUILT_DTBIMAGE_DIR
で指定されたディレクトリにある DTB イメージと引数 dtb
を mkbootimg.py
に渡すには、ボード構成変数 BOARD_INCLUDE_DTB_IN_BOOTIMG
を true
に設定する必要があります。次に例を示します。
BOARD_INCLUDE_DTB_IN_BOOTIMG := true
dtb_offset
引数を、他のオフセットやヘッダー バージョンとあわせて、ボード構成変数 BOARD_MKBOOTIMG_ARGS
に追加できます。次に例を示します。
BOARD_MKBOOTIMG_ARGS := --ramdisk_offset $(BOARD_RAMDISK_OFFSET) --dtb_offset $(BOARD_DTB_OFFSET) --tags_offset $(BOARD_KERNEL_TAGS_OFFSET) --header_version $(BOARD_BOOTIMG_HEADER_VERSION)
ブートローダーのサポート
Android 10 搭載デバイスで VTS を正常に実行するには、アップデートされたブートイメージがブートローダーでサポートされている必要があります。また、カーネル コマンドライン パラメータ androidboot.dtb_idx
を追加して、選択したデバイスツリー(DT)のインデックスを示す必要があります。インデックスは 1 つしか指定できません。たとえば、パラメータ androidboot.dtb_idx=N
は、N
を、ブートイメージ内にある DTB のセットからブートローダーによって選択されたデバイスツリーのゼロベースのインデックスとしてレポートします。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-26 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-26 UTC。"],[],[],null,["# DTB images\n\nAndroid implementations can include a device tree blob (DTB) image for use by\nthe bootloader. The location of the DTB image (and the options for specifying\nDTB image parameters) differs between Android releases.\n\n- In Android 11, devices using the [Generic Kernel\n Image (GKI)](/docs/core/architecture/kernel/generic-kernel-image) must\n support the [vendor boot\n partition](/docs/core/architecture/bootloader/partitions/vendor-boot-partitions),\n which includes all vendor-specific information that was relocated from the\n boot partition. Because the DTB image contains vendor-specific data, it's now\n part of the vendor boot partition. To specify DTB image parameters, see\n [Vendor boot\n header](/docs/core/architecture/bootloader/partitions/vendor-boot-partitions#vendor-boot-header).\n\n- In Android 10, devices can include the DTB image in\n the boot partition. To specify DTB image parameters, see [Including the DTB\n image in the boot image](#dtb-image-include).\n\n- In Android 9 and lower, the DTB image can exist in\n its own partition or be appended to the kernel `image.gz` to create the kernel\n + DTB image (which is then passed to `mkbootimg` to create `boot.img`).\n\nDTB image format\n----------------\n\nIn Android 10 and higher, the DTB image must use one\nof the following formats:\n\n- **DT blobs concatenated one after the other.** The bootloader uses the\n `totalsize` field in each FDT header to read and parse the corresponding blob.\n\n- **DTB/DTBO partitions.** The bootloader has an efficient way to select the\n correct DT blob by examining the `dt_table_entry` struct (contains `id`,\n `rev`, and `custom` fields) that can hold hardware identifying information for\n the entry. For details, see [DTB/DTBO\n Partitions](/docs/core/architecture/dto/partitions#structures).\n\nInclude the DTB image in the boot image\n---------------------------------------\n\nDevices running Android 10 can include the DTB image in\nthe boot image. This removes the need for Android to support scripts that append\nthe DTB image to `image.gz` in the kernel, and enables the use of [Vendor Test\nSuite (VTS)](/docs/compatibility/vts) test to verify (and standardize) DTB\nplacement.\n\nIn addition, for non-A/B devices, it's safer to have the DTB as part of the\nrecovery image rather than in a separate partition to prevent issues caused by\ninterrupted OTAs. During an OTA, if a problem occurs after the DTB partition is\nupdated (but prior to completing the full update), the device tries to boot into\nrecovery mode to complete the OTA; however, because the DTB partition has\nalready been updated, a mismatch could occur with the recovery image (which has\nnot yet been updated). Having the DTB image as part of the boot image format\nprevents such issues by making the recovery image self sufficient (that is, it\ndoesn't depend on another partition).\n\n### Boot image structure\n\nDevices running Android 10 can include a DTB image\nusing the following boot image structure.\n\n| Boot image section | Number of pages |\n|-----------------------------------|------------------------------------------------------------|\n| Boot header (1 page) | 1 |\n| Kernel (l pages) | l = (`kernel_size` + `page_size` - 1) / `page_size` |\n| Ramdisk (m pages) | m = (`ramdisk_size` + `page_size` - 1) / `page_size` |\n| Second stage bootloader (n pages) | n = (`second_size` + `page_size` - 1) / `page_size` |\n| Recovery DTBO (o pages) | o = (`recovery_dtbo_size` + `page_size` - 1) / `page_size` |\n| DTB (p pages) | p = (`dtb_size` + `page_size` - 1) / `page_size` |\n\n### DTB image path\n\nFor devices running Android 10, you can use the\n`mkbootimg.py` tool and the following arguments to specify the path to the DTB\nimage.\n\n| Argument | Description |\n|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `dtb` | Path to the DTB image to be included in the boot/recovery images. |\n| `dtb_offset` | When added to the `base` argument, provides the physical load address for the final device tree. For example, if the `base` argument is `0x10000000` and the `dtb_offset` argument is `0x01000000`, the `dtb_addr_field` in the boot image header is populated as `0x11000000`. |\n\nThe board config variable `BOARD_PREBUILT_DTBIMAGE_DIR` must be used to specify\nthe path to the DTB image. If more than one file with extension `*.dtb` is\npresent in the directory `BOARD_PREBUILT_DTBIMAGE_DIR`, the Android build system\nconcatenates the files to create the final DTB image used in the boot image\ncreation.\n\nTo pass the argument `dtb` to `mkbootimg.py` with the DTB image from the\ndirectory specified by `BOARD_PREBUILT_DTBIMAGE_DIR`, the board config variable\n`BOARD_INCLUDE_DTB_IN_BOOTIMG` must be set to `true`. For example: \n\n BOARD_INCLUDE_DTB_IN_BOOTIMG := true\n\nYou can append the `dtb_offset` argument to the `BOARD_MKBOOTIMG_ARGS` board\nconfig variable with the other offsets and header version. For example: \n\n BOARD_MKBOOTIMG_ARGS := --ramdisk_offset $(BOARD_RAMDISK_OFFSET) --dtb_offset $(BOARD_DTB_OFFSET) --tags_offset $(BOARD_KERNEL_TAGS_OFFSET) --header_version $(BOARD_BOOTIMG_HEADER_VERSION)\n\n### Bootloader support\n\nFor VTS to run successfully on devices running Android\n10, the bootloader must support the updated boot image\nand must add the `androidboot.dtb_idx` kernel command line parameter to indicate\nthe index of the selected device tree (DT). **You can specify only one (1)\nindex.** For example, the parameter `androidboot.dtb_idx=N` reports `N` as the\nzero-based index of the device tree selected by the bootloader from the set of\nDTBs present in the boot image."]]