1ifndef TARGET_KERNEL_USE
2TARGET_KERNEL_USE=5.10
3endif
4LOCAL_KERNEL_HOME ?= device/linaro/hikey-kernel/hikey960/$(TARGET_KERNEL_USE)
5TARGET_PREBUILT_KERNEL := $(LOCAL_KERNEL_HOME)/Image.gz-dtb
6TARGET_PREBUILT_DTB := $(LOCAL_KERNEL_HOME)/hi3660-hikey960.dtb
7
8ifndef HIKEY_USES_GKI
9  ## Please check the following link for the android-mainline
10  ## kernel build instructions:
11  ##   https://www.96boards.org/documentation/consumer/hikey/hikey960/build/android-mainline.md.html
12  ifeq ($(TARGET_KERNEL_USE), mainline)
13    HIKEY_USES_GKI := true
14  else
15    KERNEL_MAJ := $(word 1, $(subst ., ,$(TARGET_KERNEL_USE)))
16    # kernel since 5.X should support GKI
17    # only 4.X kernels do not support GKI
18    ifneq ($(KERNEL_MAJ), 4)
19      HIKEY_USES_GKI := true
20    endif
21  endif
22endif
23
24# only kernels after 5.10 support KVM
25ifndef HIKEY960_ENABLE_AVF
26  ifeq ($(TARGET_KERNEL_USE), mainline)
27    HIKEY960_ENABLE_AVF := true
28  else
29    KERNEL_MAJ := $(word 1, $(subst ., ,$(TARGET_KERNEL_USE)))
30    KERNEL_MIN := $(word 2, $(subst ., ,$(TARGET_KERNEL_USE)))
31    KER_GT_5 := $(shell [ $(KERNEL_MAJ) -gt 5 ] && echo true)
32    KER_GE_5_10 := $(shell [ $(KERNEL_MIN) -ge 10 ] && echo true)
33
34    ifeq ($(KER_GT_5), true)
35      HIKEY960_ENABLE_AVF := true
36    else
37      ifeq ($(KERNEL_MAJ), 5)
38        # for kernel after 5.10
39        ifeq ($(KER_GE_5_10),true)
40          HIKEY960_ENABLE_AVF := true
41        endif
42      endif # end for 5.10
43    endif # end for 5.X
44  endif # end for mainline
45endif # end for HIKEY960_ENABLE_AVF
46
47include $(LOCAL_PATH)/vendor-package-ver.mk
48
49# Inherit the common device configuration
50$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
51$(call inherit-product, device/linaro/hikey/hikey960/device-hikey960.mk)
52$(call inherit-product, device/linaro/hikey/device-common.mk)
53$(call inherit-product-if-exists, vendor/linaro/hikey960/$(EXPECTED_LINARO_VENDOR_VERSION)/hikey960.mk)
54
55PRODUCT_PROPERTY_OVERRIDES += \
56  ro.opengles.version=196608 \
57  ro.hardware.egl=mali
58
59## This is a workaround for the Bluetooth sanitize shadow call stack (SCS)
60## crash reported here: https://issuetracker.google.com/issues/302408537,
61## until the new version Mali binaries released.
62## For details of the root cause and the cts vts tests comparison between
63## the preloading and non-preloading builds, please check the above issue.
64PRODUCT_PROPERTY_OVERRIDES += ro.zygote.disable_gl_preload=1
65
66#
67# Overrides
68PRODUCT_NAME := hikey960
69PRODUCT_DEVICE := hikey960
70PRODUCT_BRAND := Android
71PRODUCT_MODEL := AOSP on hikey960
72
73ifneq ($(HIKEY_USES_GKI),)
74  HIKEY_MOD_DIR := $(LOCAL_KERNEL_HOME)
75  HIKEY_MODS := $(wildcard $(HIKEY_MOD_DIR)/*.ko)
76  SDCARDFS_KO := $(wildcard $(HIKEY_MOD_DIR)/sdcardfs*.ko)
77  CMA_HEAP_KO := $(wildcard $(HIKEY_MOD_DIR)/cma_heap.ko)
78  DEFERRED_FREE_KO := $(wildcard $(HIKEY_MOD_DIR)/deferred-free-helper.ko)
79  PAGE_POOL_KO := $(wildcard $(HIKEY_MOD_DIR)/page_pool.ko)
80  SYSTEM_HEAP_KO := $(wildcard $(HIKEY_MOD_DIR)/system_heap.ko)
81  ION_CMA_HEAP_KO := $(wildcard $(HIKEY_MOD_DIR)/ion_cma_heap*.ko)
82  ifneq ($(HIKEY_MODS),)
83    BOARD_VENDOR_KERNEL_MODULES += $(HIKEY_MODS)
84    BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \
85        $(CMA_HEAP_KO) \
86        $(SYSTEM_HEAP_KO) \
87        $(DEFERRED_FREE_KO) \
88        $(PAGE_POOL_KO) \
89        $(ION_CMA_HEAP_KO) \
90        $(SDCARDFS_KO)
91  endif
92endif
93
94PRODUCT_SOONG_NAMESPACES += \
95  vendor/linaro/hikey960/$(EXPECTED_LINARO_VENDOR_VERSION)/mali/bifrost
96