diff options
author | Ramji Jiyani <ramjiyani@google.com> | 2022-10-06 13:56:53 -0700 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2022-10-27 16:41:54 -0700 |
commit | db399f6befedb2b312606635d2e4fe455408897c (patch) | |
tree | 9a1106b9a2edd6d3b60e7c7d6f479b8fe21e62d2 | |
parent | 9f9086cf6f864a796fa1127674b64245f76ba74a (diff) | |
download | build-android-gs-bluejay-5.10-android13-qpr1.tar.gz |
kleaf: extract_symbol with GKI modules objectsandroid-t-qpr2-beta-2_r0.5android-t-qpr2-beta-2_r0.4android-t-qpr2-beta-2_r0.3android-t-qpr2-beta-1_r0.6android-t-qpr2-beta-1_r0.5android-t-qpr2-beta-1_r0.4android-13.0.0_r0.76android-13.0.0_r0.60android-13.0.0_r0.59android-13.0.0_r0.58android-13.0.0_r0.55android-13.0.0_r0.54android-13.0.0_r0.53android-gs-raviole-5.10-t-qpr2-beta-1android-gs-raviole-5.10-android13-qpr1android-gs-pantah-5.10-t-qpr2-beta-1android-gs-pantah-5.10-android13-qpr1android-gs-lynx-5.10-android13-d4android-gs-bluejay-5.10-t-qpr2-beta-1android-gs-bluejay-5.10-android13-qpr1
Due to change f67eea6aa43b30326960b39fe5f4c99c1519b86a
(kleaf: Do not include GKI modules in default output of
//common:kernel_aarch64.) and relevant changes, GKI modules
are no longer listed as default outputs of the GKI kernel
//common:kernel_aarch64, causing the `in_tree_modules` list
to be empty in extracted_symbols rule. Backporting this change
fixes the issue by also extracting the full modules_staging_dir,
which contains all GKI modules.
Bug: 246716067
Test: manual (bazel run //common:kernel_aarch64_abi_update_symbol_list,
see no change)
Signed-off-by: Yifan Hong <elsk@google.com>
----
Original commit message:
To partition between GKI and vendor modules on the fly;
we need to pass GKI modules from the base_kernel build
in addition to vendor modules. Remove passing the list
and pass the modules instead from the base_kernel
first and then the vendor modules overwriting the modules
from the base build being overridden.
Bug: 245404948
Bug: 232431411
Test: TH
Signed-off-by: Ramji Jiyani <ramjiyani@google.com>
Change-Id: I2f40943d0d4f0a65cc7ab47a5064caff7fbf39b4
-rw-r--r-- | kleaf/impl/abi/extracted_symbols.bzl | 16 | ||||
-rw-r--r-- | kleaf/impl/abi/kernel_build_abi.bzl | 1 | ||||
-rw-r--r-- | kleaf/impl/common_providers.bzl | 1 | ||||
-rw-r--r-- | kleaf/impl/kernel_build.bzl | 1 | ||||
-rw-r--r-- | kleaf/impl/kernel_filegroup.bzl | 5 |
5 files changed, 22 insertions, 2 deletions
diff --git a/kleaf/impl/abi/extracted_symbols.bzl b/kleaf/impl/abi/extracted_symbols.bzl index 044096b..c78ca5b 100644 --- a/kleaf/impl/abi/extracted_symbols.bzl +++ b/kleaf/impl/abi/extracted_symbols.bzl @@ -65,10 +65,22 @@ def _extracted_symbols_impl(ctx): out = out.path, ) + # Get the signed and stripped module archive for the GKI modules + base_modules_archive = ctx.attr.kernel_build_for_base_modules[KernelBuildAbiInfo].modules_staging_archive + inputs.append(base_modules_archive) + command = ctx.attr.kernel_build_notrim[KernelEnvInfo].setup command += """ mkdir -p {intermediates_dir} - cp -pl {srcs} {intermediates_dir} + # Extract archive and copy the GKI modules First + # TODO(/b/243570975): Use tar wildcards & xform once prebuilt supports it, as below: + # tar --directory={intermediates_dir} --wildcards --xform='s#^.+/##x' -xf {base_modules_archive} '*.ko + mkdir -p {intermediates_dir}/temp + tar xf {base_modules_archive} -C {intermediates_dir}/temp + find {intermediates_dir}/temp -name '*.ko' -exec mv -t {intermediates_dir} {{}} \\; + rm -rf {intermediates_dir}/temp + # Copy other inputs including vendor modules; this will overwrite modules being overridden + cp -pfl {srcs} {intermediates_dir} {cp_src_cmd} {extract_symbols} {flags} {intermediates_dir} rm -rf {intermediates_dir} @@ -78,6 +90,7 @@ def _extracted_symbols_impl(ctx): extract_symbols = ctx.file._extract_symbols.path, flags = " ".join(flags), cp_src_cmd = cp_src_cmd, + base_modules_archive = base_modules_archive.path, ) debug.print_scripts(ctx, command) ctx.actions.run_shell( @@ -103,6 +116,7 @@ extracted_symbols = rule( "src": attr.label(doc = "Source `abi_gki_*` file. Used when `kmi_symbol_list_add_only`.", allow_single_file = True), "kmi_symbol_list_add_only": attr.bool(), "gki_modules_list_kernel_build": attr.label(doc = "The `kernel_build` which `module_outs` is treated as GKI modules list.", providers = [KernelBuildAbiInfo]), + "kernel_build_for_base_modules": attr.label(doc = "The `kernel_build` which `modules_staging_archive` is treated as GKI modules.", providers = [KernelBuildAbiInfo]), "_extract_symbols": attr.label(default = "//build/kernel:abi/extract_symbols", allow_single_file = True), "_debug_print_scripts": attr.label(default = "//build/kernel/kleaf:debug_print_scripts"), }, diff --git a/kleaf/impl/abi/kernel_build_abi.bzl b/kleaf/impl/abi/kernel_build_abi.bzl index a0f9712..4cc3d78 100644 --- a/kleaf/impl/abi/kernel_build_abi.bzl +++ b/kleaf/impl/abi/kernel_build_abi.bzl @@ -280,6 +280,7 @@ def _define_abi_targets( # modules list from base_kernel (GKI). If base_kernel is not set, this # likely a GKI build, so use modules_outs from itself. gki_modules_list_kernel_build = kernel_build_kwargs.get("base_kernel", name), + kernel_build_for_base_modules = kernel_build_kwargs.get("base_kernel", name), ) update_source_file( name = name + "_abi_update_symbol_list", diff --git a/kleaf/impl/common_providers.bzl b/kleaf/impl/common_providers.bzl index e5fa786..6ff8612 100644 --- a/kleaf/impl/common_providers.bzl +++ b/kleaf/impl/common_providers.bzl @@ -71,6 +71,7 @@ KernelBuildAbiInfo = provider( "trim_nonlisted_kmi": "Value of `trim_nonlisted_kmi` in [`kernel_build()`](#kernel_build).", "combined_abi_symbollist": "The **combined** `abi_symbollist` file from the `_kmi_symbol_list` rule, consist of the source `kmi_symbol_list` and `additional_kmi_symbol_lists`.", "module_outs_file": "A file containing `[kernel_build.module_outs]`(#kernel_build-module_outs) and `[kernel_build.module_implicit_outs]`(#kernel_build-module_implicit_outs).", + "modules_staging_archive": "Archive containing staging kernel modules. ", }, ) diff --git a/kleaf/impl/kernel_build.bzl b/kleaf/impl/kernel_build.bzl index 809c142..d62cbd7 100644 --- a/kleaf/impl/kernel_build.bzl +++ b/kleaf/impl/kernel_build.bzl @@ -820,6 +820,7 @@ def _kernel_build_impl(ctx): trim_nonlisted_kmi = ctx.attr.trim_nonlisted_kmi, combined_abi_symbollist = ctx.file.combined_abi_symbollist, module_outs_file = all_module_names_file, + modules_staging_archive = modules_staging_archive, ) # Device modules takes precedence over base_kernel (GKI) modules. diff --git a/kleaf/impl/kernel_filegroup.bzl b/kleaf/impl/kernel_filegroup.bzl index 0e4e8e1..802d986 100644 --- a/kleaf/impl/kernel_filegroup.bzl +++ b/kleaf/impl/kernel_filegroup.bzl @@ -83,7 +83,10 @@ def _kernel_filegroup_impl(ctx): directories = depset([unstripped_dir], order = "postorder"), ) - abi_info = KernelBuildAbiInfo(module_outs_file = ctx.file.module_outs_file) + abi_info = KernelBuildAbiInfo( + module_outs_file = ctx.file.module_outs_file, + modules_staging_archive = utils.find_file(MODULES_STAGING_ARCHIVE, all_deps, what = ctx.label), + ) in_tree_modules_info = KernelBuildInTreeModulesInfo(module_outs_file = ctx.file.module_outs_file) images_info = KernelImagesInfo(base_kernel = None) |