Configure kernel features as GKI modules

Stay organized with collections Save and categorize content based on your preferences.

This page covers how to configure a new kernel feature as a GKI module or configure an existing built-in kernel feature as a GKI module.

Configure a new feature as a GKI module

  1. For the new feature, edit gki_defconfig and set the required kernel feature’s config item from n to m (=m). Set this setting in both arch/arm64/configs/gki_defconfig and arch/x86/configs/gki_defconfig.

  2. Add the KO (.ko) files generated for the feature to the COMMON_GKI_MODULES_LIST section of common/modules.bzl. Add the files in a sorted order. If you're unsure of all the files generated, the build fails and lists all the necessary KO files to be added to the list.

  3. Add the same set of KO files from step 2, sorted in ascending order for binary search at runtime, to common/android/gki_protected_modules to designate the module as a protected GKI module. Modules designated as protected GKI modules still must be approved by Google to be official protected modules.

  4. Add the same set of KO files from step 2, sorted in ascending order for binary search at runtime, to common/android/gki_system_dlkm_modules to ensure the files are copied to the kernel's out/<androidX-Y.Z>/dist/system_dlkm.img and out/androidX-Y.Z/dist/system_dlkm_staging_archive.tar.gz. Modules in the system_dlkm_staging_archive.tar.gz archive can be used as input to generate the system_dlkm.img in the platform build.

  5. Submit your changes for review. GKI modules are an Android-only kernel feature, so module conversion patches aren't required to be submitted upstream. However, you must follow other guidelines to submit Android Common Kernel (ACK) patches.

Configure a kernel built-in feature as a GKI module

  1. For an existing built-in kernel feature, edit gki_defconfig and set the required kernel feature’s config item from y to m (=m). Set this setting in both arch/arm64/configs/gki_defconfig and arch/x86/configs/gki_defconfig.

  2. Add the KO (.ko) files generated for the feature to the COMMON_GKI_MODULES_LIST section of common/modules.bzl. Add the files in a sorted order. If you're unsure of all the files generated, the build fails and lists all the necessary KO files to be added to the list.

  3. Add the same set of KO files from step 2, sorted in ascending order for binary search at runtime, to common/android/gki_protected_modules to designate the module as a protected GKI module. Modules designated as protected GKI modules still must be approved by Google to be official protected modules.

  4. Add the same set of KO files from step 2, sorted in ascending order for binary search at runtime, to common/android/gki_system_dlkm_modules to ensure the files are copied to the kernel's out/<androidX-Y.Z>/dist/system_dlkm.img and out/androidX-Y.Z/dist/system_dlkm_staging_archive.tar.gz. Modules in the system_dlkm_staging_archive.tar.gz archive can be used as input to generate the system_dlkm.img in the platform build.

  5. Submit your changes for review. GKI modules are an Android-only kernel feature, so module conversion patches aren't required to be submitted upstream. However, you must follow the other guidelines to submit Android Common Kernel (ACK) patches.