From 9a399ca7133e2747eb6155f6c9621e3bdfb1f9e1 Mon Sep 17 00:00:00 2001 From: Ulises Mendez Martinez Date: Mon, 7 Aug 2023 12:42:40 +0000 Subject: [PATCH] ANDROID: Add arch specific gki module list targets * This is a no-op change preparing for the split of target and files based on the architecture used. Bug: 293529933 Change-Id: I7783b60e591aaad23b5446af5cb04af5765f4b3f Signed-off-by: Ulises Mendez Martinez --- BUILD.bazel | 48 ++++++++++++++++++++++++++++++++++++++---------- modules.bzl | 42 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 79 insertions(+), 11 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index a75b0775c50f..ae4e71ea7624 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -14,7 +14,7 @@ load( "kernel_modules_install", "merged_kernel_uapi_headers", ) -load(":modules.bzl", "COMMON_GKI_MODULES_LIST") +load(":modules.bzl", "get_gki_modules_list") package( default_visibility = [ @@ -46,10 +46,38 @@ checkpatch( checkpatch_pl = "scripts/checkpatch.pl", ) +# Deprecated - Use arch specific files from below. write_file( name = "gki_system_dlkm_modules", out = "android/gki_system_dlkm_modules", - content = COMMON_GKI_MODULES_LIST + [ + content = get_gki_modules_list("arm64") + [ + # Ensure new line at the end. + "", + ], +) + +write_file( + name = "gki_system_dlkm_modules_arm64", + out = "android/gki_system_dlkm_modules_arm64", + content = get_gki_modules_list("arm64") + [ + # Ensure new line at the end. + "", + ], +) + +write_file( + name = "gki_system_dlkm_modules_x86_64", + out = "android/gki_system_dlkm_modules_x86_64", + content = get_gki_modules_list("x86_64") + [ + # Ensure new line at the end. + "", + ], +) + +write_file( + name = "gki_system_dlkm_modules_risc64", + out = "android/gki_system_dlkm_modules_riscv64", + content = get_gki_modules_list("riscv64") + [ # Ensure new line at the end. "", ], @@ -81,7 +109,7 @@ filegroup( define_common_kernels(target_configs = { "kernel_aarch64": { "kmi_symbol_list_strict_mode": True, - "module_implicit_outs": COMMON_GKI_MODULES_LIST, + "module_implicit_outs": get_gki_modules_list("arm64"), "kmi_symbol_list": "android/abi_gki_aarch64", "kmi_symbol_list_add_only": True, "additional_kmi_symbol_lists": [":aarch64_additional_kmi_symbol_lists"], @@ -91,12 +119,12 @@ define_common_kernels(target_configs = { }, "kernel_aarch64_16k": { "kmi_symbol_list_strict_mode": False, - "module_implicit_outs": COMMON_GKI_MODULES_LIST, + "module_implicit_outs": get_gki_modules_list("arm64"), "make_goals": _GKI_AARCH64_MAKE_GOALS, }, "kernel_aarch64_debug": { "kmi_symbol_list_strict_mode": False, - "module_implicit_outs": COMMON_GKI_MODULES_LIST, + "module_implicit_outs": get_gki_modules_list("arm64"), "kmi_symbol_list": "android/abi_gki_aarch64", "kmi_symbol_list_add_only": True, "additional_kmi_symbol_lists": [":aarch64_additional_kmi_symbol_lists"], @@ -106,19 +134,19 @@ define_common_kernels(target_configs = { }, "kernel_riscv64": { "kmi_symbol_list_strict_mode": False, - "module_implicit_outs": COMMON_GKI_MODULES_LIST, + "module_implicit_outs": get_gki_modules_list("riscv64"), "make_goals": _GKI_RISCV64_MAKE_GOALS, }, "kernel_x86_64": { "kmi_symbol_list_strict_mode": False, - "module_implicit_outs": COMMON_GKI_MODULES_LIST, + "module_implicit_outs": get_gki_modules_list("x86_64"), "protected_exports_list": "android/abi_gki_protected_exports_x86_64", "protected_modules_list": "android/gki_x86_64_protected_modules", "make_goals": _GKI_X86_64_MAKE_GOALS, }, "kernel_x86_64_debug": { "kmi_symbol_list_strict_mode": False, - "module_implicit_outs": COMMON_GKI_MODULES_LIST, + "module_implicit_outs": get_gki_modules_list("x86_64"), "protected_exports_list": "android/abi_gki_protected_exports_x86_64", "protected_modules_list": "android/gki_x86_64_protected_modules", "make_goals": _GKI_X86_64_MAKE_GOALS, @@ -480,7 +508,7 @@ kernel_build( "modules", "rk3399-rock-pi-4b.dtb", ], - module_outs = COMMON_GKI_MODULES_LIST + _ROCKPI4_MODULE_OUTS + _ROCKPI4_WATCHDOG_MODULE_OUTS, + module_outs = get_gki_modules_list("arm64") + _ROCKPI4_MODULE_OUTS + _ROCKPI4_WATCHDOG_MODULE_OUTS, visibility = ["//visibility:private"], ) @@ -503,7 +531,7 @@ kernel_build( "modules", "rk3399-rock-pi-4b.dtb", ], - module_outs = COMMON_GKI_MODULES_LIST + _ROCKPI4_MODULE_OUTS, + module_outs = get_gki_modules_list("arm64") + _ROCKPI4_MODULE_OUTS, visibility = ["//visibility:private"], ) diff --git a/modules.bzl b/modules.bzl index 868ef5ed2bd3..4254764296fc 100644 --- a/modules.bzl +++ b/modules.bzl @@ -6,7 +6,7 @@ This module contains a full list of kernel modules compiled by GKI. """ -COMMON_GKI_MODULES_LIST = [ +_COMMON_GKI_MODULES_LIST = [ # keep sorted "drivers/block/zram/zram.ko", "drivers/bluetooth/btbcm.ko", @@ -68,3 +68,43 @@ COMMON_GKI_MODULES_LIST = [ "net/tipc/diag.ko", "net/tipc/tipc.ko", ] + +# Deprecated - Use `get_gki_modules_list` function instead. +COMMON_GKI_MODULES_LIST = _COMMON_GKI_MODULES_LIST + +_ARM64_GKI_MODULES_LIST = [ + # keep sorted +] + +_RISCV64_GKI_MODULES_LIST = [ + # keep sorted +] + +_X86_64_GKI_MODULES_LIST = [ + # keep sorted +] + +# buildifier: disable=unnamed-macro +def get_gki_modules_list(arch = None): + """ Provides the list of GKI modules. + + Args: + arch: One of [arm64, x86_64, riscv64]. + + Returns: + The list of GKI modules for the given |arch|. + """ + gki_modules_list = [] + _COMMON_GKI_MODULES_LIST + if arch == "arm64": + gki_modules_list += _ARM64_GKI_MODULES_LIST + elif arch == "x86_64": + gki_modules_list += _X86_64_GKI_MODULES_LIST + elif arch == "riscv64": + gki_modules_list += _RISCV64_GKI_MODULES_LIST + else: + fail("{}: arch {} not supported. Use one of [arm64, x86_64, riscv64]".format( + str(native.package_relative_label(":x")).removesuffix(":x"), + arch, + )) + + return gki_modules_list