2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
ブートローダーの概要
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ブートローダーは、デバイス上でカーネルを起動するためのベンダー独自のイメージです。デバイスの状態を監視し、高信頼実行環境(TEE)を初期化して、そのルート オブ トラストをバインドします。また、ブートローダーは実行をカーネルに移行する前に、boot
パーティションと recovery
パーティションの整合性を検証します。
ブートローダー フローの例
ブートローダー フローの例を次に示します。
メモリを読み込んで初期化します。
確認付きブートのフローに沿ってデバイスを検証します。
確認付きブートのフローに沿って、boot
、dtbo
、init_boot
、recovery
などのブート パーティションを検証します。この手順の一環として、ブートイメージ ヘッダーのバージョンを確認し、それに応じてヘッダーを解析します。
A/B アップデートが使用される場合、現在のブートスロットを決定します。
リカバリモードで起動するかどうかを決定します。詳細については、OTA アップデートのサポートをご覧ください。
ブートイメージ(boot.img
、vendor_boot.img
、init_boot.img
など)と、他の独自のベンダー ブートイメージを読み込みます。このブートイメージには、カーネル イメージと RAM ディスク イメージが含まれます。
自己実行型の圧縮バイナリとしてカーネルをメモリに読み込みます。カーネルは自己解凍し、メモリへの実行を開始します。
RAM ディスクと bootconfig セクションをメモリに読み込み、initramfs
を作成します。
ブートローダー関連のその他の機能
実装可能なブートローダー関連のその他の機能は次のとおりです。
デバイスツリー オーバーレイ(DTO): デバイスツリー オーバーレイにより、ブートローダーはさまざまなハードウェア構成をサポートできます。DTO は、ブートローダーが使用するデバイスツリー blob(DTB)にコンパイルされます。
カーネル イメージ仮想アドレス ランダム化: ブートローダーは、カーネル イメージを読み込む仮想アドレスのランダム化をサポートしています。アドレスをランダム化するには、カーネル構成で RANDOMIZE_BASE
を true
に設定します。ブートローダーは、ランダムな u64 値を /chosen/kaslr-seed
デバイスツリー ノードに渡してエントロピーを指定する必要があります。
確認付きブート: 確認付きブートにより、ブートローダーは、信頼できる提供元のコードを確実に実行できます。
ブート構成: ブート構成は Android 12 以降で利用できます。ビルドとブートローダーからオペレーティング システムに構成の詳細を渡すメカニズムです。Android 12 より前のバージョンでは、接頭辞が androidboot
のカーネル コマンドライン パラメータが使用されます。
無線(OTA)アップデート: 実際に利用中の Android デバイスで、システム、アプリ ソフトウェア、タイムゾーン ルールの OTA アップデートを受信してインストールできます。この機能は、ブートローダーの実装に影響します。OTA の一般的な情報については、OTA アップデートをご覧ください。ブートローダー固有の OTA 実装の詳細については、OTA アップデートのサポートをご覧ください。
バージョン バインディング: バージョン バインディングは、オペレーティング システムとパッチレベルのバージョンにセキュリティ キーをバインドします。バージョン バインディングにより、攻撃者が古いバージョンのシステムまたは TEE ソフトウェアに脆弱性を見つけても、デバイスを脆弱なバージョンにロールバックして新しいバージョンで作成された鍵を使用することができなくなります。ブートローダーは、バージョン バインディングをサポートするために、特定の情報を提供する必要があります。詳しくは、AVB プロパティ内のバージョン情報をご覧ください。
カーネル コマンドライン
次の場所からカーネル コマンドラインを連結します。
ブートローダー コマンドライン: ブートローダーにより決定される静的パラメータと動的パラメータのセット
デバイスツリー: chosen/bootargs
ノードから
defconfig
: CONFIG_CMDLINE
から
boot.img
: コマンドラインから(オフセットとサイズについては、system/core/mkbootimg/bootimg.h
を参照)
Android 12 以降では、Android ユーザー空間に渡す必要がある androidboot.*
パラメータについて、カーネル コマンドラインの代わりに bootconfig を使用できます。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-26 UTC。
[null,null,["最終更新日 2025-03-26 UTC。"],[],[],null,["# Bootloader overview\n\nA *bootloader* is a vendor-proprietary image responsible for bringing up the\nkernel on a device. The bootloader guards the device state and is responsible\nfor initializing the [Trusted Execution Environment (TEE)](/docs/security/features/trusty)\nand binding its root of trust. The bootloader also verifies the integrity of the\n`boot` and `recovery` partitions before moving execution to the kernel.\n\nExample bootloader flow\n-----------------------\n\nHere's an example bootloader flow:\n\n1. Load and initialize memory.\n\n2. Verify the device according to [Verified Boot flow](/docs/security/features/verifiedboot).\n\n3. Verify the boot partitions, including `boot`, `dtbo`, `init_boot`, and\n `recovery`, according to the Verified Boot flow. As part of this step, check the\n [boot image header](/docs/core/architecture/bootloader/boot-image-header)\n version and parse the header accordingly.\n\n4. If [A/B updates](/docs/core/ota/ab) are used, determine the current slot to\n boot.\n\n5. Determine if recovery mode should be booted. For more\n information, see\n [Supporting OTA Updates](/docs/core/architecture/bootloader/updating).\n\n6. Load the boot images, such as `boot.img`, `vendor_boot.img`,\n `init_boot.img`, and other proprietary vendor boot images. These boot images\n contain the kernel and ramdisk images.\n\n 1. Load the kernel into memory as a self-executable compressed\n binary. The kernel decompresses itself and starts executing into memory.\n\n 2. Load ramdisks and the bootconfig section into memory\n to create `initramfs`.\n\nAdditional bootloader-related features\n--------------------------------------\n\nFollowing is a list of additional bootloader-related features that you can\nimplement:\n\n- *Device tree overlay (DTO).*\n A [device tree overlay](/docs/core/architecture/dto) lets the bootloader to\n support different hardware configurations. A DTO is compiled into a *device\n tree blob (DTB)* which is used by the bootloader.\n\n- *Kernel image virtual address randomization.* The bootloader supports\n randomizing the virtual address at which the kernel image is loaded. To\n randomize the address, set `RANDOMIZE_BASE` to `true` in the kernel config.\n The bootloader must provide entropy by passing a random u64 value in the\n `/chosen/kaslr-seed` device tree node.\n\n- *Verified Boot.* [Verified Boot](/docs/security/features/verifiedboot) lets\n the bootloader to ensure all executed code comes from a trusted source.\n\n- *Boot config.*\n [Boot config](/docs/core/architecture/bootloader/implementing-bootconfig)\n is available in Android 12 and higher and is a mechanism for passing\n configuration details from the build and bootloader to the operating system.\n Prior to Android 12, kernel command-line parameters with the prefix of\n `androidboot` are used.\n\n- *Over-the-air (OTA) updates.* Android devices in the field can receive and\n install OTA updates to the system, app software, and\n time zone rules. This feature has implications on your bootloader\n implementation. For general information on OTA, see\n [OTA updates](/docs/core/ota). For bootloader-specific OTA implementation\n details, see\n [Supporting OTA updates](/docs/core/architecture/bootloader/updating).\n\n- *Version binding* .\n [Version binding](/docs/security/features/keystore/version-binding) binds\n security keys to the operating system and patch level version. Version binding\n ensures that an attacker who discovers a weakness in an old version of the\n system or the TEE software can't roll a device back to the vulnerable version\n and use keys created with the newer version. The bootloader must provide certain\n information to support version binding. For further information, see\n [Version information in AVB properties](/docs/core/architecture/bootloader/version-info-avb).\n\nKernel command line\n-------------------\n\nConcatenate the kernel command line from the following locations:\n\n- Bootloader command line: set of static and dynamic parameters determined by\n the bootloader\n\n- Device tree: from the `chosen/bootargs` node\n\n- `defconfig`: from `CONFIG_CMDLINE`\n\n- `boot.img`: from the command line (for offsets and sized, refer to\n [`system/core/mkbootimg/bootimg.h`](https://android.googlesource.com/platform/system/tools/mkbootimg/+/refs/heads/android16-release/include/bootimg/bootimg.h)\n\nAs of Android 12, for `androidboot.*` parameters that\nwe need to pass to Android userspace, we can use\n[bootconfig](/docs/core/architecture/bootloader/implementing-bootconfig) instead\nof the kernel command line."]]