kernel: Allow devices to opt-in for full LLVM build
android11-5.4 kernel can fully compile with LLVM with a few cherrypicks from android12-5.4 and android12-5.10 Change-Id: Ib71935d284ad78f1c23d039c15bfc5e0314a19eb
This commit is contained in:
@@ -227,7 +227,7 @@ ifeq ($(or $(FULL_RECOVERY_KERNEL_BUILD), $(FULL_KERNEL_BUILD)),true)
|
||||
# Add host bin out dir to path
|
||||
PATH_OVERRIDE := PATH=$(KERNEL_BUILD_OUT_PREFIX)$(HOST_OUT_EXECUTABLES):$$PATH
|
||||
ifneq ($(TARGET_KERNEL_CLANG_COMPILE),false)
|
||||
ifeq (,$(filter 5.10, $(TARGET_KERNEL_VERSION)))
|
||||
ifneq ($(KERNEL_NO_GCC), true)
|
||||
ifeq ($(KERNEL_ARCH),arm64)
|
||||
KERNEL_CLANG_TRIPLE ?= CLANG_TRIPLE=aarch64-linux-gnu-
|
||||
else ifeq ($(KERNEL_ARCH),arm)
|
||||
@@ -243,11 +243,8 @@ ifneq ($(TARGET_KERNEL_CLANG_COMPILE),false)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_KERNEL_LLVM_BINUTILS), false)
|
||||
# 5.10+ can fully compile without gcc
|
||||
ifeq (,$(filter 5.10, $(TARGET_KERNEL_VERSION)))
|
||||
PATH_OVERRIDE += PATH=$(KERNEL_TOOLCHAIN_PATH_gcc):$$PATH
|
||||
endif
|
||||
ifneq ($(KERNEL_NO_GCC), true)
|
||||
PATH_OVERRIDE += PATH=$(KERNEL_TOOLCHAIN_PATH_gcc):$$PATH
|
||||
endif
|
||||
|
||||
# System tools are no longer allowed on 10+
|
||||
|
@@ -31,6 +31,8 @@
|
||||
# TARGET_KERNEL_CLANG_PATH = Clang prebuilts path, optional
|
||||
#
|
||||
# TARGET_KERNEL_LLVM_BINUTILS = Use LLVM binutils, defaults to true
|
||||
# TARGET_KERNEL_NO_GCC = Fully compile the kernel without GCC.
|
||||
# Defaults to false
|
||||
# TARGET_KERNEL_VERSION = Reported kernel version in top level kernel
|
||||
# makefile. Can be overriden in device trees
|
||||
# in the event of prebuilt kernel.
|
||||
@@ -71,6 +73,15 @@ KERNEL_VERSION := $(shell grep -s "^VERSION = " $(TARGET_KERNEL_SOURCE)/Makefile
|
||||
KERNEL_PATCHLEVEL := $(shell grep -s "^PATCHLEVEL = " $(TARGET_KERNEL_SOURCE)/Makefile | awk '{ print $$3 }')
|
||||
TARGET_KERNEL_VERSION ?= $(shell echo $(KERNEL_VERSION)"."$(KERNEL_PATCHLEVEL))
|
||||
|
||||
# 5.10+ can fully compile without GCC by default
|
||||
ifneq (,$(filter 5.10, $(TARGET_KERNEL_VERSION)))
|
||||
TARGET_KERNEL_NO_GCC ?= true
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_KERNEL_NO_GCC), true)
|
||||
KERNEL_NO_GCC := true
|
||||
endif
|
||||
|
||||
ifneq ($(TARGET_KERNEL_CLANG_VERSION),)
|
||||
KERNEL_CLANG_VERSION := clang-$(TARGET_KERNEL_CLANG_VERSION)
|
||||
else
|
||||
@@ -95,8 +106,7 @@ KERNEL_MAKE_FLAGS += -j$(shell getconf _NPROCESSORS_ONLN)
|
||||
TOOLS_PATH_OVERRIDE := \
|
||||
PERL5LIB=$(BUILD_TOP)/prebuilts/tools-lineage/common/perl-base
|
||||
|
||||
# 5.10+ can fully compile without gcc
|
||||
ifeq (,$(filter 5.10, $(TARGET_KERNEL_VERSION)))
|
||||
ifneq ($(KERNEL_NO_GCC), true)
|
||||
GCC_PREBUILTS := $(BUILD_TOP)/prebuilts/gcc/$(HOST_PREBUILT_TAG)
|
||||
# arm64 toolchain
|
||||
KERNEL_TOOLCHAIN_arm64 := $(GCC_PREBUILTS)/aarch64/aarch64-linux-android-4.9/bin
|
||||
|
Reference in New Issue
Block a user