Add makefile to build r21p0-bifrost module lineage-18.1
authorAaron Kling <webgeek1234@gmail.com>
Thu, 24 Jun 2021 21:22:02 +0000 (16:22 -0500)
committerAaron Kling <webgeek1234@gmail.com>
Mon, 19 Jul 2021 03:00:49 +0000 (22:00 -0500)
Change-Id: I308690d109deb06646f4e6a9d9ad2638115d8cef

Android.mk [new file with mode: 0644]

diff --git a/Android.mk b/Android.mk
new file mode 100644 (file)
index 0000000..a3a451a
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2021 The LineageOS Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+ifeq ($(TARGET_PREBUILT_KERNEL),)
+MALI_GPU_VARIANT ?= bifrost
+MALI_DRV_VERSION ?= r21p0
+MALI_PATH        := $(abspath $(call my-dir))
+GPU_PATH         := $(MALI_GPU_VARIANT)/$(MALI_DRV_VERSION)/kernel/drivers/gpu/arm/midgard
+GPU_CONFIGS      := CONFIG_MALI_MIDGARD=m CONFIG_MALI_MIDGARD_DVFS=y CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND=y CONFIG_MALI_BACKEND=gpu
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE        := mali
+LOCAL_MODULE_SUFFIX := .ko
+LOCAL_MODULE_CLASS  := ETC
+LOCAL_MODULE_PATH   := $(TARGET_OUT_VENDOR)/lib/modules
+LOCAL_CFLAGS        := -Wno-error -Wno-pointer-sign -Wno-error=frame-larger-than=
+LOCAL_C_INCLUDES    := \
+    $(MALI_PATH)/$(GPU_PATH)/backend/gpu \
+    $(MALI_PATH)/$(GPU_PATH)/platform/devicetree \
+    $(MALI_PATH)/$(GPU_PATH)/ipa \
+    $(MALI_PATH)/$(GPU_PATH) \
+    $(MALI_PATH)/dvalin/kernel/include
+
+_mali_intermediates := $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE))
+_mali_ko := $(_mali_intermediates)/$(LOCAL_MODULE)$(LOCAL_MODULE_SUFFIX)
+KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
+GPU_CFLAGS := $(LOCAL_CFLAGS) $(addprefix -I,$(LOCAL_C_INCLUDES))
+
+$(_mali_ko): $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(BOARD_KERNEL_IMAGE_NAME)
+       @mkdir -p $(dir $@)
+       @cp -R $(MALI_PATH)/* $(dir $@)/
+       $(hide) +$(KERNEL_MAKE_CMD) $(PATH_OVERRIDE) $(KERNEL_MAKE_FLAGS) -C $(KERNEL_OUT) M=$(abspath $(_mali_intermediates))/$(GPU_PATH) ARCH=$(TARGET_KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) EXTRA_CFLAGS="$(GPU_CFLAGS)" $(GPU_CONFIGS) modules
+       $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $(dir $@)/$(GPU_PATH)/mali_kbase.ko; \
+       cp $(dir $@)/$(GPU_PATH)/mali_kbase.ko $@;
+
+include $(BUILD_SYSTEM)/base_rules.mk
+endif