diff options
author | Yifan Hong <elsk@google.com> | 2022-10-21 16:11:10 -0700 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2022-10-21 23:18:47 +0000 |
commit | ec70fd4cbe516039b1a2504cfcd1662cf7c6616a (patch) | |
tree | 5373fbf81a45292e344b4d49905ddfb33fd76031 | |
parent | e2ab01bda43b1fa299471c435f774710c13a7018 (diff) | |
download | build-ec70fd4cbe516039b1a2504cfcd1662cf7c6616a.tar.gz |
kleaf: ABI add MAKE_GOALS += vmlinux
Always add vmlinux to MAKE_GOALS for ABI targets. Otherwise,
it is not built without the existence of base_kernel.
Test: build slider_abi_dist
Bug: 254328713
Change-Id: Ib720e21dcd28fa4e8703787c7938a516902779e6
-rw-r--r-- | kleaf/impl/abi/kernel_build_abi.bzl | 2 | ||||
-rw-r--r-- | kleaf/impl/kernel_build.bzl | 6 | ||||
-rw-r--r-- | kleaf/impl/kernel_env.bzl | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/kleaf/impl/abi/kernel_build_abi.bzl b/kleaf/impl/abi/kernel_build_abi.bzl index d51cb99..a0f9712 100644 --- a/kleaf/impl/abi/kernel_build_abi.bzl +++ b/kleaf/impl/abi/kernel_build_abi.bzl @@ -174,6 +174,7 @@ def _define_other_targets( with_vmlinux_kwargs = dict(kernel_build_kwargs) with_vmlinux_kwargs["outs"] = kernel_utils.transform_kernel_build_outs(name + "_with_vmlinux", "outs", new_outs) with_vmlinux_kwargs["base_kernel_for_module_outs"] = with_vmlinux_kwargs.pop("base_kernel", default = None) + with_vmlinux_kwargs["internal_additional_make_goals"] = ["vmlinux"] kernel_build(name = name + "_with_vmlinux", **with_vmlinux_kwargs) else: native.alias(name = name + "_with_vmlinux", actual = name) @@ -262,6 +263,7 @@ def _define_abi_targets( notrim_kwargs["trim_nonlisted_kmi"] = False notrim_kwargs["kmi_symbol_list_strict_mode"] = False notrim_kwargs["base_kernel_for_module_outs"] = notrim_kwargs.pop("base_kernel", default = None) + notrim_kwargs["internal_additional_make_goals"] = ["vmlinux"] kernel_build(name = name + "_notrim", **notrim_kwargs) else: native.alias(name = name + "_notrim", actual = name) diff --git a/kleaf/impl/kernel_build.bzl b/kleaf/impl/kernel_build.bzl index 2d29166..0c521ab 100644 --- a/kleaf/impl/kernel_build.bzl +++ b/kleaf/impl/kernel_build.bzl @@ -68,6 +68,7 @@ def kernel_build( deps = None, base_kernel = None, base_kernel_for_module_outs = None, + internal_additional_make_goals = None, kconfig_ext = None, dtstree = None, kmi_symbol_list = None, @@ -134,6 +135,10 @@ def kernel_build( If set, this is used instead of `base_kernel` to determine the list of GKI modules. + + internal_additional_make_goals: **INTERNAL ONLY; DO NOT SET!** + + List of items added to `MAKE_GOALS`. generate_vmlinux_btf: If `True`, generates `vmlinux.btf` that is stripped of any debug symbols, but contains type and symbol information within a .BTF section. This is suitable for ABI analysis through BTF. @@ -356,6 +361,7 @@ def kernel_build( srcs = srcs, toolchain_version = toolchain_version, kbuild_symtypes = kbuild_symtypes, + internal_additional_make_goals = internal_additional_make_goals, **internal_kwargs ) diff --git a/kleaf/impl/kernel_env.bzl b/kleaf/impl/kernel_env.bzl index 24b6fe3..6af722a 100644 --- a/kleaf/impl/kernel_env.bzl +++ b/kleaf/impl/kernel_env.bzl @@ -126,12 +126,15 @@ def _kernel_env_impl(ctx): source {build_utils_sh} export BUILD_CONFIG={build_config} source {setup_env} + # Add to MAKE_GOALS if necessary + export MAKE_GOALS="${{MAKE_GOALS}} {internal_additional_make_goals}" # capture it as a file to be sourced in downstream rules {preserve_env} > {out} """.format( build_utils_sh = ctx.file._build_utils_sh.path, build_config = build_config.path, setup_env = setup_env.path, + internal_additional_make_goals = " ".join(ctx.attr.internal_additional_make_goals), preserve_env = preserve_env.path, out = out_file.path, ) @@ -290,6 +293,7 @@ kernel_env = rule( default = "auto", values = ["true", "false", "auto"], ), + "internal_additional_make_goals": attr.string_list(), "_tools": attr.label_list(default = _get_tools), "_hermetic_tools": attr.label(default = "//build/kernel:hermetic-tools", providers = [HermeticToolsInfo]), "_build_utils_sh": attr.label( |