Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 49f32a8

Browse files
Ulises Mendez MartinezTreehugger Robot
authored andcommitted
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 <[email protected]>
1 parent 8b02674 commit 49f32a8

File tree

2 files changed

+76
-8
lines changed

2 files changed

+76
-8
lines changed

BUILD.bazel

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ load(
1212
"kernel_modules_install",
1313
"merged_kernel_uapi_headers",
1414
)
15-
load(":modules.bzl", "COMMON_GKI_MODULES_LIST")
15+
load(":modules.bzl", "get_gki_modules_list")
1616

1717
package(
1818
default_visibility = [
@@ -39,27 +39,55 @@ _GKI_X86_64_MAKE_GOALS = [
3939
"modules",
4040
]
4141

42+
# Deprecated - Use arch specific files from below.
4243
write_file(
4344
name = "gki_system_dlkm_modules",
4445
out = "android/gki_system_dlkm_modules",
45-
content = COMMON_GKI_MODULES_LIST + [
46+
content = get_gki_modules_list("arm64") + [
47+
# Ensure new line at the end.
48+
"",
49+
],
50+
)
51+
52+
write_file(
53+
name = "gki_system_dlkm_modules_arm64",
54+
out = "android/gki_system_dlkm_modules_arm64",
55+
content = get_gki_modules_list("arm64") + [
56+
# Ensure new line at the end.
57+
"",
58+
],
59+
)
60+
61+
write_file(
62+
name = "gki_system_dlkm_modules_x86_64",
63+
out = "android/gki_system_dlkm_modules_x86_64",
64+
content = get_gki_modules_list("x86_64") + [
65+
# Ensure new line at the end.
66+
"",
67+
],
68+
)
69+
70+
write_file(
71+
name = "gki_system_dlkm_modules_risc64",
72+
out = "android/gki_system_dlkm_modules_riscv64",
73+
content = get_gki_modules_list("riscv64") + [
4674
# Ensure new line at the end.
4775
"",
4876
],
4977
)
5078

5179
define_common_kernels(target_configs = {
5280
"kernel_aarch64": {
53-
"module_implicit_outs": COMMON_GKI_MODULES_LIST,
81+
"module_implicit_outs": get_gki_modules_list("arm64"),
5482
"make_goals": _GKI_AARCH64_MAKE_GOALS,
5583
},
5684
"kernel_riscv64": {
57-
"module_implicit_outs": COMMON_GKI_MODULES_LIST,
85+
"module_implicit_outs": get_gki_modules_list("riscv64"),
5886
"make_goals": _GKI_RISCV64_MAKE_GOALS,
5987
},
6088
"kernel_x86_64": {
6189
"kmi_symbol_list_strict_mode": False,
62-
"module_implicit_outs": COMMON_GKI_MODULES_LIST,
90+
"module_implicit_outs": get_gki_modules_list("x86_64"),
6391
"make_goals": _GKI_X86_64_MAKE_GOALS,
6492
},
6593
})
@@ -411,7 +439,7 @@ kernel_build(
411439
"modules",
412440
"rk3399-rock-pi-4b.dtb",
413441
],
414-
module_outs = COMMON_GKI_MODULES_LIST + _ROCKPI4_MODULE_OUTS + _ROCKPI4_WATCHDOG_MODULE_OUTS,
442+
module_outs = get_gki_modules_list("arm64") + _ROCKPI4_MODULE_OUTS + _ROCKPI4_WATCHDOG_MODULE_OUTS,
415443
visibility = ["//visibility:private"],
416444
)
417445

@@ -434,7 +462,7 @@ kernel_build(
434462
"modules",
435463
"rk3399-rock-pi-4b.dtb",
436464
],
437-
module_outs = COMMON_GKI_MODULES_LIST + _ROCKPI4_MODULE_OUTS,
465+
module_outs = get_gki_modules_list("arm64") + _ROCKPI4_MODULE_OUTS,
438466
visibility = ["//visibility:private"],
439467
)
440468

modules.bzl

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This module contains a full list of kernel modules
66
compiled by GKI.
77
"""
88

9-
COMMON_GKI_MODULES_LIST = [
9+
_COMMON_GKI_MODULES_LIST = [
1010
# keep sorted
1111
"drivers/block/zram/zram.ko",
1212
"drivers/bluetooth/btbcm.ko",
@@ -71,3 +71,43 @@ COMMON_GKI_MODULES_LIST = [
7171
"net/tipc/tipc.ko",
7272
"net/wireless/cfg80211.ko",
7373
]
74+
75+
# Deprecated - Use `get_gki_modules_list` function instead.
76+
COMMON_GKI_MODULES_LIST = _COMMON_GKI_MODULES_LIST
77+
78+
_ARM64_GKI_MODULES_LIST = [
79+
# keep sorted
80+
]
81+
82+
_RISCV64_GKI_MODULES_LIST = [
83+
# keep sorted
84+
]
85+
86+
_X86_64_GKI_MODULES_LIST = [
87+
# keep sorted
88+
]
89+
90+
# buildifier: disable=unnamed-macro
91+
def get_gki_modules_list(arch = None):
92+
""" Provides the list of GKI modules.
93+
94+
Args:
95+
arch: One of [arm64, x86_64, riscv64].
96+
97+
Returns:
98+
The list of GKI modules for the given |arch|.
99+
"""
100+
gki_modules_list = [] + _COMMON_GKI_MODULES_LIST
101+
if arch == "arm64":
102+
gki_modules_list += _ARM64_GKI_MODULES_LIST
103+
elif arch == "x86_64":
104+
gki_modules_list += _X86_64_GKI_MODULES_LIST
105+
elif arch == "riscv64":
106+
gki_modules_list += _RISCV64_GKI_MODULES_LIST
107+
else:
108+
fail("{}: arch {} not supported. Use one of [arm64, x86_64, riscv64]".format(
109+
str(native.package_relative_label(":x")).removesuffix(":x"),
110+
arch,
111+
))
112+
113+
return gki_modules_list

0 commit comments

Comments
 (0)