2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
安定したカーネル モジュール インターフェースの維持
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ベンダー モジュール用の安定版のカーネル モジュール インターフェース(KMI)の維持は不可欠です。GKI カーネルはバイナリ形式でビルドおよび出荷され、ベンダーが読み込み可能なモジュールは別のツリーでビルドされます。生成される GKI カーネルとベンダー モジュールは、同時に同じツリーでビルドされたかのように動作する必要があります。
一般に、Linux コミュニティはメインライン カーネルのカーネル内 ABI の安定性という概念に難色を示してきました。さまざまなツールチェーン、構成、進化し続ける Linux メインライン カーネルに対応して、メインラインで KMI の安定性を維持することは不可能です。ただし、次のような高度な制約が設定された GKI 環境では、安定した KMI を維持できます。
カーネルのビルドに使用できる構成が gki_defconfig
1 つのみであること。
KMI の安定性は、android13-5.10
、android12-5.10
、android13-5.15
など、同じ LTS と Android バージョンのカーネル内でのみ維持すること。
android-mainline
については、KMI の安定性を維持しないこと。
カーネルとモジュールのビルドには、AOSP で提供され、対応するブランチに対して定義された特定の Clang ツールチェーンのみを使用すること。
シンボルリストで指定されたモジュールで使用することがわかっているシンボルのみの安定性をモニターし、KMI シンボルとみなすこと。
- 必然的にベンダー モジュールは KMI シンボルのみを使用すること。この制約は、KMI 以外のシンボルを必要とする場合にモジュールを読み込まないようにすることで適用されます。
KMI ブランチを固定した後でも変更は可能だが、KMI の互換性を損なう変更はしないこと。KMI の互換性を損なう変更には、次のようなものがあります。
- 構成の変更
- カーネルコードの変更
- ツールチェーンの変更(アップデートを含む)
密閉型のビルドプロセスと LLVM ツールチェーンの使用
密閉型のビルドプロセスでは、kernel/manifest
内の repo
マニフェストにビルド環境を完全に記述することにより、安定した KMI が確保されます。たとえば、android13-5.15
のマニフェストには、ツールチェーン、ビルド スクリプトなど、汎用カーネル イメージ(GKI)カーネルのビルドに必要なすべてのものが含まれています。GKI ビルド構成 build.config.gki.aarch64
などのそれぞれの build.config
構成ファイルにより、含まれているツールが正しく使用され、一貫したビルド結果が生成されます。
密閉型のビルドプロセスを使用すると、ツリーの ABI の記述の整合性も保たれます。これは Google が生成したもの(android13-5.15
の abi_gki_aarch64.xml
など)でも、ベンダー モジュールなどのローカルツリーで生成されたものでも同様です。カーネル モジュール インターフェース(KMI)の ABI の記述を作成して比較するためのツールも、マニフェストで説明されているリポジトリの一部として提供されています。
GKI カーネルのビルドに使用するツールチェーンは、ベンダー モジュールをビルドするために使用するツールチェーンと完全互換である必要があります。Android 10 以降、すべての Android カーネルは LLVM ツールチェーンでビルドする必要があります。GKI では、プロダクト カーネルとベンダー モジュールをビルドするために使用する LLVM ツールチェーンで、AOSP の LLVM ツールチェーンと同じ ABI を生成する必要があります。また、パートナーは KMI が GKI カーネルと互換性があることを確認する必要があります。最適な互換性を実現するために、提供されているビルドツールを使用することを強くおすすめします。
次のステップ
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。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,["# Maintain a stable kernel module interface\n\nIt's critical to maintain a stable kernel module interface (KMI) for vendor\nmodules. The GKI kernel is\nbuilt and shipped in binary form and vendor-loadable modules are built in a\nseparate tree. The resulting GKI kernel and vendor modules must work as\nthough they were built together.\n\nGenerally, the Linux community has\n[frowned on the notion of in-kernel ABI\nstability](https://www.kernel.org/doc/Documentation/process/stable-api-nonsense.rst)\nfor the mainline kernel. In the face of different toolchains, configurations,\nand an ever-evolving Linux mainline kernel, it isn't feasible to maintain a\nstable KMI in mainline. However, it's possible to maintain a stable KMI in\nthe highly-constrained GKI environment with these constraints:\n\n- Only a single configuration, `gki_defconfig`, can be used to build the\n kernel.\n\n- The KMI is only stable within the same LTS and Android version of a kernel,\n such as `android14-6.1`, `android15-6.6` or `android16-6.12`.\n\n - No KMI stability is maintained for `android-mainline`.\n- Only the specific *Clang* toolchain supplied in AOSP and defined for the\n corresponding branch is used for building kernel and modules.\n\n- Only symbols known to be used by modules as specified in a symbol list are\n monitored for stability and considered KMI symbols.\n\n - The corollary is that vendor modules must use only KMI symbols. This constraint is enforced by failing module loads if non-KMI-symbols are required.\n- After the KMI branch is frozen, changes are allowed but can't break the KMI.\n These changes include the following:\n\n - Config changes\n - Kernel code changes\n - Toolchain changes (including updates)\n\nUse the hermetic build process and LLVM toolchain\n-------------------------------------------------\n\nThe hermetic build process ensures a stable KMI by having `repo` manifests in\n`kernel/manifest` completely describe the build environment. For example, the\n[manifest for `android16-6.12`](https://android.googlesource.com/kernel/manifest/+/refs/heads/common-android16-6.12/default.xml)\nincludes the toolchain, build system, and everything else required to build the\nGeneric Kernel Image (GKI) kernel. The build configuration, primarily\n[`BUILD.bazel`](https://android.googlesource.com/kernel/common/+/refs/heads/android16-6.12/BUILD.bazel),\nensures that the included tools are used correctly to generate consistent build\nresults.\n\nUsing a hermetic build process also ensures that the ABI description for the\ntree is consistent whether generated by Google (for example,\n[`gki/aarch64/abi.stg`](https://android.googlesource.com/kernel/common/+/refs/heads/android16-6.12/gki/aarch64/abi.stg)\nfor `android16-6.12`) or generated in a local tree that includes the vendor\nmodules. The\n[tools to create and compare the ABI description](https://android.googlesource.com/kernel/build/+/refs/heads/main-kernel/abi/)\nfor the Kernel Module Interface (KMI) are also provided as part of the repo\ndescribed by the manifest.\n\nThe toolchain used to build the GKI kernel must be completely compatible with\nthe toolchain used to build vendor modules. As of Android\n10, all Android kernels must be built\nwith an LLVM toolchain. With GKI, the LLVM toolchain used to build product\nkernels and vendor modules must generate the same ABI as the LLVM toolchain from\nAOSP and partners must ensure that the KMI is compatible with the GKI kernel.\nUsing the provided build tools is strongly encouraged as they provide the\nbest compatibility.\n\nWhat's next?\n------------\n\n- For instructions on building the kernel using the hermetic build process and\n LLVM toolchain, refer to refer to\n [Build kernels](/docs/setup/build/building-kernels).\n\n- For instructions on how to monitor the ABI and fix issues, refer to\n [Android Kernel ABI Monitoring](/docs/core/architecture/kernel/abi-monitor)"]]