ANDROID: kleaf: Initial list of ddk_headers (0: skeleton)

Create the skeleton rules for DDK headers, and write comments
with hands.

This CL has no real effect; all targets are declared empty
and content is filled in in follow up CLs.

Allowlist: This is a list of headers and a list of
include directories that are known to be safe
to be used by modules.

Unsafe list: This is the list of headers that are known to be used
by some device kernel build, minus allowlist.
This means, with the allowlist and unsafe list, an unspecified
device kernel build can be transitioned to DDK without any change
to the source code.

- Note that for cleaness of DDK modules, we may want to
  remove some items in the allowlist of includes and
  require device source code to #include from the
  correct directory.

Bug: 248351908
Bug: 254735056
Signed-off-by: Yifan Hong <elsk@google.com>
Change-Id: I4f15d2fac703bc3b7100a72e90f289236db3e7e5
(cherry picked from commit ede1fd38eeafa71983e0f578bed60f12e0b87ca1)
This commit is contained in:
Yifan Hong 2022-10-11 23:07:33 -07:00
parent 8e00226a8f
commit 45d94b7bcf

View File

@ -18,6 +18,7 @@ package(
)
load("//build/kernel/kleaf:common_kernels.bzl", "define_common_kernels", "define_db845c")
load("//build/kernel/kleaf:kernel.bzl", "ddk_headers")
_common_gki_modules_list = [
# keep sorted
@ -245,3 +246,49 @@ define_db845c(
"sound/soc/qcom/snd-soc-sm8250.ko",
],
)
# DDK Headers
# All headers. This is the public target for DDK modules to use.
ddk_headers(
name = "all_headers",
hdrs = [":all_headers_allowlist"] + select({
"//build/kernel/kleaf:allow_ddk_unsafe_headers_set": [":all_headers_unsafe"],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
)
# DDK headers allowlist. This is the list of all headers and include
# directories that are safe to use in DDK modules.
ddk_headers(
name = "all_headers_allowlist",
hdrs = [],
# The list of include directories where source files can #include headers
# from. In other words, these are the `-I` option to the C compiler.
includes = [],
visibility = ["//visibility:private"],
)
# List of DDK headers allowlist that are glob()-ed to avoid changes of BUILD
# file when the list of files changes. All headers in these directories
# are safe to use.
filegroup(
name = "all_headers_allowlist_globs",
srcs = [],
visibility = ["//visibility:private"],
)
# DDK headers unsafe list. This is the list of all headers and include
# directories that may be used during migration from kernel_module's, but
# should be avoided in general.
# Use with caution; items may:
# - be removed without notice
# - be moved into all_headers
ddk_headers(
name = "all_headers_unsafe",
hdrs = [],
# The list of include directories where source files can #include headers
# from. In other words, these are the `-I` option to the C compiler.
includes = [],
visibility = ["//visibility:private"],
)