11bd4fe43Sopenharmony_ci# Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 21bd4fe43Sopenharmony_ci# 31bd4fe43Sopenharmony_ci# This program is free software; you can redistribute it and/or 41bd4fe43Sopenharmony_ci# modify it under the terms of the GNU General Public License 51bd4fe43Sopenharmony_ci# as published by the Free Software Foundation; either version 2 61bd4fe43Sopenharmony_ci# of the License, or (at your option) any later version. 71bd4fe43Sopenharmony_ci# 81bd4fe43Sopenharmony_ci# This program is distributed in the hope that it will be useful, 91bd4fe43Sopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of 101bd4fe43Sopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 111bd4fe43Sopenharmony_ci# GNU General Public License for more details. 121bd4fe43Sopenharmony_ci# 131bd4fe43Sopenharmony_ci# You should have received a copy of the GNU General Public License 141bd4fe43Sopenharmony_ci# along with this program; if not, write to the Free Software 151bd4fe43Sopenharmony_ci# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 161bd4fe43Sopenharmony_ci 171bd4fe43Sopenharmony_ci# use C01 to indicate uclibc, C02 to indicate glibc, C05 to indicate LiteOS. 181bd4fe43Sopenharmony_ciifeq ($(FPGA),n) 191bd4fe43Sopenharmony_ci ifeq ($(LIBC),glibc) 201bd4fe43Sopenharmony_ci export CVER?=.C02 211bd4fe43Sopenharmony_ci else 221bd4fe43Sopenharmony_ci export CVER?=.C01 231bd4fe43Sopenharmony_ci endif 241bd4fe43Sopenharmony_cielse 251bd4fe43Sopenharmony_ci ifeq ($(LIBC),glibc) 261bd4fe43Sopenharmony_ci export CVER?=.C12 271bd4fe43Sopenharmony_ci else 281bd4fe43Sopenharmony_ci export CVER?=.C11 291bd4fe43Sopenharmony_ci endif 301bd4fe43Sopenharmony_ci 311bd4fe43Sopenharmony_ciendif 321bd4fe43Sopenharmony_ci 331bd4fe43Sopenharmony_ciifeq ($(HIARCH), $(filter $(HIARCH),hi3519av100 hi3516cv500)) 341bd4fe43Sopenharmony_ci ifeq ($(ARM_ARCH), smp) 351bd4fe43Sopenharmony_ci POSTFIX:= 361bd4fe43Sopenharmony_ci else 371bd4fe43Sopenharmony_ci POSTFIX:= 381bd4fe43Sopenharmony_ci endif 391bd4fe43Sopenharmony_ciendif 401bd4fe43Sopenharmony_ci 411bd4fe43Sopenharmony_ciifeq ($(HIARCH), $(filter $(HI_SUBARCH),hi3519av100)) 421bd4fe43Sopenharmony_ci ifeq ($(ARM_ARCH), amp) 431bd4fe43Sopenharmony_ci export CVER=.C$(DBG_FLAG)8 441bd4fe43Sopenharmony_ci endif 451bd4fe43Sopenharmony_ciendif 461bd4fe43Sopenharmony_ci 471bd4fe43Sopenharmony_ci 481bd4fe43Sopenharmony_ciifeq ($(HIARCH), hi3516cv500) 491bd4fe43Sopenharmony_ci ifneq ($(CONFIG_CUSTOMER_VERSION), COMMON) 501bd4fe43Sopenharmony_ci export CVER=.C$(DBG_FLAG)4 511bd4fe43Sopenharmony_ci endif 521bd4fe43Sopenharmony_ciendif 531bd4fe43Sopenharmony_ci 541bd4fe43Sopenharmony_ci############################################################################## 551bd4fe43Sopenharmony_ci# Allocated the kernel position 561bd4fe43Sopenharmony_ciifeq ($(KERNEL_VERSION), ) 571bd4fe43Sopenharmony_ciKERNEL_VERSION=linux-5.10 581bd4fe43Sopenharmony_ciendif 591bd4fe43Sopenharmony_ci 601bd4fe43Sopenharmony_ciifeq ($(MPP_BUILD), y) 611bd4fe43Sopenharmony_ci ifeq ($(HIARCH),$(filter $(HIARCH), hi3559av100)) 621bd4fe43Sopenharmony_ci export KERNEL_ROOT?=$(HIWORK_PATH)/osdrv$(HI_SUBARCH)$(CVER)/open_source/linux/$(KERNEL_NAME) 631bd4fe43Sopenharmony_ci else ifeq ($(HIARCH),$(filter $(HIARCH), hi3519av100 hi3516cv500)) 641bd4fe43Sopenharmony_ci export KERNEL_ROOT?=$(HIWORK_PATH)/osdrv$(HI_SUBARCH)$(CVER)/open_source/linux/$(KERNEL_NAME)$(POSTFIX) 651bd4fe43Sopenharmony_ci else ifeq ($(HIARCH),$(filter $(HIARCH), hi3516ev200)) 661bd4fe43Sopenharmony_ci export KERNEL_ROOT?=$(HIWORK_PATH)/osdrv$(HIARCH)$(CVER)/open_source/linux/$(KERNEL_NAME)$(POSTFIX) 671bd4fe43Sopenharmony_ci else 681bd4fe43Sopenharmony_ci export KERNEL_ROOT?=$(HIWORK_PATH)/osdrv$(HIARCH)$(CVER)/open_source/linux/$(KERNEL_NAME)$(POSTFIX) 691bd4fe43Sopenharmony_ci endif 701bd4fe43Sopenharmony_cielse 711bd4fe43Sopenharmony_ci ifeq ($(HIARCH),$(filter $(HIARCH), hi3559av100es hi3559av100)) 721bd4fe43Sopenharmony_ci export KERNEL_ROOT?=$(SDK_PATH)/open_source/linux/$(KERNEL_NAME) 731bd4fe43Sopenharmony_ci else ifeq ($(HIARCH),$(filter $(HIARCH), hi3516ev200)) 741bd4fe43Sopenharmony_ci export KERNEL_ROOT?=$(SDK_PATH)/open_source/linux/$(KERNEL_NAME)$(POSTFIX) 751bd4fe43Sopenharmony_ci else 761bd4fe43Sopenharmony_ci ifeq ($(OHOS_LITE), y) 771bd4fe43Sopenharmony_ci export KERNEL_ROOT?=$(OHOS_ROOT_PATH)/out/hispark_taurus/ipcamera_hispark_taurus_linux/kernel/$(KERNEL_VERSION) 781bd4fe43Sopenharmony_ci export KBUILD_OUTPUT=$(OHOS_ROOT_PATH)/out/hispark_taurus/ipcamera_hispark_taurus_linux/kernel/OBJ/$(KERNEL_VERSION) 791bd4fe43Sopenharmony_ci else 801bd4fe43Sopenharmony_ci export KERNEL_ROOT?=$(OHOS_ROOT_PATH)/out/KERNEL_OBJ/kernel/src_tmp/$(KERNEL_VERSION) 811bd4fe43Sopenharmony_ci export KBUILD_OUTPUT=$(OHOS_ROOT_PATH)/out/KERNEL_OBJ/kernel/OBJ/$(KERNEL_VERSION) 821bd4fe43Sopenharmony_ci endif 831bd4fe43Sopenharmony_ci endif 841bd4fe43Sopenharmony_ciendif 851bd4fe43Sopenharmony_ci 861bd4fe43Sopenharmony_ci############################################################################## 871bd4fe43Sopenharmony_ci 881bd4fe43Sopenharmony_ci# Define cross compiler 891bd4fe43Sopenharmony_ciifeq ($(CONFIG_USER_LLVM), y) 901bd4fe43Sopenharmony_ciifeq ($(OHOS_LITE), y) 911bd4fe43Sopenharmony_ci export SYSROOT_PATH := $(OHOS_ROOT_PATH)/sysroot 921bd4fe43Sopenharmony_ci # export COMPILER_PATH := $(OHOS_ROOT_PATH)/prebuilts/clang/ohos/linux-x86_64/clang-10.0.1/bin 931bd4fe43Sopenharmony_ci export COMPILER_PATH := $(COMPILER_PATH_DIR) 941bd4fe43Sopenharmony_ci export CC := $(COMPILER_PATH)/clang 951bd4fe43Sopenharmony_ci export AR := ar 961bd4fe43Sopenharmony_cielse 971bd4fe43Sopenharmony_ci export COMPILER_PATH := $(COMPILER_PATH_DIR) 981bd4fe43Sopenharmony_ci export CROSS_PATH := $(OHOS_ROOT_PATH)/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/bin 991bd4fe43Sopenharmony_ci export CC := $(COMPILER_PATH)/clang 1001bd4fe43Sopenharmony_ci export AR := $(CROSS_PATH)/$(CROSS)ar 1011bd4fe43Sopenharmony_ciendif 1021bd4fe43Sopenharmony_cielse 1031bd4fe43Sopenharmony_ci export CC := $(CROSS)gcc 1041bd4fe43Sopenharmony_ci export AR := $(CROSS)ar 1051bd4fe43Sopenharmony_ciendif 1061bd4fe43Sopenharmony_ci 1071bd4fe43Sopenharmony_ciexport REL_INC := $(REL_DIR)/include 1081bd4fe43Sopenharmony_ciexport REL_LIB := $(REL_DIR)/lib 1091bd4fe43Sopenharmony_ciexport REL_KO := $(REL_DIR)/../../out/ko 1101bd4fe43Sopenharmony_ciexport REL_OBJ := $(REL_DIR)/obj 1111bd4fe43Sopenharmony_ciexport REL_INI := $(REL_DIR)/init 1121bd4fe43Sopenharmony_ciexport ADAPT_INC := $(REL_DIR)/include/adapt 1131bd4fe43Sopenharmony_ci 1141bd4fe43Sopenharmony_ciLIBS_LD_CFLAGS += -ldl 1151bd4fe43Sopenharmony_ciMPP_CFLAGS += -Wno-date-time 1161bd4fe43Sopenharmony_ciDRV_CFLAGS += -Wno-date-time 1171bd4fe43Sopenharmony_ci 1181bd4fe43Sopenharmony_ciifeq ($(LIBC), uclibc) 1191bd4fe43Sopenharmony_ci MPP_CFLAGS += -D_GNU_SOURCE 1201bd4fe43Sopenharmony_ciendif 1211bd4fe43Sopenharmony_ciifeq ($(MPP_BUILD), y) 1221bd4fe43Sopenharmony_ci DRV_CFLAGS += -Werror 1231bd4fe43Sopenharmony_ci MPP_CFLAGS += -Werror 1241bd4fe43Sopenharmony_ci LIBS_CFLAGS += -Werror 1251bd4fe43Sopenharmony_ciendif 1261bd4fe43Sopenharmony_ci 1271bd4fe43Sopenharmony_ciifeq ($(CONFIG_USER_LLVM), y) 1281bd4fe43Sopenharmony_ciifeq ($(OHOS_LITE), y) 1291bd4fe43Sopenharmony_ci COMPILER_TRIPLE += "CROSS_COMPILE=arm-linux-gnueabi-" 1301bd4fe43Sopenharmony_cielse 1311bd4fe43Sopenharmony_ci COMPILER_TRIPLE += "CROSS_COMPILE=$(CROSS_PATH)/$(CONFIG_HI_CROSS)" 1321bd4fe43Sopenharmony_ci COMPILER_TRIPLE += "HOSTCC=$(COMPILER_PATH)/clang" 1331bd4fe43Sopenharmony_ciendif 1341bd4fe43Sopenharmony_ci COMPILER_TRIPLE += "CC=$(COMPILER_PATH)/clang" 1351bd4fe43Sopenharmony_ci export COMPILER_TRIPLE 1361bd4fe43Sopenharmony_ciendif 1371bd4fe43Sopenharmony_ci 1381bd4fe43Sopenharmony_ciexport HI_KBUILD_EXTRA_SYMBOLS 1391bd4fe43Sopenharmony_ciHI_KBUILD_EXTRA_SYMBOLS += "$(OSAL_ROOT)/$(OSTYPE)/kernel/Module.symvers" 1401bd4fe43Sopenharmony_ciHI_KBUILD_EXTRA_SYMBOLS += "$(MPP_PATH)/cbb/base/Module.symvers" 1411bd4fe43Sopenharmony_ciHI_KBUILD_EXTRA_SYMBOLS += "$(MPP_PATH)/cbb/sys/Module.symvers" 1421bd4fe43Sopenharmony_ci#HI_KBUILD_EXTRA_SYMBOLS += "$(MPP_PATH)/component/securec/src/Module.symvers" 143