2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
リカバリ イメージ
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
非 A/B デバイスの場合、リカバリ イメージにはデバイスツリー blob(DTB)または Advanced Configuration and Power Interface(ACPI)オーバーレイ イメージの情報が含まれている必要があります。非 A/B デバイスでリカバリを起動すると、ブートローダーはリカバリ イメージに対応するオーバーレイ イメージを読み込めるようになります。A/B(シームレス)アップデートをサポートするデバイスは、個別のリカバリ パーティションの代わりにリカバリをブートとして使用する必要があります。詳しくは、A/B アップデートの実装をご覧ください。
リカバリ DTBO/ACPIO をブートイメージまたはリカバリ イメージの一部として含めるオプションは、Android リリースによって異なります。
リリース |
アップデートのスキーム |
GKI の遵守 |
ブートヘッダー バージョン(デバイスの起動) |
ブートヘッダー バージョン(デバイスのアップグレード) |
専用のリカバリ イメージが必要 |
11 |
A/B、 仮想 A/B |
○ |
3* |
該当なし |
× |
A/B、 仮想 A/B |
× |
2、3 |
0、1、2、3 |
× |
非 A/B |
○ |
3 |
該当なし |
○ |
非 A/B |
× |
2、3 |
0、1、2、3 |
○ |
10(Q) |
A/B |
該当なし |
2 |
0、1、2 |
× |
非 A/B |
該当なし |
2 |
0、1、2 |
○ |
9(P) |
A/B |
該当なし |
1 |
0、1 |
× |
非 A/B |
該当なし |
1 |
0、1 |
○ |
8(O) |
A/B |
該当なし |
該当なし(0 と見なされます) |
該当なし(0 と見なされます) |
× |
非 A/B |
該当なし |
該当なし(0 と見なされます) |
該当なし(0 と見なされます) |
○ |
* Android 11 以降を搭載し、Generic Kernel Image(GKI)を使用している A/B デバイスは、メインのブートヘッダー バージョン 3 を使用して、ベンダー ブート パーティションと互換性があるようにする必要があります。
主なポイントは以下のとおりです。
A/B アップデートでは 2 つのパーティション セット(boot
と dtbo
を含む)を使用し、更新中に切り替えられるため、A/B デバイスはリカバリ イメージを指定する必要はありません。また、A/B デバイスでは専用のリカバリ イメージを使用することもできます。
Android 11 以降を搭載し、ブートヘッダー バージョン 3 を使用している非 A/B デバイスでは、個別にリカバリ イメージのブートヘッダー バージョン 2 を明示的に指定する必要があります。例:
BOARD_RECOVERY_MKBOOTIMG_ARGS := --header_version 2
デバイスツリーをサポートしていないアーキテクチャの場合、DTBO イメージの代わりに ACPIO イメージをリカバリ イメージに含めることができます。
OTA の障害とリカバリ イメージについて
非 A/B デバイスで無線(OTA)障害を回避するには、リカバリ イメージが自立して、他のイメージから独立している必要があります。OTA アップデートで、オーバーレイ イメージがアップデートされてから完全なアップデートが完了するまでの間に問題が発生すると、デバイスは OTA アップデートを完了するためにリカバリモードで起動しようとします。ただし、オーバーレイ パーティションがすでにアップデートされているため、まだアップデートされていないリカバリ イメージとの不一致が生じる可能性があります。
リカバリがアップデート中に DTBO/ACPIO パーティションに依存することを回避するために、Android 9 以降を搭載する非 A/B デバイスでは、ブートイメージ形式内の別個のセクションとしてオーバーレイ イメージの情報を含むリカバリ DTBO/ACPIO イメージを指定できます(ブートヘッダー バージョンは 1 または 2 を使用する必要があります)。
ブートイメージの変更
Android 9 以降が搭載されている非 A/B デバイスで、リカバリ イメージにリカバリ DTBO または ACPIO を含めるようにするには、ブートイメージ構造を次のように更新します。
ブートイメージ セクション |
ページ数 |
ブートヘッダー(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 または ACPIO(o ページ) |
o = (recovery_[dtbo|acpio]_size + page_size - 1) / page_size |
ブートイメージ ヘッダーのバージョンとオーバーレイ イメージのパスを指定する mkbootimg
ツールの引数について詳しくは、ブートイメージ ヘッダーのバージョニングをご覧ください。
DTBO を実装する
9 以降を搭載する非 A/B デバイスでは、リカバリ イメージの recovery_dtbo
セクションに挿入できます。recovery_dtbo
イメージを recovery.img
に含めるには、デバイスの BoardConfig.mk
で以下の操作を実行します。
BOARD_INCLUDE_RECOVERY_DTBO
構成を true
に設定します。
BOARD_INCLUDE_RECOVERY_DTBO := true
BOARD_MKBOOTIMG_ARGS
変数を拡張し、ブートイメージ ヘッダーのバージョンを指定します。
BOARD_MKBOOTIMG_ARGS := --ramdisk_offset $(BOARD_RAMDISK_OFFSET) --tags_offset $(BOARD_KERNEL_TAGS_OFFSET) --header_version $(BOARD_BOOTIMG_HEADER_VERSION)
BOARD_PREBUILT_DTBOIMAGE
変数が DTBO イメージのパスに設定されていることを確認します。Android ビルドシステムは、リカバリ イメージの作成中に変数を使用して mkbootimg
ツールの recovery_dtbo
引数を設定します。
BOARD_INCLUDE_RECOVERY_DTBO
、BOARD_MKBOOTIMG_ARGS
、BOARD_PREBUILT_DTBOIMAGE
の各変数が正しく設定されている場合、Android ビルドシステムは recovery.img
の BOARD_PREBUILT_DTBOIMAGE
変数で指定された DTBO を含めます。
ACPIO を実装する
Android 9 以降を搭載した非 A/B デバイスでは、DTBO イメージの代わりに ACPIO オーバーレイ イメージを使用し、recovery_dtbo
セクションの代わりにリカバリ イメージの recovery_acpio
セクションに挿入できます。recovery_acpio
イメージを recovery.img
に含めるには、デバイスの BoardConfig.mk
で以下の操作を実行します。
BOARD_INCLUDE_RECOVERY_ACPIO
構成を true
に設定します。
BOARD_INCLUDE_RECOVERY_ACPIO := true
BOARD_MKBOOTIMG_ARGS
変数を拡張し、ブートイメージ ヘッダーのバージョンを指定します。リカバリ ACPIO をサポートするには、変数を 1 以上にする必要があります。
BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOTIMG_HEADER_VERSION)
BOARD_RECOVERY_ACPIO
変数が ACPIO イメージのパスに設定されていることを確認します。Android ビルドシステムは、リカバリ イメージの作成中に変数を使用して mkbootimg
ツールの recovery_acpio
引数を設定します。
BOARD_INCLUDE_RECOVERY_ACPIO
、BOARD_MKBOOTIMG_ARGS
、BOARD_RECOVERY_ACPIO
の各変数が正しく設定されている場合、Android ビルドシステムは recovery.img
に BOARD_RECOVERY_ACPIO
変数で指定された ACPIO を含めます。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-04-04 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-04-04 UTC。"],[],[],null,["# Recovery images\n\nOn non-A/B devices, the recovery image should contain information from a\n[device tree blob (DTB)](/docs/core/architecture/bootloader/dtb-images) or\n[Advanced Configuration and Power Interface\n(ACPI)](https://uefi.org/acpi/specs) overlay image. When such\ndevices boot into recovery, the bootloader can then load the overlay image that\nis compatible with the recovery image. Devices that support [A/B (seamless)\nupdates](/docs/core/ota/ab) should use recovery as boot instead of a\nseparate recovery partition (for details, see [Implementing A/B\nUpdates](/docs/core/ota/ab/ab_implement)).\n\nThe options for including a recovery DTBO/ACPIO as part of the boot/recovery\nimage differ between Android releases.\n\n| Release | Update scheme | GKI compliance | Boot header version (launching devices) | Boot header version (upgrading devices) | Dedicated recovery image required |\n|---------|------------------|----------------|-----------------------------------------|-----------------------------------------|-----------------------------------|\n| 11 | A/B, Virtual A/B | Yes | 3^\\*^ | N/A | No |\n| 11 | A/B, Virtual A/B | No | 2, 3 | 0, 1, 2, 3 | No |\n| 11 | non-A/B | Yes | 3 | N/A | Yes |\n| 11 | non-A/B | No | 2, 3 | 0, 1, 2, 3 | Yes |\n| 10 (Q) | A/B | N/A | 2 | 0, 1, 2 | No |\n| 10 (Q) | non-A/B | N/A | 2 | 0, 1, 2 | Yes |\n| 9 (P) | A/B | N/A | 1 | 0, 1 | No |\n| 9 (P) | non-A/B | N/A | 1 | 0, 1 | Yes |\n| 8 (O) | A/B | N/A | N/A (considered 0) | N/A (considered 0) | No |\n| 8 (O) | non-A/B | N/A | N/A (considered 0) | N/A (considered 0) | Yes |\n\n**\\*** *A/B devices running Android\n11 or higher and using the [Generic Kernel Image\n(GKI)](/docs/core/architecture/kernel/generic-kernel-image) must use a\nprimary [boot header version of\n3](/docs/core/architecture/bootloader/boot-image-header#header-v3) to be\ncompatible with the [vendor boot\npartition](/docs/core/architecture/bootloader/partitions/vendor-boot-partitions).*\n\nKey points:\n\n- A/B devices don't need to specify a recovery image as A/B updates use two sets\n of partitions (including `boot` and `dtbo`) and switch between them during\n updates, removing the need for a recovery image. A/B devices can\n still use a dedicated recovery image.\n\n- Non-A/B devices launching with Android 11 or higher\n and using a boot header version of 3 must explicitly specify a [boot header\n version of 2](/docs/core/architecture/bootloader/boot-image-header#header-v2)\n for the recovery image separately. For example:\n\n BOARD_RECOVERY_MKBOOTIMG_ARGS := --header_version 2\n\n- For architectures that don't support device trees, the recovery image can\n include an ACPIO image instead of a DTBO image.\n\nAbout OTA failures and recovery images\n--------------------------------------\n\nTo prevent over-the-air (OTA) failures on non-A/B devices, the recovery image\nshould be self-sufficient and independent of other images. During an OTA update,\nif a problem occurs after the overlay image has been updated (but prior to\ncompleting the full update), the device tries to boot into recovery mode to\ncomplete the OTA update. However, because the overlay partition has already been\nupdated, a mismatch could occur with the recovery image (which hasn't been\nupdated yet).\n\nTo prevent recovery from depending on the DTBO/ACPIO partition during an\nupdate, non-A/B devices running Android 9 or higher\ncan specify a recovery DTBO/ACPIO image containing information from the overlay\nimage as a separate section in the boot image format (must use a boot header\nversion of 1 or 2).\n\nBoot image changes\n------------------\n\nTo allow the recovery image to contain the recovery DTBO or ACPIO on non-A/B\ndevices running Android 9 or higher, update the boot\nimage structure as follows.\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 or ACPIO (o pages) | o = (`recovery_[dtbo|acpio]_size` + `page_size` - 1) / `page_size` |\n\nFor details on the `mkbootimg` tool arguments for specifying the boot image\nheader version and overlay image paths, see [Boot Image Header\nVersioning](/docs/core/architecture/bootloader/boot-image-header#implementing-versioning).\n\nImplement DTBO\n--------------\n\nNon-A/B devices running 9 or higher can populate the\n`recovery_dtbo` section of the recovery image. To include the `recovery_dtbo`\nimage in `recovery.img`, in the device `BoardConfig.mk`:\n\n- Set the config `BOARD_INCLUDE_RECOVERY_DTBO` to `true`:\n\n BOARD_INCLUDE_RECOVERY_DTBO := true\n\n- Extend the `BOARD_MKBOOTIMG_ARGS` variable to specify the boot image header\n version:\n\n BOARD_MKBOOTIMG_ARGS := --ramdisk_offset $(BOARD_RAMDISK_OFFSET) --tags_offset $(BOARD_KERNEL_TAGS_OFFSET) --header_version $(BOARD_BOOTIMG_HEADER_VERSION)\n\n- Ensure that the `BOARD_PREBUILT_DTBOIMAGE` variable is set to the path of the\n DTBO image. The Android build system uses the variable to set the\n `recovery_dtbo` argument of the `mkbootimg` tool during the creation of\n recovery image.\n\nIf the `BOARD_INCLUDE_RECOVERY_DTBO`, `BOARD_MKBOOTIMG_ARGS`, and\n`BOARD_PREBUILT_DTBOIMAGE` variables are set correctly, the Android build system\nincludes the DTBO specified by the `BOARD_PREBUILT_DTBOIMAGE` variable in\n`recovery.img`.\n\nImplement ACPIO\n---------------\n\nNon-A/B devices running Android 9 or higher can use\nan ACPIO overlay image (instead of a DTBO image) and can populate the\n`recovery_acpio` section (instead of the `recovery_dtbo` section) of the\nrecovery image. To include the `recovery_acpio` image in `recovery.img`, in the\ndevice `BoardConfig.mk`:\n\n- Set the config `BOARD_INCLUDE_RECOVERY_ACPIO` to `true`:\n\n BOARD_INCLUDE_RECOVERY_ACPIO := true\n\n- Extend the `BOARD_MKBOOTIMG_ARGS` variable to specify the boot image header\n version. The variable must be greater than or equal to 1 to support recovery\n ACPIO.\n\n BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOTIMG_HEADER_VERSION)\n\n- Ensure that the `BOARD_RECOVERY_ACPIO` variable is set to the path of the\n ACPIO image. The Android build system uses the variable to set the\n `recovery_acpio` argument of the `mkbootimg` tool during the creation of the\n recovery image.\n\nIf the `BOARD_INCLUDE_RECOVERY_ACPIO`, `BOARD_MKBOOTIMG_ARGS`, and\n`BOARD_RECOVERY_ACPIO` variables are set correctly, the Android build system\nincludes the ACPIO specified by the `BOARD_RECOVERY_ACPIO` variable in\n`recovery.img`."]]