A partire dal 27 marzo 2025, ti consigliamo di utilizzare android-latest-release anziché aosp-main per compilare e contribuire ad AOSP. Per ulteriori informazioni, vedi Modifiche ad AOSP.
Configura le funzionalità del kernel come moduli GKI
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa pagina spiega come configurare una nuova funzionalità del kernel come modulo GKI o come configurare una funzionalità del kernel integrata esistente come modulo GKI.
Configurare una nuova funzionalità come modulo GKI
Per la nuova funzionalità, modifica gki_defconfig e imposta l'elemento di configurazione della funzionalità del kernel richiesta da n a m (=m). Imposta questa impostazione sia in arch/arm64/configs/gki_defconfig che in arch/x86/configs/gki_defconfig.
Aggiungi i file KO (.ko) generati per la funzionalità alla sezione COMMON_GKI_MODULES_LIST di common/modules.bzl. Aggiungi i
file in un ordine ordinato. Se hai dubbi su tutti i file generati, la compilazione non va a buon fine e vengono elencati tutti i file KO necessari da aggiungere all'elenco.
Per Android 14, aggiungi lo stesso insieme di file KO del passaggio 2, ordinati in ordine crescente per la ricerca binaria in fase di esecuzione, acommon/android/gki_{ARCH}_protected_modules per designare il modulo come modulo GKI protetto.
Per Android 14 e 15, aggiorna l'elenco delle esportazioni in modo che includa quelle appena aggiunte in common/android/abi_gki_protected_exports_ARCHITECTURE. Ad esempio, per aggiornare l'elenco, esegui
tools/bazel run //common:kernel_aarch64_abi_update_protected_exports per
aarch64.
Assicurati che i file KO appena aggiunti nel passaggio 2 vengano copiati in out/<androidX-Y.Z>/dist/system_dlkm.img e out/androidX-Y.Z/dist/system_dlkm_staging_archive.tar.gz del kernel.
I moduli nell'archivio system_dlkm_staging_archive.tar.gz possono essere utilizzati come input per generare il file system_dlkm.img nella compilazione della piattaforma.
Invia le modifiche per la revisione. I moduli GKI sono una funzionalità del kernel solo per Android, pertanto non è necessario inviare patch di conversione dei moduli upstream. Tuttavia, devi seguire altre linee guida per inviare
patch per il kernel Android Common (ACK).
Configurare una funzionalità integrata del kernel come modulo GKI
Per una funzionalità del kernel integrata esistente, modifica gki_defconfig e imposta l'elemento di configurazione della funzionalità del kernel richiesta da y a m (=m). Imposta questa impostazione sia in arch/arm64/configs/gki_defconfig sia in arch/x86/configs/gki_defconfig.
Aggiungi i file KO (.ko) generati per la funzionalità alla sezione COMMON_GKI_MODULES_LIST di common/modules.bzl. Aggiungi i file
in un ordine ordinato. Se hai dubbi su tutti i file generati, la compilazione non va a buon fine e vengono elencati tutti i file KO necessari da aggiungere all'elenco.
Per Android 14, aggiungi lo stesso insieme di file KO del passaggio 2, ordinati in ordine crescente per la ricerca binaria in fase di esecuzione, acommon/android/gki_{ARCH}_protected_modules per designare il modulo come modulo GKI protetto.
Per Android 14 e 15, aggiorna l'elenco delle esportazioni protette in modo da includere quelle del modulo appena aggiunto in common/android/abi_gki_protected_exports_{ARCH} utilizzando tools/bazel run
//common:kernel_aarch64_abi_update_protected_exports per aarch64.
Assicurati che i file KO del modulo appena convertiti del passaggio 2 vengano copiati in out/<androidX-Y.Z>/dist/system_dlkm.img e out/androidX-Y.Z/dist/system_dlkm_staging_archive.tar.gz del kernel.
I moduli nell'archivio system_dlkm_staging_archive.tar.gz possono essere utilizzati come input per generare il file system_dlkm.img nella compilazione della piattaforma.
Invia le modifiche per la revisione. I moduli GKI sono una funzionalità del kernel solo per Android, pertanto non è necessario inviare patch di conversione dei moduli upstream. Tuttavia, devi seguire le altre linee guida per inviare
patch per il kernel Android Common (ACK).
Convertire un modulo GKI protetto in non protetto
Per Android 15 e versioni successive, aggiungi il modulo da convertire da protetto a unprotected all'elenco COMMON_UNPROTECTED_MODULES_LIST nel file common/modules.bzl.
Per Android 14, rimuovi il modulo di cui vuoi eseguire la conversione da protetto a non protetto dall'elenco dei moduli protetti all'indirizzo
common/android/gki_protected_modules.
Per Android 14 e 15, aggiorna l'elenco delle esportazioni protette per escludere quelle del modulo non protetto appena convertito in common/android/abi_gki_protected_exports_{ARCH} utilizzando tools/bazel run
//common:kernel_aarch64_abi_update_protected_exports per aarch64.
Invia le modifiche per la revisione. I moduli GKI sono una funzionalità del kernel solo per Android, pertanto non è necessario inviare patch di conversione dei moduli upstream. Tuttavia, devi seguire le altre linee guida per inviare
patch per il kernel Android Common (ACK).
Guida rapida alla risoluzione delle violazioni dei simboli dei moduli GKI
Quando i moduli non firmati violano la protezione dei simboli in vigore per i moduli GKI, durante il caricamento dei moduli possono verificarsi due tipi di errori che causano un fallimento.
1. Modulo non firmato che utilizza il simbolo protetto
Il file module.ko è un modulo del fornitore non firmato e tenta di risolvere il simbolo some_kernel_function esportato dal modulo GKI durante il caricamento, senza essere elencato nell'elenco dei simboli del fornitore.
Risoluzione:
Se module.ko non è un modulo GKI protetto, l'aggiornamento dell'elenco dei simboli risolverà l'errore includendo some_kernel_function nell'elenco dei simboli del fornitore.
In alternativa, utilizza la versione GKI di module.ko.
2. Modulo non firmato che esporta il simbolo protetto
Errore:
module: exports protected symbol some_kernel_function
Causa:
Il modulo che esporta some_kernel_function è un modulo GKI protetto e module.ko è probabilmente una versione personalizzata non firmata di quel modulo. Quando
module.ko tenta di esportare some_kernel_function, che può essere esportato solo
da un modulo GKI firmato, il caricamento non va a buon fine con questo messaggio.
Risoluzione:
Questo problema può essere corretto utilizzando la versione GKI del modulo che esportasome_kernel_function, se il modulo non firmato è una versione personalizzata.
I campioni di contenuti e codice in questa pagina sono soggetti alle licenze descritte nella Licenza per i contenuti. Java e OpenJDK sono marchi o marchi registrati di Oracle e/o delle sue società consociate.
Ultimo aggiornamento 2025-07-27 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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."]]