Эх сурвалжийг харах

fingerprint: Bazel changes for Kernal DDK

Changes for kernel DDK

Change-Id: I659eeddcca12504edc6d8604722282e38016d03c
Signed-off-by: Utkarsha Bagade <[email protected]>
Utkarsha Bagade 1 жил өмнө
parent
commit
3db7864d99
4 өөрчлөгдсөн 62 нэмэгдсэн , 1 устгасан
  1. 5 0
      BUILD.bazel
  2. 20 0
      README.txt
  3. 35 0
      define_modules.bzl
  4. 2 1
      qbt_handler.c

+ 5 - 0
BUILD.bazel

@@ -0,0 +1,5 @@
+load(":define_modules.bzl", "define_basic_modules")
+
+targets = ["pineapple"]
+variants = ["gki", "consolidate"]
+define_basic_modules(targets, variants)

+ 20 - 0
README.txt

@@ -0,0 +1,20 @@
+How to set up and Compile using Bazel
+
+Create symlink to link with kernel_platform for building and running bazel
+
+mkdir -p kernel_platform/external_modules
+cd kernel_platform/external_modules
+ln -s ../../vendor/qcom/opens/fingerprint
+
+
+Command to check from kernel_platform dir to check if setup correct
+./build_with_bazel.py -t pinapple gki --lto=thin
+
+
+Command to run bazel build
+./tools/bazel build --lto=thin //external_modules/fingerprint:all
+
+Command example to run bazel run to copy to dist dir
+./tools/bazel run --lto=thin //external_modules/fingerprint:pinapple_gki_qbt_handler_dist
+
+Note: A few misspells on purpose to avoid banned keywords.

+ 35 - 0
define_modules.bzl

@@ -0,0 +1,35 @@
+load("//build/kernel/kleaf:kernel.bzl", "ddk_module")
+load("//build/bazel_common_rules/dist:dist.bzl", "copy_to_dist_dir")
+
+def define_basic_modules(targets, variants):
+    for t in targets:
+        for v in variants:
+            define_modules(t, v)
+
+def define_modules(target, variant):
+    tv = "{}_{}".format(target, variant)
+    rule_base = "{}_qbt_handler".format(tv)
+
+    ddk_module(
+        name = rule_base,
+        out = "qbt_handler.ko",
+        deps = ["//msm-kernel:all_headers"],
+        srcs = [
+            "qbt_handler.c",
+            "qbt_handler.h"
+        ],
+        includes = ["include/linux"],
+        kernel_build = "//msm-kernel:{}".format(tv),
+        visibility = ["//visibility:public"]
+    )
+
+    copy_to_dist_dir(
+        name = "{}_dist".format(rule_base),
+        data = [":{}".format(rule_base)],
+        dist_dir = "../out/target/product/{}/dlkm/lib/modules/".format(target),
+        flat = True,
+        wipe_dist_dir = False,
+        allow_duplicate_filenames = False,
+        mode_overrides = {"**/*": "644"},
+        log = "info",
+    )

+ 2 - 1
qbt_handler.c

@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #define pr_fmt(fmt) "qbt:%s: " fmt, __func__
@@ -39,6 +39,7 @@
 #define QBT_INPUT_DEV_VERSION 0x0100
 #define QBT_TOUCH_FD_VERSION_2 2
 #define QBT_TOUCH_FD_VERSION_3 3
+#define DEBUG
 
 struct finger_detect_gpio {
 	int gpio;