ANDROID: bazel: add GKI consolidate Bazel build
Adds //common:kernel_aarch64_consolidate Bazel build target. Bug: 255878221 Change-Id: I76b44a2764d461d6267ff217e8914298fe560544 Signed-off-by: John Moon <quic_johmoo@quicinc.com>
This commit is contained in:
parent
02b7e8655b
commit
7a0536d5a0
@ -245,6 +245,10 @@ define_db845c(
|
||||
],
|
||||
)
|
||||
|
||||
load(":consolidate.bzl", "define_consolidate")
|
||||
|
||||
define_consolidate()
|
||||
|
||||
# TODO(b/258259749): Convert rockpi4 to mixed build
|
||||
kernel_build(
|
||||
name = "rockpi4",
|
||||
|
@ -1,3 +1,4 @@
|
||||
KERNEL_DIR=common
|
||||
DEFCONFIG=consolidate_defconfig
|
||||
FRAGMENT_CONFIG=${KERNEL_DIR}/arch/arm64/configs/consolidate.fragment
|
||||
PRE_DEFCONFIG_CMDS="KCONFIG_CONFIG=${ROOT_DIR}/${KERNEL_DIR}/arch/arm64/configs/${DEFCONFIG} ${ROOT_DIR}/${KERNEL_DIR}/scripts/kconfig/merge_config.sh -m -r ${ROOT_DIR}/${KERNEL_DIR}/arch/arm64/configs/gki_defconfig ${ROOT_DIR}/${FRAGMENT_CONFIG}"
|
||||
|
62
consolidate.bzl
Normal file
62
consolidate.bzl
Normal file
@ -0,0 +1,62 @@
|
||||
load(
|
||||
"//build/kernel/kleaf:kernel.bzl",
|
||||
"kernel_build",
|
||||
"kernel_build_config",
|
||||
"kernel_images",
|
||||
"kernel_modules_install",
|
||||
)
|
||||
load("//build/kernel/kleaf:constants.bzl", "aarch64_outs")
|
||||
|
||||
rule_base = "kernel_aarch64_consolidate"
|
||||
|
||||
def _gen_config_without_source_lines(build_config, target):
|
||||
rule_name = "{}.{}".format(target, build_config)
|
||||
out_file_name = rule_name + ".generated"
|
||||
native.genrule(
|
||||
name = rule_name,
|
||||
srcs = [build_config],
|
||||
outs = [out_file_name],
|
||||
cmd_bash = "sed -e '/^\\. /d' $(location {}) > $@".format(build_config),
|
||||
)
|
||||
|
||||
return ":" + rule_name
|
||||
|
||||
def define_consolidate():
|
||||
kernel_build_config(
|
||||
name = rule_base + "_build_config",
|
||||
srcs = [
|
||||
# do not sort
|
||||
"build.config.constants",
|
||||
_gen_config_without_source_lines("build.config.common", rule_base),
|
||||
"build.config.aarch64",
|
||||
"build.config.gki_consolidate.aarch64",
|
||||
_gen_config_without_source_lines("build.config.gki.aarch64", rule_base),
|
||||
],
|
||||
)
|
||||
|
||||
kernel_build(
|
||||
name = rule_base,
|
||||
outs = aarch64_outs,
|
||||
implicit_outs = [
|
||||
"scripts/sign-file",
|
||||
"certs/signing_key.pem",
|
||||
"certs/signing_key.x509",
|
||||
],
|
||||
module_implicit_outs = [
|
||||
"drivers/block/zram/zram.ko",
|
||||
"mm/zsmalloc.ko",
|
||||
],
|
||||
build_config = rule_base + "_build_config",
|
||||
)
|
||||
|
||||
kernel_modules_install(
|
||||
name = "{}_modules_install".format(rule_base),
|
||||
kernel_build = ":{}".format(rule_base),
|
||||
)
|
||||
|
||||
kernel_images(
|
||||
name = "{}_images".format(rule_base),
|
||||
kernel_build = ":{}".format(rule_base),
|
||||
build_system_dlkm = True,
|
||||
kernel_modules_install = ":{}_modules_install".format(rule_base),
|
||||
)
|
Loading…
Reference in New Issue
Block a user