Introduce linaro_hikey960-userdebug build target

Add linaro_hikey960-userdebug build target hosted on
source.devboardsforandroid.linaro.org and synced as
device/linaro/hikey960* projects from a local manifest.

Change-Id: I75eebe494376a18b0887861d1aaf397f72bd21a6
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
diff --git a/linaro_hikey960.mk b/linaro_hikey960.mk
new file mode 100644
index 0000000..d04f154
--- /dev/null
+++ b/linaro_hikey960.mk
@@ -0,0 +1,62 @@
+ifndef TARGET_KERNEL_USE
+TARGET_KERNEL_USE=5.10
+endif
+LOCAL_KERNEL_HOME ?= device/linaro/hikey960-kernel/$(TARGET_KERNEL_USE)
+TARGET_PREBUILT_KERNEL := $(LOCAL_KERNEL_HOME)/Image.gz-dtb
+TARGET_PREBUILT_DTB := $(LOCAL_KERNEL_HOME)/hi3660-hikey960.dtb
+
+ifndef HIKEY_USES_GKI
+  ## Please check the following link for the android-mainline
+  ## kernel build instructions:
+  ##   https://www.96boards.org/documentation/consumer/hikey/hikey960/build/android-mainline.md.html
+  ifeq ($(TARGET_KERNEL_USE), mainline)
+    HIKEY_USES_GKI := true
+  else
+    KERNEL_MAJ := $(word 1, $(subst ., ,$(TARGET_KERNEL_USE)))
+    # kernel since 5.X should support GKI
+    # only 4.X kernels do not support GKI
+    ifneq ($(KERNEL_MAJ), 4)
+      HIKEY_USES_GKI := true
+    endif
+  endif
+endif
+
+# Inherit the common device configuration
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, device/linaro/hikey960/linaro_hikey960/device-hikey960.mk)
+$(call inherit-product, device/linaro/hikey960/device-common.mk)
+
+PRODUCT_PROPERTY_OVERRIDES += \
+  ro.opengles.version=196608 \
+  ro.hardware.egl=mali
+
+#
+# Overrides
+PRODUCT_NAME := linaro_hikey960
+PRODUCT_DEVICE := linaro_hikey960
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP fork on hikey960
+
+ifneq ($(HIKEY_USES_GKI),)
+  HIKEY_MOD_DIR := $(LOCAL_KERNEL_HOME)
+  HIKEY_MODS := $(wildcard $(HIKEY_MOD_DIR)/*.ko)
+  SDCARDFS_KO := $(wildcard $(HIKEY_MOD_DIR)/sdcardfs*.ko)
+  CMA_HEAP_KO := $(wildcard $(HIKEY_MOD_DIR)/cma_heap.ko)
+  DEFERRED_FREE_KO := $(wildcard $(HIKEY_MOD_DIR)/deferred-free-helper.ko)
+  PAGE_POOL_KO := $(wildcard $(HIKEY_MOD_DIR)/page_pool.ko)
+  SYSTEM_HEAP_KO := $(wildcard $(HIKEY_MOD_DIR)/system_heap.ko)
+  ION_CMA_HEAP_KO := $(wildcard $(HIKEY_MOD_DIR)/ion_cma_heap*.ko)
+  ifneq ($(HIKEY_MODS),)
+    BOARD_VENDOR_KERNEL_MODULES += $(HIKEY_MODS)
+    BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \
+        $(CMA_HEAP_KO) \
+        $(SYSTEM_HEAP_KO) \
+        $(DEFERRED_FREE_KO) \
+        $(PAGE_POOL_KO) \
+        $(ION_CMA_HEAP_KO) \
+        $(SDCARDFS_KO)
+  endif
+endif
+
+PRODUCT_SOONG_NAMESPACES += \
+  device/linaro/hikey960/mali/bifrost