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
Signed-off-by: Yifan Hong <elsk@google.com>
Change-Id: I4f15d2fac703bc3b7100a72e90f289236db3e7e5
diff --git a/BUILD.bazel b/BUILD.bazel
index 9cce329..e9df6ee 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -19,7 +19,7 @@
load("//build/bazel_common_rules/dist:dist.bzl", "copy_to_dist_dir")
load("//build/kernel/kleaf:common_kernels.bzl", "define_common_kernels", "define_db845c")
-load("//build/kernel/kleaf:kernel.bzl", "kernel_build")
+load("//build/kernel/kleaf:kernel.bzl", "ddk_headers", "kernel_build")
_aarch64_additional_kmi_symbol_lists = [
# keep sorted
@@ -252,3 +252,49 @@
dist_dir = "out/fips140/dist",
flat = True,
)
+
+# 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"],
+)