diff --git a/config/BoardConfigKernel.mk b/config/BoardConfigKernel.mk index 33e37538..4ff4209d 100644 --- a/config/BoardConfigKernel.mk +++ b/config/BoardConfigKernel.mk @@ -59,9 +59,9 @@ TARGET_KERNEL_SOURCE ?= $(TARGET_AUTO_KDIR) TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH)) ifeq ($(TARGET_KERNEL_ARCH),) -KERNEL_ARCH := $(TARGET_ARCH) + KERNEL_ARCH := $(TARGET_ARCH) else -KERNEL_ARCH := $(TARGET_KERNEL_ARCH) + KERNEL_ARCH := $(TARGET_KERNEL_ARCH) endif KERNEL_VERSION := $(shell grep -s "^VERSION = " $(TARGET_KERNEL_SOURCE)/Makefile | awk '{ print $$3 }') @@ -82,16 +82,16 @@ KERNEL_TOOLCHAIN_PREFIX_x86 := x86_64-linux-android- TARGET_KERNEL_CROSS_COMPILE_PREFIX := $(strip $(TARGET_KERNEL_CROSS_COMPILE_PREFIX)) ifneq ($(TARGET_KERNEL_CROSS_COMPILE_PREFIX),) -KERNEL_TOOLCHAIN_PREFIX ?= $(TARGET_KERNEL_CROSS_COMPILE_PREFIX) + KERNEL_TOOLCHAIN_PREFIX ?= $(TARGET_KERNEL_CROSS_COMPILE_PREFIX) else -KERNEL_TOOLCHAIN ?= $(KERNEL_TOOLCHAIN_$(KERNEL_ARCH)) -KERNEL_TOOLCHAIN_PREFIX ?= $(KERNEL_TOOLCHAIN_PREFIX_$(KERNEL_ARCH)) + KERNEL_TOOLCHAIN ?= $(KERNEL_TOOLCHAIN_$(KERNEL_ARCH)) + KERNEL_TOOLCHAIN_PREFIX ?= $(KERNEL_TOOLCHAIN_PREFIX_$(KERNEL_ARCH)) endif ifeq ($(KERNEL_TOOLCHAIN),) -KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN_PREFIX) + KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN_PREFIX) else -KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN)/$(KERNEL_TOOLCHAIN_PREFIX) + KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN)/$(KERNEL_TOOLCHAIN_PREFIX) endif # We need to add GCC toolchain to the path no matter what @@ -113,8 +113,8 @@ endif # Needed for CONFIG_COMPAT_VDSO, safe to set for all arm64 builds ifeq ($(KERNEL_ARCH),arm64) - KERNEL_CROSS_COMPILE += CROSS_COMPILE_ARM32="$(KERNEL_TOOLCHAIN_arm)/$(KERNEL_TOOLCHAIN_PREFIX_arm)" - KERNEL_CROSS_COMPILE += CROSS_COMPILE_COMPAT="$(KERNEL_TOOLCHAIN_arm)/$(KERNEL_TOOLCHAIN_PREFIX_arm)" + KERNEL_CROSS_COMPILE += CROSS_COMPILE_ARM32="$(KERNEL_TOOLCHAIN_arm)/$(KERNEL_TOOLCHAIN_PREFIX_arm)" + KERNEL_CROSS_COMPILE += CROSS_COMPILE_COMPAT="$(KERNEL_TOOLCHAIN_arm)/$(KERNEL_TOOLCHAIN_PREFIX_arm)" endif # Clear this first to prevent accidental poisoning from env @@ -124,21 +124,21 @@ KERNEL_MAKE_FLAGS := KERNEL_MAKE_FLAGS += -j$(shell prebuilts/tools-lineage/$(HOST_PREBUILT_TAG)/bin/nproc --all) ifeq ($(TARGET_KERNEL_CLANG_COMPILE),false) - ifeq ($(KERNEL_ARCH),arm) - # Avoid "Unknown symbol _GLOBAL_OFFSET_TABLE_" errors - KERNEL_MAKE_FLAGS += CFLAGS_MODULE="-fno-pic" - endif + ifeq ($(KERNEL_ARCH),arm) + # Avoid "Unknown symbol _GLOBAL_OFFSET_TABLE_" errors + KERNEL_MAKE_FLAGS += CFLAGS_MODULE="-fno-pic" + endif - ifeq ($(KERNEL_ARCH),arm64) - # Avoid "unsupported RELA relocation: 311" errors (R_AARCH64_ADR_GOT_PAGE) - KERNEL_MAKE_FLAGS += CFLAGS_MODULE="-fno-pic" - endif + ifeq ($(KERNEL_ARCH),arm64) + # Avoid "unsupported RELA relocation: 311" errors (R_AARCH64_ADR_GOT_PAGE) + KERNEL_MAKE_FLAGS += CFLAGS_MODULE="-fno-pic" + endif endif ifeq ($(HOST_OS),darwin) - KERNEL_MAKE_FLAGS += HOSTCFLAGS="-I$(BUILD_TOP)/external/elfutils/libelf -I/usr/local/opt/openssl/include" HOSTLDFLAGS="-L/usr/local/opt/openssl/lib -fuse-ld=lld" + KERNEL_MAKE_FLAGS += HOSTCFLAGS="-I$(BUILD_TOP)/external/elfutils/libelf -I/usr/local/opt/openssl/include" HOSTLDFLAGS="-L/usr/local/opt/openssl/lib -fuse-ld=lld" else - KERNEL_MAKE_FLAGS += CPATH="/usr/include:/usr/include/x86_64-linux-gnu" HOSTLDFLAGS="-L/usr/lib/x86_64-linux-gnu -L/usr/lib64 -fuse-ld=lld" + KERNEL_MAKE_FLAGS += CPATH="/usr/include:/usr/include/x86_64-linux-gnu" HOSTLDFLAGS="-L/usr/lib/x86_64-linux-gnu -L/usr/lib64 -fuse-ld=lld" endif TOOLS_PATH_OVERRIDE := \ @@ -146,17 +146,17 @@ TOOLS_PATH_OVERRIDE := \ PERL5LIB=$(BUILD_TOP)/prebuilts/tools-lineage/common/perl-base ifeq ($(KERNEL_ARCH),arm64) - # Add 32-bit GCC to PATH so that arm-linux-androidkernel-as is available for CONFIG_COMPAT_VDSO - TOOLS_PATH_OVERRIDE += PATH=$(BUILD_TOP)/prebuilts/tools-lineage/$(HOST_PREBUILT_TAG)/bin:$(KERNEL_TOOLCHAIN_arm):$$PATH + # Add 32-bit GCC to PATH so that arm-linux-androidkernel-as is available for CONFIG_COMPAT_VDSO + TOOLS_PATH_OVERRIDE += PATH=$(BUILD_TOP)/prebuilts/tools-lineage/$(HOST_PREBUILT_TAG)/bin:$(KERNEL_TOOLCHAIN_arm):$$PATH else - TOOLS_PATH_OVERRIDE += PATH=$(BUILD_TOP)/prebuilts/tools-lineage/$(HOST_PREBUILT_TAG)/bin:$$PATH + TOOLS_PATH_OVERRIDE += PATH=$(BUILD_TOP)/prebuilts/tools-lineage/$(HOST_PREBUILT_TAG)/bin:$$PATH endif # Set DTBO image locations so the build system knows to build them ifeq (true,$(filter true, $(TARGET_NEEDS_DTBOIMAGE) $(BOARD_KERNEL_SEPARATED_DTBO))) -TARGET_KERNEL_DTBO_PREFIX ?= -TARGET_KERNEL_DTBO ?= dtbo.img -BOARD_PREBUILT_DTBOIMAGE ?= $(TARGET_OUT_INTERMEDIATES)/DTBO_OBJ/arch/$(KERNEL_ARCH)/boot/$(TARGET_KERNEL_DTBO_PREFIX)$(TARGET_KERNEL_DTBO) + TARGET_KERNEL_DTBO_PREFIX ?= + TARGET_KERNEL_DTBO ?= dtbo.img + BOARD_PREBUILT_DTBOIMAGE ?= $(TARGET_OUT_INTERMEDIATES)/DTBO_OBJ/arch/$(KERNEL_ARCH)/boot/$(TARGET_KERNEL_DTBO_PREFIX)$(TARGET_KERNEL_DTBO) endif # Set the default dtb target @@ -175,11 +175,11 @@ KERNEL_MAKE_FLAGS += HOSTCXX=$(CLANG_PREBUILTS)/bin/clang++ # Use LLVM's substitutes for GNU binutils ifneq ($(TARGET_KERNEL_CLANG_COMPILE), false) -ifneq ($(TARGET_KERNEL_LLVM_BINUTILS), false) - KERNEL_MAKE_FLAGS += LLVM=1 LLVM_IAS=1 - KERNEL_MAKE_FLAGS += LD=$(CLANG_PREBUILTS)/bin/ld.lld - KERNEL_MAKE_FLAGS += AR=$(CLANG_PREBUILTS)/bin/llvm-ar -endif + ifneq ($(TARGET_KERNEL_LLVM_BINUTILS), false) + KERNEL_MAKE_FLAGS += LLVM=1 LLVM_IAS=1 + KERNEL_MAKE_FLAGS += LD=$(CLANG_PREBUILTS)/bin/ld.lld + KERNEL_MAKE_FLAGS += AR=$(CLANG_PREBUILTS)/bin/llvm-ar + endif endif # Since Linux 4.16, flex and bison are required @@ -193,5 +193,5 @@ TOOLS_PATH_OVERRIDE += BISON_PKGDATADIR=$(BUILD_TOP)/prebuilts/build-tools/commo OUT_DIR_PREFIX := $(shell echo $(OUT_DIR) | sed -e 's|/target/.*$$||g') KERNEL_BUILD_OUT_PREFIX := ifeq ($(OUT_DIR_PREFIX),out) -KERNEL_BUILD_OUT_PREFIX := $(BUILD_TOP)/ + KERNEL_BUILD_OUT_PREFIX := $(BUILD_TOP)/ endif