ubwcp: bazel support

Add support for bazel build system

Change-Id: I9ec76c8341d7d1c909725016c0387beb13302570
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
This commit is contained in:
Amol Jadi
2023-01-27 15:44:19 -08:00
parent 34771eb84c
commit 47907f98a1
7 changed files with 40 additions and 5 deletions

View File

@@ -7,6 +7,6 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*) LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*)
LOCAL_EXPORT_KO_INCLUDE_DIRS := $(LOCAL_PATH)/include/uapi LOCAL_EXPORT_KO_INCLUDE_DIRS := $(LOCAL_PATH)/include/uapi
LOCAL_EXPORT_KO_INCLUDE_DIRS += $(LOCAL_PATH)/include/kernel LOCAL_EXPORT_KO_INCLUDE_DIRS += $(LOCAL_PATH)/include/kernel
LOCAL_MODULE := ubwcpx.ko LOCAL_MODULE := ubwcp.ko
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/Build_external_kernelmodule.mk include $(DLKM_DIR)/Build_external_kernelmodule.mk

4
ubwcp/BUILD.bazel Normal file
View File

@@ -0,0 +1,4 @@
load(":define_modules.bzl", "define_modules")
define_modules("pineapple", "consolidate")
define_modules("pineapple", "gki")

View File

@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
ubwcpx-objs := ubwcp.o ubwcp_hw.o ubwcp-objs := ubwcp_main.o ubwcp_hw.o
obj-m += ubwcpx.o obj-m += ubwcp.o

31
ubwcp/define_modules.bzl Normal file
View File

@@ -0,0 +1,31 @@
load("//build/kernel/kleaf:kernel.bzl", "ddk_module")
load("//build/bazel_common_rules/dist:dist.bzl", "copy_to_dist_dir")
def define_modules(target, variant):
tv = "{}_{}".format(target, variant)
ddk_module(
name = "{}_ubwcp".format(tv),
out = "ubwcp.ko",
srcs = [
"ubwcp_main.c",
"ubwcp_hw.c",
"ubwcp_hw.h",
],
hdrs=["include/uapi/ubwcp_ioctl.h", "include/kernel/ubwcp.h"],
deps = ["//msm-kernel:all_headers"],
includes = ["include", "include/kernel"],
kernel_build = "//msm-kernel:{}".format(tv),
visibility = ["//visibility:public"]
)
copy_to_dist_dir(
name = "{}_ubwcp_dist".format(tv),
data = [":{}_ubwcp".format(tv)],
dist_dir = "out/target/product/{}/dlkm/lib/modules/".format(target),
flat = True,
wipe_dist_dir = False,
allow_duplicate_filenames = False,
mode_overrides = {"**/*": "644"},
)

View File

@@ -1,2 +1,2 @@
PRODUCT_PACKAGES += ubwcpx.ko PRODUCT_PACKAGES += ubwcp.ko

View File

@@ -1,2 +1,2 @@
BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/ubwcpx.ko BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/ubwcp.ko