Functions that are useful in the common kernel package (usually //common).

common_kernel_protected_module_names


load("@kleaf//build/kernel/kleaf:common_kernels.bzl", "common_kernel_protected_module_names") common_kernel_protected_module_names(<a href="#common_kernel_protected_module_names-name">name</a>, <a href="#common_kernel_protected_module_names-out">out</a>, <a href="#common_kernel_protected_module_names-exclude">exclude</a>, <a href="#common_kernel_protected_module_names-module_names">module_names</a>)

Build protected_module_names file for a common kernel.

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
out-Stringrequired
exclude-List of stringsoptional[]
module_names-List of stringsoptional[]

common_kernel


load("@kleaf//build/kernel/kleaf:common_kernels.bzl", "common_kernel") common_kernel(<a href="#common_kernel-name">name</a>, <a href="#common_kernel-outs">outs</a>, <a href="#common_kernel-makefile">makefile</a>, <a href="#common_kernel-arch">arch</a>, <a href="#common_kernel-visibility">visibility</a>, <a href="#common_kernel-defconfig">defconfig</a>, <a href="#common_kernel-check_defconfig">check_defconfig</a>, <a href="#common_kernel-pre_defconfig_fragments">pre_defconfig_fragments</a>, <a href="#common_kernel-post_defconfig_fragments">post_defconfig_fragments</a>, <a href="#common_kernel-kmi_symbol_list">kmi_symbol_list</a>, <a href="#common_kernel-additional_kmi_symbol_lists">additional_kmi_symbol_lists</a>, <a href="#common_kernel-trim_nonlisted_kmi">trim_nonlisted_kmi</a>, <a href="#common_kernel-kmi_symbol_list_strict_mode">kmi_symbol_list_strict_mode</a>, <a href="#common_kernel-kmi_symbol_list_add_only">kmi_symbol_list_add_only</a>, <a href="#common_kernel-module_implicit_outs">module_implicit_outs</a>, <a href="#common_kernel-modules_superset">modules_superset</a>, <a href="#common_kernel-protected_module_names_list">protected_module_names_list</a>, <a href="#common_kernel-gki_system_dlkm_modules">gki_system_dlkm_modules</a>, <a href="#common_kernel-make_goals">make_goals</a>, <a href="#common_kernel-abi_definition_stg">abi_definition_stg</a>, <a href="#common_kernel-kmi_enforced">kmi_enforced</a>, <a href="#common_kernel-build_gki_artifacts">build_gki_artifacts</a>, <a href="#common_kernel-gki_boot_img_sizes">gki_boot_img_sizes</a>, <a href="#common_kernel-page_size">page_size</a>, <a href="#common_kernel-deprecation">deprecation</a>, <a href="#common_kernel-ddk_headers_archive">ddk_headers_archive</a>, <a href="#common_kernel-ddk_module_headers">ddk_module_headers</a>, <a href="#common_kernel-extra_dist">extra_dist</a>, <a href="#common_kernel-kcflags">kcflags</a>, <a href="#common_kernel-system_dlkm_extra_archive_files">system_dlkm_extra_archive_files</a>, <a href="#common_kernel-clang_autofdo_profile">clang_autofdo_profile</a>, <a href="#common_kernel-generated_headers_for_module">generated_headers_for_module</a>)

Macro for an Android Common Kernel.

The following targets are declared as public API:

  • <name>_sources (e.g. kernel_aarch64_sources)
    • Convenience filegroups that refers to all sources required to build <name> and related targets.
  • <name> (e.g. kernel_aarch64): kernel_build()
    • This build the main kernel build artifacts, e.g. vmlinux, etc.
  • <name>_uapi_headers (e.g. kernel_aarch64_uapi_headers)
    • build kernel-uapi-headers.tar.gz.
  • <name>_modules (e.g. kernel_aarch64_modules)
  • <name>_additional_artifacts (e.g. kernel_aarch64_additional_artifacts)
    • contains additional artifacts that may be added to a distribution. This includes:
      • Images, including system_dlkm, etc.
      • kernel-headers.tar.gz
  • <name>_dist (e.g. kernel_aarch64_dist)
    • can be run to obtain a distribution outside the workspace.

ABI monitoring If kmi_symbol_list is set, ABI monitoring is turned on.

  • <name>_abi (e.g. kernel_aarch64_abi): kernel_abi()
  • <name>_abi_dist (e.g. kernel_aarch64_abi_dist)

Usually, for ABI monitoring to be fully turned on, you should set:

  • kmi_symbol_list
  • additional_kmi_symbol_lists
  • trim_nonlisted_kmi to True
  • kmi_symbol_list_strict_mode to True
  • abi_definition_stg to the ABI definition
  • kmi_enforced to True

PARAMETERS

NameDescriptionDefault Value
namename of the kernel_build().none
outsSee kernel_build.outsnone
makefileSee kernel_build.makefileNone
archSee kernel_build.archNone
visibilitydefault visibility for some targets instantiated with this macroNone
defconfigSee kernel_build.defconfigNone
check_defconfigNon-configurable. See kernel_build.check_defconfig.

If value is None, default value is the following: - If --gki_build_config_fragment is set, default is “disabled”. - Otherwise: - If pre_defconfig_fragments is set, default is “match”. - Otherwise, default is “minimized”.
None
pre_defconfig_fragmentsSee kernel_build.pre_defconfig_fragmentsNone
post_defconfig_fragmentsSee kernel_build.post_defconfig_fragmentsNone
kmi_symbol_listSee kernel_build.kmi_symbol_listNone
additional_kmi_symbol_listsSee kernel_build.additional_kmi_symbol_listsNone
trim_nonlisted_kmiSee kernel_build.trim_nonlisted_kmiNone
kmi_symbol_list_strict_modeSee kernel_build.kmi_symbol_list_strict_modeNone
kmi_symbol_list_add_onlySee kernel_abi.kmi_symbol_list_add_onlyNone
module_implicit_outsSee kernel_build.module_implicit_outsNone
modules_supersetnonconfigurable. The superset of modules targets to create. This should contain all modules in each branch in the select() of module_implicit_outs.

The first module must not be in any conditional branch.
None
protected_module_names_listSee kernel_config.protected_module_names_listNone
gki_system_dlkm_modulessystem_dlkm module_listNone
make_goalsSee kernel_build.make_goalsNone
abi_definition_stgSee kernel_abi.abi_definition_stgNone
kmi_enforcedSee kernel_abi.kmi_enforcedNone
build_gki_artifactsnonconfigurable. If true, build GKI artifacts under target name <name>_gki_artifacts.None
gki_boot_img_sizesgki_artifacts.boot_img_sizesNone
page_sizeSee kernel_build.page_sizeNone
deprecationIf set, mark target deprecated with given message.None
ddk_headers_archivenonconfigurable. Target to the archive packing DDK headersNone
ddk_module_headersSee kernel_build.ddk_module_headersNone
extra_distextra targets added to <name>_distNone
kcflagskernel_build.kcflagsNone
system_dlkm_extra_archive_filessystem_dlkm_image.internal_extra_archive_filesNone
clang_autofdo_profileSee kernel_build.clang_autofdo_profileNone
generated_headers_for_moduleSee kernel_build.generated_headers_for_moduleNone