Mulai 27 Maret 2025, sebaiknya gunakan android-latest-release, bukan aosp-main, untuk mem-build dan berkontribusi pada AOSP. Untuk mengetahui informasi selengkapnya, lihat Perubahan pada AOSP.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini membahas cara mengonfigurasi fitur kernel baru sebagai modul GKI atau
mengonfigurasi fitur kernel bawaan yang ada sebagai modul GKI.
Mengonfigurasi fitur baru sebagai modul GKI
Untuk fitur baru, edit gki_defconfig dan tetapkan item konfigurasi fitur kernel
yang diperlukan dari n ke m (=m). Tetapkan setelan ini di
arch/arm64/configs/gki_defconfig dan arch/x86/configs/gki_defconfig.
Tambahkan file KO (.ko) yang dihasilkan untuk fitur
ke bagian COMMON_GKI_MODULES_LIST di common/modules.bzl. Tambahkan file dalam urutan yang diurutkan. Jika Anda tidak yakin dengan semua file yang dihasilkan,
build akan gagal dan mencantumkan semua file KO yang diperlukan untuk ditambahkan ke daftar.
Untuk Android 14, tambahkan kumpulan file KO yang sama dari langkah 2, yang diurutkan dalam urutan
bertahap naik untuk penelusuran biner saat runtime, ke
common/android/gki_{ARCH}_protected_modules untuk menetapkan modul sebagai
modul GKI yang dilindungi.
Untuk Android 14 dan 15, perbarui daftar ekspor agar menyertakan
ekspor yang baru ditambahkan di common/android/abi_gki_protected_exports_ARCHITECTURE. Misalnya, untuk memperbarui daftar, jalankan
tools/bazel run //common:kernel_aarch64_abi_update_protected_exports untuk
aarch64.
Pastikan file KO yang baru ditambahkan dari langkah 2 disalin ke
out/<androidX-Y.Z>/dist/system_dlkm.img dan
out/androidX-Y.Z/dist/system_dlkm_staging_archive.tar.gz kernel.
Modul dalam arsip system_dlkm_staging_archive.tar.gz dapat digunakan sebagai
input untuk membuat system_dlkm.img dalam build platform.
Kirim perubahan untuk ditinjau. Modul GKI adalah fitur kernel khusus
Android, sehingga patch konversi modul tidak perlu dikirimkan
upstream. Namun, Anda harus mengikuti panduan lain untuk mengirimkan
patch Android Common Kernel (ACK).
Mengonfigurasi fitur bawaan kernel sebagai modul GKI
Untuk fitur kernel bawaan yang ada, edit gki_defconfig dan tetapkan
item konfigurasi fitur kernel yang diperlukan dari y ke m (=m). Tetapkan setelan
ini di arch/arm64/configs/gki_defconfig dan
arch/x86/configs/gki_defconfig.
Tambahkan file KO (.ko) yang dihasilkan untuk fitur ke
bagian COMMON_GKI_MODULES_LIST di common/modules.bzl. Tambahkan file dalam urutan yang diurutkan. Jika Anda tidak yakin dengan semua file yang dihasilkan,
build akan gagal dan mencantumkan semua file KO yang diperlukan untuk ditambahkan ke daftar.
Untuk Android 14, tambahkan kumpulan file KO yang sama dari langkah 2, yang diurutkan dalam urutan
bertahap naik untuk penelusuran biner saat runtime, ke
common/android/gki_{ARCH}_protected_modules untuk menetapkan modul sebagai
modul GKI yang dilindungi.
Untuk Android 14 dan 15, perbarui daftar ekspor yang dilindungi untuk
menyertakan ekspor dari modul yang baru ditambahkan di
common/android/abi_gki_protected_exports_{ARCH} menggunakan tools/bazel run
//common:kernel_aarch64_abi_update_protected_exports untuk aarch64.
Pastikan file KO modul yang baru dikonversi dari langkah 2 disalin ke
out/<androidX-Y.Z>/dist/system_dlkm.img dan
out/androidX-Y.Z/dist/system_dlkm_staging_archive.tar.gz kernel.
Modul dalam arsip system_dlkm_staging_archive.tar.gz dapat digunakan sebagai
input untuk membuat system_dlkm.img dalam build platform.
Kirim perubahan untuk ditinjau. Modul GKI adalah fitur kernel khusus
Android, sehingga patch konversi modul tidak perlu dikirimkan
upstream. Namun, Anda harus mengikuti panduan lain untuk mengirimkan
patch Android Common Kernel (ACK).
Mengonversi modul GKI yang dilindungi menjadi tidak dilindungi
Untuk Android 15 dan yang lebih tinggi, tambahkan modul yang dikonversi dari dilindungi menjadi
tidak dilindungi ke daftar COMMON_UNPROTECTED_MODULES_LIST dalam
file common/modules.bzl.
Untuk Android 14, hapus modul yang dikonversi dari dilindungi menjadi
tidak dilindungi dari daftar modul yang dilindungi di
common/android/gki_protected_modules.
Untuk Android 14 dan 15, perbarui daftar ekspor yang dilindungi untuk
mengecualikan ekspor dari modul yang baru dikonversi dan tidak dilindungi di
common/android/abi_gki_protected_exports_{ARCH} menggunakan tools/bazel run
//common:kernel_aarch64_abi_update_protected_exports untuk aarch64.
Kirim perubahan untuk ditinjau. Modul GKI adalah fitur kernel khusus
Android, sehingga patch konversi modul tidak perlu dikirimkan
upstream. Namun, Anda harus mengikuti panduan lain untuk mengirimkan
patch Android Common Kernel (ACK).
Panduan cepat penyelesaian pelanggaran simbol modul GKI
Jika modul yang tidak ditandatangani melanggar perlindungan simbol yang diterapkan untuk modul GKI,
dua jenis error dapat terjadi selama pemuatan modul, yang mengakibatkan
kegagalan.
1. Modul yang tidak ditandatangani menggunakan simbol yang dilindungi
File module.ko adalah modul vendor yang tidak ditandatangani dan mencoba me-resolve
simbol some_kernel_function yang diekspor modul GKI selama pemuatan, tanpa
tercantum dalam daftar simbol vendor.
Penyelesaian:
Jika module.ko bukan modul GKI yang dilindungi, memperbarui daftar simbol akan
menyelesaikan error dengan menyertakan some_kernel_function dalam daftar simbol vendor.
Atau, gunakan module.ko versi GKI.
2. Modul yang tidak ditandatangani yang mengekspor simbol yang dilindungi
Error:
module: exports protected symbol some_kernel_function
Penyebab:
Modul yang mengekspor some_kernel_function adalah modul GKI yang dilindungi, dan
module.ko kemungkinan adalah versi kustom yang tidak ditandatangani dari modul tersebut. Saat
module.ko mencoba mengekspor some_kernel_function, yang hanya dapat diekspor
oleh modul GKI yang ditandatangani, pemuatan akan gagal dengan pesan ini.
Penyelesaian:
Hal ini dapat diperbaiki dengan menggunakan versi GKI modul yang mengekspor
some_kernel_function, jika modul yang tidak ditandatangani adalah versi kustom.
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-27 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."]]