2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
カーネル機能を GKI モジュールとして設定する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
このページでは、新しいカーネル機能を GKI モジュールとして構成する方法と、既存の組み込みカーネル機能を GKI モジュールとして構成する方法について説明します。
新しい機能の場合、gki_defconfig
を編集して、必要なカーネル機能の構成項目を n
から m
(=m
)に設定します。この設定は、arch/arm64/configs/gki_defconfig
と arch/x86/configs/gki_defconfig
の両方で行います。
その機能用に生成された KO(.ko
)ファイルを common/modules.bzl
の COMMON_GKI_MODULES_LIST
セクションに追加します。ファイルは整列順で追加します。生成されたファイルが不明でも、ビルドすればエラーとなって、リストに追加すべき KO ファイルが表示されます。
(省略可)Android 15 以降の場合は、このステップを省略してください。
ステップ 2 の各 KO ファイルを、実行時のバイナリ検索用に昇順で並べ替えて common/android/gki_{ARCH}_protected_modules
に追加し、このモジュールを保護された GKI モジュールとして指定します。
common/android/abi_gki_protected_exports_ARCHITECTURE
に新しく追加されたエクスポートが含まれるように、エクスポートのリストを更新します。リストを更新するには、たとえば、aarch64
の tools/bazel run //common:kernel_aarch64_abi_update_protected_exports
を実行します。保護された GKI モジュールとして指定されるモジュールであっても、公式の保護されたモジュールとして Google の承認を得る必要があります。
ステップ 2 の新しく追加された KO ファイルがカーネルの out/<androidX-Y.Z>/dist/system_dlkm.img
と out/androidX-Y.Z/dist/system_dlkm_staging_archive.tar.gz
にコピーされているか確認します。system_dlkm_staging_archive.tar.gz
アーカイブ内のモジュールは、プラットフォーム ビルドの system_dlkm.img
を生成するための入力として使用できます。
変更内容を審査のために提出します。GKI モジュールは Android 専用のカーネル機能であるため、モジュール変換パッチをアップストリームに提出する必要はありません。ただし、Android 共通カーネル(ACK)のパッチを提出する場合は、他のガイドラインに従う必要があります。
既存の組み込みカーネル機能の場合、gki_defconfig
を編集して、必要なカーネル機能の構成項目を y
から m
(=m
)に設定します。この設定は、arch/arm64/configs/gki_defconfig
と arch/x86/configs/gki_defconfig
の両方で行います。
その機能用に生成された KO(.ko
)ファイルを common/modules.bzl
の COMMON_GKI_MODULES_LIST
セクションに追加します。ファイルは整列順で追加します。生成されたファイルが不明でも、ビルドすればエラーとなって、リストに追加すべき KO ファイルが表示されます。
ステップ 2 の各 KO ファイルを、実行時のバイナリ検索用に昇順で並べ替えて common/android/gki_{ARCH}_protected_modules
に追加し、このモジュールを保護された GKI モジュールとして指定します。aarch64
の tools/bazel run //common:kernel_aarch64_abi_update_protected_exports
を使用して、common/android/abi_gki_protected_exports_{ARCH}
に新しく追加されたモジュールが含まれるように、保護されたエクスポートのリストを更新します。保護された GKI モジュールとして指定されるモジュールであっても、公式の保護されたモジュールとして Google の承認を得る必要があります。
ステップ 2 の新しく変換されたモジュール KO ファイルがカーネルの out/<androidX-Y.Z>/dist/system_dlkm.img
と out/androidX-Y.Z/dist/system_dlkm_staging_archive.tar.gz
にコピーされているか確認します。system_dlkm_staging_archive.tar.gz
アーカイブ内のモジュールは、プラットフォーム ビルドの system_dlkm.img
を生成するための入力として使用できます。
変更内容を審査のために提出します。GKI モジュールは Android 専用のカーネル機能であるため、モジュール変換パッチをアップストリームに提出する必要はありません。ただし、Android 共通カーネル(ACK)のパッチを提出する場合は、他のガイドラインに従う必要があります。
保護された GKI モジュールを保護されていないモジュールに変換する
- Android 14 以降の場合: 保護された状態から保護されていない状態に変換されたモジュールを、
common/android/gki_protected_modules
の保護されたモジュールのリストから削除します。
- Android 15 以降の場合: 保護された状態から保護されていない状態に変換されたモジュールを、
common/modules.bzl
ファイルの COMMON_UNPROTECTED_MODULES_LIST
リストに追加します。
aarch64
の tools/bazel run //common:kernel_aarch64_abi_update_protected_exports
を使用して、common/android/abi_gki_protected_exports_{ARCH}
の新しく変換された保護されていないモジュールが除外されるように、保護されたエクスポートのリストを更新します。
変更内容を審査のために提出します。GKI モジュールは Android 専用のカーネル機能であるため、モジュール変換パッチをアップストリームに提出する必要はありません。ただし、Android 共通カーネル(ACK)のパッチを提出する場合は、他のガイドラインに従う必要があります。
GKI モジュールのシンボル違反の解決に関するクイックガイド
未署名のモジュールが GKI モジュールでのシンボル保護に違反している場合、モジュールの読み込み中に 2 種類のエラーが発生し、失敗する可能性があります。
1. 保護されたシンボルを使用する未署名のモジュール
エラー:
module: Protected symbol: some_kernel_function (err -13)
原因:
module.ko
ファイルは未署名のベンダー モジュールであり、ベンダー シンボルリストに記載されることなく、読み込み中に GKI モジュールのエクスポート済みシンボル some_kernel_function
の解決を試みます。
解決策:
module.ko
が保護された GKI モジュールでない場合、シンボルリストを更新するとベンダー シンボルリストに some_kernel_function
が組み込まれて、エラーが解決されます。また、GKI バージョンの module.ko
を使うという方法もあります。
2. 保護されたシンボルをエクスポートする未署名のモジュール
エラー:
module: exports protected symbol some_kernel_function
原因:
some_kernel_function
をエクスポートするモジュールは保護された GKI モジュールであり、module.ko
はそのモジュールの未署名のカスタム バージョンであると考えられます。署名済みの GKI モジュールだけがエクスポートできる some_kernel_function
を module.ko
がエクスポートしようとすると、読み込みが失敗し、このメッセージが返されます。
解決策:
some_kernel_function
をエクスポートするモジュールの 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,["# Configure kernel features as GKI modules\n\nThis page covers how to configure a new kernel feature as a GKI module or\nconfigure an existing built-in kernel feature as a GKI module.\n| **Note:** Changes that result in a new GKI module or that change the protection status of a GKI module must be approved by Google.\n\nConfigure a new feature as a GKI module\n---------------------------------------\n\n1. For the new feature, edit `gki_defconfig` and set the required kernel\n feature's config item from `n` to `m` (`=m`). Set this setting in both\n `arch/arm64/configs/gki_defconfig` and `arch/x86/configs/gki_defconfig`.\n\n2. Add the KO (`.ko`) files generated for the feature\n to the `COMMON_GKI_MODULES_LIST` section of `common/modules.bzl`. Add the\n files in a sorted order. If you're unsure of all the files generated,\n the build fails and lists all the necessary KO files to be added to the list.\n\n3. For Android 14, add the same set of KO files from step 2, sorted in ascending\n order for binary search at runtime, to\n `common/android/gki_{ARCH}_protected_modules` to designate the module as a\n protected GKI module.\n\n4. For Android 14 and 15, update the list of exports so that it includes the\n newly-added exports in `common/android/abi_gki_protected_exports_`\u003cvar translate=\"no\"\u003eARCHITECTURE\u003c/var\u003e. For example, to update the list, run\n `tools/bazel run //common:kernel_aarch64_abi_update_protected_exports` for\n `aarch64`.\n\n5. Make sure newly added KO files from step 2 are copied to the kernel's\n `out/\u003candroidX-Y.Z\u003e/dist/system_dlkm.img` and\n `out/`\u003cvar translate=\"no\"\u003eandroidX-Y.Z\u003c/var\u003e`/dist/system_dlkm_staging_archive.tar.gz`.\n Modules in the `system_dlkm_staging_archive.tar.gz` archive can be used as\n input to generate the `system_dlkm.img` in the platform build.\n\n6. Submit your changes for review. GKI modules are an Android-only kernel\n feature, so module conversion patches aren't required to be submitted\n upstream. However, you must follow other guidelines to submit\n [Android Common Kernel (ACK) patches](/docs/core/architecture/kernel/kernel-code#ack-patches).\n\nConfigure a kernel built-in feature as a GKI module\n---------------------------------------------------\n\n1. For an existing built-in kernel feature, edit `gki_defconfig` and set the\n required kernel feature's config item from `y` to `m` (`=m`). Set this\n setting in both `arch/arm64/configs/gki_defconfig` and\n `arch/x86/configs/gki_defconfig`.\n\n2. Add the KO (`.ko`) files generated for the feature to the\n `COMMON_GKI_MODULES_LIST` section of `common/modules.bzl`. Add the files\n in a sorted order. If you're unsure of all the files generated,\n the build fails and lists all the necessary KO files to be added to the list.\n\n3. For Android 14, add the same set of KO files from step 2, sorted in ascending\n order for binary search at runtime, to\n `common/android/gki_{ARCH}_protected_modules` to designate the module as a\n protected GKI module.\n\n4. For Android 14 and 15, update the list of exports that are protected to\n include ones from the newly added module in\n `common/android/abi_gki_protected_exports_{ARCH}` using `tools/bazel run\n //common:kernel_aarch64_abi_update_protected_exports` for `aarch64`.\n\n5. Make sure newly converted module KO files from step 2 are copied to the\n kernel's `out/\u003candroidX-Y.Z\u003e/dist/system_dlkm.img` and\n `out/`\u003cvar translate=\"no\"\u003eandroidX-Y.Z\u003c/var\u003e`/dist/system_dlkm_staging_archive.tar.gz`.\n Modules in the `system_dlkm_staging_archive.tar.gz` archive can be used as\n input to generate the `system_dlkm.img` in the platform build.\n\n6. Submit your changes for review. GKI modules are an Android-only kernel\n feature, so module conversion patches aren't required to be submitted\n upstream. However, you must follow the other guidelines to submit\n [Android Common Kernel (ACK)\n patches](/docs/core/architecture/kernel/kernel-code#ack-patches).\n\nConvert a protected GKI module to unprotected\n---------------------------------------------\n\n1. For Android 15 and higher, add the module being converted from protected to\n unprotected to the `COMMON_UNPROTECTED_MODULES_LIST` list in\n `common/modules.bzl` file.\n\n2. For Android 14, remove the module being converted from protected to\n unprotected from the list of protected modules at\n `common/android/gki_protected_modules`.\n\n3. For Android 14 and 15, update the list of exports that are protected to\n exclude ones from the newly converted unprotected module in the\n `common/android/abi_gki_protected_exports_{ARCH}` using `tools/bazel run\n //common:kernel_aarch64_abi_update_protected_exports` for `aarch64`.\n\n4. Submit your changes for review. GKI modules are an Android-only kernel\n feature, so module conversion patches aren't required to be submitted\n upstream. However, you must follow the other guidelines to submit\n [Android Common Kernel (ACK)\n patches](/docs/core/architecture/kernel/kernel-code#ack-patches).\n\nGKI modules symbol violation resolution quick guide\n---------------------------------------------------\n\nWhen unsigned modules violate the symbol protection in place for GKI modules,\ntwo types of errors may be encountered during module loading, resulting in\nfailure.\n\n### 1. Unsigned module using the protected symbol\n\n**Error:**\n\n`module: Protected symbol: some_kernel_function (err -13)`\n\n**Cause:**\n\nThe `module.ko` file is an unsigned vendor module and attempts to resolve the\nGKI module exported symbol `some_kernel_function` during loading, without\nbeing listed in the vendor symbol list.\n\n**Resolution:**\n\nIf `module.ko` is not a protected GKI module, updating the symbol list will\nresolve the error by including `some_kernel_function` in the vendor symbol list.\nAlternatively, use the GKI version of `module.ko`.\n\n### 2. Unsigned module exporting the protected symbol\n\n**Error:**\n\n`module: exports protected symbol some_kernel_function`\n\n**Cause:**\n\nThe module exporting the `some_kernel_function` is a protected GKI module, and\n`module.ko` is likely an unsigned custom version of that module. When\n`module.ko` tries to export `some_kernel_function`, which can only be exported\nby a signed GKI module, loading fails with this message.\n\n**Resolution:**\n\nThis can be corrected by using the GKI version of the module that exports\n`some_kernel_function`, if the unsigned module is a custom version."]]