Source: opendevices.sony.net, "Open source archive for 73.1.A.2.74" (Xperia 1 VIII: XQ-GE74, XQ-GE54, SO-51G, SOG17, A601SO, XQ-GE44), unmodified. Co-Authored-By: Claude Opus 5.5 <[email protected]>
135 lines
4.7 KiB
Python
135 lines
4.7 KiB
Python
# TODO
|
|
# Add ddk module definition for frpc-trusted driver
|
|
load("//build/bazel_common_rules/dist:dist.bzl", "copy_to_dist_dir")
|
|
|
|
load(
|
|
"//build/kernel/kleaf:kernel.bzl",
|
|
"ddk_headers",
|
|
"ddk_module",
|
|
"kernel_module",
|
|
"kernel_modules_install",
|
|
)
|
|
|
|
def define_modules(target, variant):
|
|
kernel_build_variant = "{}_{}".format(target, variant)
|
|
|
|
kernel_build = select({
|
|
"//build/qcom_build_extensions:qtisocrepo_true": "//soc-repo:{}_base_kernel".format(kernel_build_variant),
|
|
"//build/qcom_build_extensions:qtisocrepo_false": "//msm-kernel:{}".format(kernel_build_variant),
|
|
})
|
|
ddk_deps = select({
|
|
"//build/qcom_build_extensions:qtisocrepo_true":[
|
|
"//soc-repo:all_headers",
|
|
"//soc-repo:{}/drivers/firmware/qcom/qcom-scm".format(kernel_build_variant),
|
|
"//soc-repo:{}/drivers/soc/qcom/mem_buf/mem_buf_dev".format(kernel_build_variant),
|
|
"//soc-repo:{}/drivers/soc/qcom/pdr_interface".format(kernel_build_variant),
|
|
"//soc-repo:{}/drivers/rpmsg/qcom_glink".format(kernel_build_variant),
|
|
],
|
|
"//build/qcom_build_extensions:qtisocrepo_false": ["//msm-kernel:all_headers"],
|
|
})
|
|
|
|
# Path to dsp folder from soc-repo/include/trace directory
|
|
trace_include_path = "../../../{}/dsp".format(native.package_name())
|
|
|
|
ddk_module(
|
|
name = "{}_frpc-adsprpc".format(kernel_build_variant),
|
|
kernel_build = kernel_build,
|
|
deps = ddk_deps,
|
|
srcs = [
|
|
"dsp/fastrpc.c",
|
|
"dsp/fastrpc_rpmsg.c",
|
|
"dsp/fastrpc_shared.h",
|
|
"dsp/fastrpc_trace.h",
|
|
"dsp/fastrpc_sysfs.c"
|
|
],
|
|
local_defines = ["DSP_TRACE_INCLUDE_PATH={}".format(trace_include_path)],
|
|
out = "frpc-adsprpc.ko",
|
|
hdrs = [
|
|
"include/uapi/misc/fastrpc.h",
|
|
"include/linux/fastrpc.h"
|
|
],
|
|
includes = [
|
|
"include/linux",
|
|
"include/uapi",
|
|
],
|
|
)
|
|
|
|
copy_to_dist_dir(
|
|
name = "{}_dsp-kernel_dist".format(kernel_build_variant),
|
|
data = [
|
|
":{}_frpc-adsprpc".format(kernel_build_variant),
|
|
],
|
|
dist_dir = "out/target/product/{}/dlkm/lib/modules/".format(target),
|
|
flat = True,
|
|
wipe_dist_dir = False,
|
|
allow_duplicate_filenames = False,
|
|
mode_overrides = {"**/*": "644"},
|
|
)
|
|
|
|
def define_vm_modules(target, variant):
|
|
kernel_build_variant = "{}_{}".format(target, variant)
|
|
|
|
kernel_build = select({
|
|
"//build/qcom_build_extensions:qtisocrepo_true": "//soc-repo:{}_base_kernel".format(kernel_build_variant),
|
|
"//build/qcom_build_extensions:qtisocrepo_false": "//msm-kernel:{}".format(kernel_build_variant),
|
|
})
|
|
|
|
deps = select({
|
|
"//build/qcom_build_extensions:qtisocrepo_true": [
|
|
"//soc-repo:all_headers",
|
|
"//soc-repo:{}/drivers/firmware/qcom/qcom-scm".format(kernel_build_variant),
|
|
"//soc-repo:{}/drivers/soc/qcom/mem_buf/mem_buf_dev".format(kernel_build_variant),
|
|
"//soc-repo:{}/drivers/dma-buf/heaps/qcom_dma_heaps".format(kernel_build_variant),
|
|
] ,
|
|
"//build/qcom_build_extensions:qtisocrepo_false": ["//msm-kernel:all_headers"],
|
|
})
|
|
|
|
# Path to dsp folder from soc-repo/include/trace directory
|
|
trace_include_path = "../../../{}/dsp".format(native.package_name())
|
|
|
|
ddk_module(
|
|
name = "{}_frpc-trusted-adsprpc".format(kernel_build_variant),
|
|
kernel_build = kernel_build,
|
|
deps = deps,
|
|
srcs = [
|
|
"dsp/fastrpc.c",
|
|
"dsp/fastrpc_socket.c",
|
|
"dsp/fastrpc_shared.h",
|
|
"dsp/fastrpc_trace.h",
|
|
"dsp/fastrpc_sysfs.c"
|
|
],
|
|
local_defines = [
|
|
"DSP_TRACE_INCLUDE_PATH={}".format(trace_include_path),
|
|
"CONFIG_QCOM_FASTRPC_TRUSTED=1"
|
|
],
|
|
out = "frpc-trusted-adsprpc.ko",
|
|
hdrs = [
|
|
"include/uapi/misc/fastrpc.h",
|
|
"include/linux/fastrpc.h"
|
|
],
|
|
includes = [
|
|
"include/linux",
|
|
"include/uapi",
|
|
],
|
|
)
|
|
|
|
copy_to_dist_dir(
|
|
name = "{}_dsp-kernel_dist".format(kernel_build_variant),
|
|
data = [
|
|
":{}_frpc-trusted-adsprpc".format(kernel_build_variant),
|
|
],
|
|
dist_dir = "out/target/product/{}/dlkm/lib/modules/".format(target),
|
|
flat = True,
|
|
wipe_dist_dir = False,
|
|
allow_duplicate_filenames = False,
|
|
mode_overrides = {"**/*": "644"},
|
|
)
|
|
|
|
def define_target_modules():
|
|
# Creates a ddk_headers that exposes the FastRPC UAPI header with public visibility
|
|
ddk_headers(
|
|
name = "frpc_uapi_headers",
|
|
hdrs = native.glob(["include/uapi/misc/fastrpc.h"]),
|
|
visibility = ["//visibility:public"]
|
|
)
|