You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
4.6 KiB

################################################################################
#
# Copyright (c) Hisilicon Technologies Co., Ltd. All rights reserved.
#
################################################################################
Q := $(AT)
ECHO_BLANK_LINE := echo
VENDOR_DIR ?= $(SRCTREE)/vendor
HL_PREBUILTS ?= $(SRCTREE)/prebuilts
CLANG_PATH ?= $(HL_PREBUILTS)/clang/host/linux-x86/clang-r346389c/bin
ANDROID_CROSS_64_PATH ?= $(HL_PREBUILTS)/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin
SYS_KERNEL_TOOLS_PATH ?= /usr/local/bin:/usr/bin:/bin
KERNEL_TOOLS_PATH ?= $(CLANG_PATH):$(ANDROID_CROSS_64_PATH):$(SYS_KERNEL_TOOLS_PATH)
KERNEL_SRC_DIR ?= $(VENDOR_DIR)/open_source/linux-4.14.y
DRV_DIR ?= $(VENDOR_DIR)/huanglong/linux/drv
DEVELOPMENT_DIR ?= $(VENDOR_DIR)/huanglong/development
THIRDPARTY_DIR ?= $(VENDOR_DIR)/thirdparty
CROSS_COMPILE ?= aarch64-linux-android-
SET_CC_CLANG ?= CC=clang HOSTCC=clang CLANG_TRIPLE=aarch64-linux-gnu-
CFG_SOCT_CHIP_TYPE ?= $(PLAT)
KERNEL_CONFIG := $(PRODUCT_DEVICE)/$(CFG_SOCT_CHIP_TYPE)/$(PRODUCT_DEVICE)_$(CFG_SOCT_CHIP_TYPE)_defconfig
################################################################################
CFG_SANDBOX_LXC := $(strip $(CFG_SANDBOX_LXC))
################################################################################
KERNEL_OUT_DIR := $(KERNEL_SRC_DIR)/out
BUILD_DIR := $(KERNEL_OUT_DIR)
$(shell mkdir -p $(KERNEL_OUT_DIR))
################################################################################
TARGET_IMAGE = $(KERNEL_OUT_DIR)/arch/arm64/boot/Image
################################################################################
IMAGE_DIR:=$(strip $(HL_IMAGE_SUBDIR))
################################################################################
KERNEL_CFLAGS += -DCONFIG_SOCT_SND_AMP_SUPPORT -DCONFIG_SUPPORT_CA -DCONFIG_CA_WARKUP_CHECK -DCONFIG_TEE -DCONFIG_TEE_SOCT \
-DCONFIG_SECURE_EXTENSION -DCONFIG_TZDRIVER -DCONFIG_DEVCHIP_PLATFORM -DCONFIG_ARM_PSCI \
-DCONFIG_ARM32_ATF_SUPPORT -DCONFIG_ARM_PSCI_FW -DCONFIG_SOCT_LOWRAM -DCONFIG_SOCT_CLANG \
-DCONFIG_TEE_RESERVED_MEM -DCONFIG_TEE_RESERVED_MEM_ADDR=0x221F0000 \
-DCONFIG_TEE_RESERVED_MEM_SIZE=0x9C20000
KERNEL_AFLAGS := $(KERNEL_CFLAGS)
all: $(TARGET_IMAGE)
$(call copy_image,$(TARGET_IMAGE),kernel.bin,$(IMAGE_DIR))
################################################################################
$(KERNEL_OUT_DIR)/arch/arm64/boot/Image: $(KERNEL_OUT_DIR)/.config
PATH=$(KERNEL_TOOLS_PATH) $(MAKE) -C $(KERNEL_SRC_DIR) \
$(SET_CC_CLANG) \
ARCH=arm64 \
CROSS_COMPILE=$(CROSS_COMPILE) \
O=$(BUILD_DIR) \
CFLAGS_KERNEL="$(KERNEL_CFLAGS)" \
AFLAGS_KERNEL="$(KERNEL_AFLAGS)" \
Image modules dtbs
################################################################################
menuconfig: $(KERNEL_OUT_DIR)/.config
PATH=$(KERNEL_TOOLS_PATH) $(MAKE) -C $(KERNEL_SRC_DIR) \
$(SET_CC_CLANG) \
ARCH=arm64 \
CROSS_COMPILE=$(CROSS_COMPILE) \
O=$(BUILD_DIR) \
menuconfig
################################################################################
$(KERNEL_OUT_DIR)/.config:
PATH=$(KERNEL_TOOLS_PATH) $(MAKE) -C $(KERNEL_SRC_DIR) \
ARCH=arm64 \
$(SET_CC_CLANG) \
CROSS_COMPILE=$(CROSS_COMPILE) \
O=$(BUILD_DIR) \
CFLAGS_KERNEL="$(KERNEL_CFLAGS)" \
AFLAGS_KERNEL="$(KERNEL_AFLAGS)" \
$(KERNEL_CONFIG)
################################################################################
fs_buildin: $(KERNEL_OUT_DIR)/.config
PATH=$(KERNEL_TOOLS_PATH) $(MAKE) -C $(KERNEL_SRC_DIR) ARCH=arm64 \
$(SET_CC_CLANG) \
CROSS_COMPILE=$(CROSS_COMPILE) \
O=$(BUILD_DIR) \
Image dtbs
$(call copy_image,$(TARGET_IMAGE),kernel.bin,$(IMAGE_DIR))
################################################################################
distclean: clean
PATH=$(KERNEL_TOOLS_PATH) $(MAKE) -C $(KERNEL_SRC_DIR) \
$(SET_CC_CLANG) \
ARCH=arm64 \
CROSS_COMPILE=$(CROSS_COMPILE) \
O=$(BUILD_DIR) \
distclean
################################################################################
clean:
PATH=$(KERNEL_TOOLS_PATH) $(MAKE) -C $(KERNEL_SRC_DIR) ARCH=arm64 \
$(SET_CC_CLANG) \
CROSS_COMPILE=$(CROSS_COMPILE) \
O=$(BUILD_DIR) \
clean
$(call remove_image, $(IMAGE_DIR)/kernel.bin)
$(Q)rm -rf $(MODULE_DIR)
################################################################################
kconfig-dynamic:
$(shell $(VENDOR_DIR)/huanglong/linux/scripts/build_kernel.sh -b $(BASED_FILE) -i $(INPUT_FILE) -d "$(INPUT_CONFIG)" -o $(OUTPUT_FILE))
$(hide) echo "kconfig updated by bash"
################################################################################
.PHONY: all clean distclean kconfig-dynamic
################################################################################