Aaron Kling | 51e93ce | 2024-01-02 21:13:18 -0600 | [diff] [blame] | 1 | # Copyright (C) 2018-2024 The LineageOS Project |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | # |
| 15 | # |
| 16 | # Kernel build configuration variables |
| 17 | # ==================================== |
| 18 | # |
| 19 | # These config vars are usually set in BoardConfig.mk: |
| 20 | # |
| 21 | # TARGET_KERNEL_SOURCE = Kernel source dir, optional, defaults |
| 22 | # to kernel/$(TARGET_DEVICE_DIR) |
| 23 | # TARGET_KERNEL_ARCH = Kernel Arch |
| 24 | # TARGET_KERNEL_CROSS_COMPILE_PREFIX = Compiler prefix (e.g. arm-eabi-) |
| 25 | # defaults to arm-linux-androidkernel- for arm |
dianlujitao | bd16a8e | 2019-09-08 12:44:49 +0800 | [diff] [blame] | 26 | # aarch64-linux-android- for arm64 |
| 27 | # x86_64-linux-android- for x86 |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 28 | # |
Alexander Koskovich | e8e46e6 | 2022-03-07 11:29:34 -0700 | [diff] [blame] | 29 | # TARGET_KERNEL_CLANG_COMPILE = Compile kernel with clang, defaults to true |
Michael Bestas | b9c7304 | 2022-11-01 14:41:42 +0200 | [diff] [blame] | 30 | # TARGET_KERNEL_CLANG_VERSION = Clang prebuilts version, optional, defaults to clang-stable |
| 31 | # TARGET_KERNEL_CLANG_PATH = Clang prebuilts path, optional |
| 32 | # |
Michael Bestas | 4d700e7 | 2022-09-08 04:19:32 +0300 | [diff] [blame] | 33 | # TARGET_KERNEL_LLVM_BINUTILS = Use LLVM binutils, defaults to true |
Michael Bestas | 38ba7c0 | 2022-11-14 13:09:00 +0200 | [diff] [blame] | 34 | # TARGET_KERNEL_NO_GCC = Fully compile the kernel without GCC. |
| 35 | # Defaults to false |
Michael Bestas | 826cbec | 2023-05-26 21:33:48 +0300 | [diff] [blame] | 36 | # TARGET_KERNEL_VERSION = Reported kernel version in top level kernel |
| 37 | # makefile. Can be overriden in device trees |
| 38 | # in the event of prebuilt kernel. |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 39 | # |
Michael Bestas | 581a386 | 2022-08-10 06:44:40 +0300 | [diff] [blame] | 40 | # TARGET_KERNEL_DTBO_PREFIX = Override path prefix of TARGET_KERNEL_DTBO. |
| 41 | # Defaults to empty |
Michael Bestas | 15a631e | 2022-08-10 05:18:59 +0300 | [diff] [blame] | 42 | # TARGET_KERNEL_DTBO = Name of the kernel Makefile target that |
| 43 | # generates dtbo.img. Defaults to dtbo.img |
Michael Bestas | a7999b0 | 2022-08-10 05:29:55 +0300 | [diff] [blame] | 44 | # TARGET_KERNEL_DTB = Name of the kernel Makefile target that |
| 45 | # generates the *.dtb targets. Defaults to dtbs |
Michael Bestas | 15a631e | 2022-08-10 05:18:59 +0300 | [diff] [blame] | 46 | # |
Neel Chauhan | e546ac8 | 2022-07-21 09:30:48 -0700 | [diff] [blame] | 47 | # TARGET_KERNEL_EXT_MODULE_ROOT = Optional, the external modules root directory |
| 48 | # Defaults to empty |
| 49 | # TARGET_KERNEL_EXT_MODULES = Optional, the external modules we are |
| 50 | # building. Defaults to empty |
| 51 | # |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 52 | # KERNEL_TOOLCHAIN_PREFIX = Overrides TARGET_KERNEL_CROSS_COMPILE_PREFIX, |
| 53 | # Set this var in shell to override |
| 54 | # toolchain specified in BoardConfig.mk |
| 55 | # KERNEL_TOOLCHAIN = Path to toolchain, if unset, assumes |
| 56 | # TARGET_KERNEL_CROSS_COMPILE_PREFIX |
| 57 | # is in PATH |
| 58 | # USE_CCACHE = Enable ccache (global Android flag) |
| 59 | |
Jason Wojcik | 4916cab | 2021-03-23 10:46:09 -0700 | [diff] [blame] | 60 | BUILD_TOP := $(abspath .) |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 61 | |
| 62 | TARGET_AUTO_KDIR := $(shell echo $(TARGET_DEVICE_DIR) | sed -e 's/^device/kernel/g') |
| 63 | TARGET_KERNEL_SOURCE ?= $(TARGET_AUTO_KDIR) |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 64 | |
| 65 | TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH)) |
| 66 | ifeq ($(TARGET_KERNEL_ARCH),) |
Michael Bestas | f0b1dd6 | 2022-10-01 00:33:17 +0300 | [diff] [blame] | 67 | KERNEL_ARCH := $(TARGET_ARCH) |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 68 | else |
Michael Bestas | f0b1dd6 | 2022-10-01 00:33:17 +0300 | [diff] [blame] | 69 | KERNEL_ARCH := $(TARGET_KERNEL_ARCH) |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 70 | endif |
| 71 | |
Chirayu Desai | 63dbd4e | 2022-07-08 03:33:22 +0530 | [diff] [blame] | 72 | KERNEL_VERSION := $(shell grep -s "^VERSION = " $(TARGET_KERNEL_SOURCE)/Makefile | awk '{ print $$3 }') |
| 73 | KERNEL_PATCHLEVEL := $(shell grep -s "^PATCHLEVEL = " $(TARGET_KERNEL_SOURCE)/Makefile | awk '{ print $$3 }') |
Michael Bestas | 826cbec | 2023-05-26 21:33:48 +0300 | [diff] [blame] | 74 | TARGET_KERNEL_VERSION ?= $(shell echo $(KERNEL_VERSION)"."$(KERNEL_PATCHLEVEL)) |
Alexander Koskovich | 8655c4a | 2022-06-15 08:46:57 -0700 | [diff] [blame] | 75 | |
Michael Bestas | 38ba7c0 | 2022-11-14 13:09:00 +0200 | [diff] [blame] | 76 | # 5.10+ can fully compile without GCC by default |
LuK1337 | 97890e3 | 2023-08-01 19:59:14 +0200 | [diff] [blame] | 77 | ifneq ($(KERNEL_VERSION),) |
Aaron Kling | 51e93ce | 2024-01-02 21:13:18 -0600 | [diff] [blame] | 78 | ifeq ($(shell expr $(KERNEL_VERSION) \>= 6), 1) |
| 79 | TARGET_KERNEL_NO_GCC ?= true |
| 80 | else ifeq ($(shell expr $(KERNEL_VERSION) \>= 5), 1) |
LuK1337 | 97890e3 | 2023-08-01 19:59:14 +0200 | [diff] [blame] | 81 | ifeq ($(shell expr $(KERNEL_PATCHLEVEL) \>= 10), 1) |
| 82 | TARGET_KERNEL_NO_GCC ?= true |
| 83 | endif |
Bruno Martins | 44b8553 | 2023-05-11 21:53:03 +0100 | [diff] [blame] | 84 | endif |
Michael Bestas | 38ba7c0 | 2022-11-14 13:09:00 +0200 | [diff] [blame] | 85 | endif |
| 86 | |
| 87 | ifeq ($(TARGET_KERNEL_NO_GCC), true) |
| 88 | KERNEL_NO_GCC := true |
| 89 | endif |
| 90 | |
Michael Bestas | b9c7304 | 2022-11-01 14:41:42 +0200 | [diff] [blame] | 91 | ifneq ($(TARGET_KERNEL_CLANG_VERSION),) |
| 92 | KERNEL_CLANG_VERSION := clang-$(TARGET_KERNEL_CLANG_VERSION) |
| 93 | else |
| 94 | # Use the default version of clang if TARGET_KERNEL_CLANG_VERSION hasn't been set by the device config |
micky387 | 53722ce | 2024-10-12 10:40:41 -0400 | [diff] [blame] | 95 | KERNEL_CLANG_VERSION := $(LLVM_AOSP_PREBUILTS_VERSION) |
Michael Bestas | b9c7304 | 2022-11-01 14:41:42 +0200 | [diff] [blame] | 96 | endif |
| 97 | TARGET_KERNEL_CLANG_PATH ?= $(BUILD_TOP)/prebuilts/clang/host/$(HOST_PREBUILT_TAG)/$(KERNEL_CLANG_VERSION) |
Michael Bestas | ae531bc | 2022-10-01 00:38:14 +0300 | [diff] [blame] | 98 | |
| 99 | ifneq ($(USE_CCACHE),) |
| 100 | ifneq ($(CCACHE_EXEC),) |
| 101 | # Android 10+ deprecates use of a build ccache. Only system installed ones are now allowed |
| 102 | CCACHE_BIN := $(CCACHE_EXEC) |
| 103 | endif |
| 104 | endif |
| 105 | |
| 106 | # Clear this first to prevent accidental poisoning from env |
| 107 | KERNEL_MAKE_FLAGS := |
| 108 | |
Alexander Koskovich | 76ce4f8 | 2022-08-04 13:00:07 -0700 | [diff] [blame] | 109 | # Add back threads, ninja cuts this to $(getconf _NPROCESSORS_ONLN)/2 |
| 110 | KERNEL_MAKE_FLAGS += -j$(shell getconf _NPROCESSORS_ONLN) |
Michael Bestas | ae531bc | 2022-10-01 00:38:14 +0300 | [diff] [blame] | 111 | |
| 112 | TOOLS_PATH_OVERRIDE := \ |
voidanix | ebf8bca | 2024-11-20 00:59:00 +0100 | [diff] [blame] | 113 | HIP_PATH=none PERL5LIB=$(BUILD_TOP)/prebuilts/tools-lineage/common/perl-base |
Michael Bestas | ae531bc | 2022-10-01 00:38:14 +0300 | [diff] [blame] | 114 | |
Michael Bestas | 38ba7c0 | 2022-11-14 13:09:00 +0200 | [diff] [blame] | 115 | ifneq ($(KERNEL_NO_GCC), true) |
Michael Bestas | 3b11b2a | 2022-09-10 23:19:55 +0300 | [diff] [blame] | 116 | GCC_PREBUILTS := $(BUILD_TOP)/prebuilts/gcc/$(HOST_PREBUILT_TAG) |
| 117 | # arm64 toolchain |
| 118 | KERNEL_TOOLCHAIN_arm64 := $(GCC_PREBUILTS)/aarch64/aarch64-linux-android-4.9/bin |
| 119 | KERNEL_TOOLCHAIN_PREFIX_arm64 := aarch64-linux-android- |
| 120 | # arm toolchain |
| 121 | KERNEL_TOOLCHAIN_arm := $(GCC_PREBUILTS)/arm/arm-linux-androideabi-4.9/bin |
| 122 | KERNEL_TOOLCHAIN_PREFIX_arm := arm-linux-androidkernel- |
| 123 | # x86 toolchain |
| 124 | KERNEL_TOOLCHAIN_x86 := $(GCC_PREBUILTS)/x86/x86_64-linux-android-4.9/bin |
| 125 | KERNEL_TOOLCHAIN_PREFIX_x86 := x86_64-linux-android- |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 126 | |
Michael Bestas | 3b11b2a | 2022-09-10 23:19:55 +0300 | [diff] [blame] | 127 | TARGET_KERNEL_CROSS_COMPILE_PREFIX := $(strip $(TARGET_KERNEL_CROSS_COMPILE_PREFIX)) |
| 128 | ifneq ($(TARGET_KERNEL_CROSS_COMPILE_PREFIX),) |
| 129 | KERNEL_TOOLCHAIN_PREFIX ?= $(TARGET_KERNEL_CROSS_COMPILE_PREFIX) |
| 130 | else |
| 131 | KERNEL_TOOLCHAIN ?= $(KERNEL_TOOLCHAIN_$(KERNEL_ARCH)) |
| 132 | KERNEL_TOOLCHAIN_PREFIX ?= $(KERNEL_TOOLCHAIN_PREFIX_$(KERNEL_ARCH)) |
| 133 | endif |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 134 | |
Michael Bestas | 3b11b2a | 2022-09-10 23:19:55 +0300 | [diff] [blame] | 135 | ifeq ($(KERNEL_TOOLCHAIN),) |
| 136 | KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN_PREFIX) |
| 137 | else |
| 138 | KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN)/$(KERNEL_TOOLCHAIN_PREFIX) |
| 139 | endif |
Rashed Abdel-Tawab | c648519 | 2019-09-10 08:38:34 -0700 | [diff] [blame] | 140 | |
Michael Bestas | 3b11b2a | 2022-09-10 23:19:55 +0300 | [diff] [blame] | 141 | # We need to add GCC toolchain to the path no matter what |
| 142 | # for tools like `as` |
| 143 | KERNEL_TOOLCHAIN_PATH_gcc := $(KERNEL_TOOLCHAIN_$(KERNEL_ARCH)) |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 144 | |
Michael Bestas | 3b11b2a | 2022-09-10 23:19:55 +0300 | [diff] [blame] | 145 | ifneq ($(TARGET_KERNEL_CLANG_COMPILE),false) |
| 146 | KERNEL_CROSS_COMPILE := CROSS_COMPILE="$(KERNEL_TOOLCHAIN_PATH)" |
| 147 | else |
| 148 | KERNEL_CROSS_COMPILE := CROSS_COMPILE="$(CCACHE_BIN) $(KERNEL_TOOLCHAIN_PATH)" |
| 149 | endif |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 150 | |
Michael Bestas | 3b11b2a | 2022-09-10 23:19:55 +0300 | [diff] [blame] | 151 | # Needed for CONFIG_COMPAT_VDSO, safe to set for all arm64 builds |
| 152 | ifeq ($(KERNEL_ARCH),arm64) |
| 153 | KERNEL_CROSS_COMPILE += CROSS_COMPILE_ARM32="$(KERNEL_TOOLCHAIN_arm)/$(KERNEL_TOOLCHAIN_PREFIX_arm)" |
| 154 | KERNEL_CROSS_COMPILE += CROSS_COMPILE_COMPAT="$(KERNEL_TOOLCHAIN_arm)/$(KERNEL_TOOLCHAIN_PREFIX_arm)" |
| 155 | endif |
| 156 | |
| 157 | ifeq ($(TARGET_KERNEL_CLANG_COMPILE),false) |
| 158 | ifeq ($(KERNEL_ARCH),arm) |
| 159 | # Avoid "Unknown symbol _GLOBAL_OFFSET_TABLE_" errors |
| 160 | KERNEL_MAKE_FLAGS += CFLAGS_MODULE="-fno-pic" |
| 161 | endif |
| 162 | |
| 163 | ifeq ($(KERNEL_ARCH),arm64) |
| 164 | # Avoid "unsupported RELA relocation: 311" errors (R_AARCH64_ADR_GOT_PAGE) |
| 165 | KERNEL_MAKE_FLAGS += CFLAGS_MODULE="-fno-pic" |
| 166 | endif |
| 167 | endif |
| 168 | |
Michael Bestas | 63354f7 | 2022-11-01 14:54:44 +0200 | [diff] [blame] | 169 | 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" |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 170 | |
Michael Bestas | f0b1dd6 | 2022-10-01 00:33:17 +0300 | [diff] [blame] | 171 | ifeq ($(KERNEL_ARCH),arm64) |
Michael Bestas | 3b11b2a | 2022-09-10 23:19:55 +0300 | [diff] [blame] | 172 | # Add 32-bit GCC to PATH so that arm-linux-androidkernel-as is available for CONFIG_COMPAT_VDSO |
| 173 | TOOLS_PATH_OVERRIDE += PATH=$(BUILD_TOP)/prebuilts/tools-lineage/$(HOST_PREBUILT_TAG)/bin:$(KERNEL_TOOLCHAIN_arm):$$PATH |
| 174 | else |
| 175 | TOOLS_PATH_OVERRIDE += PATH=$(BUILD_TOP)/prebuilts/tools-lineage/$(HOST_PREBUILT_TAG)/bin:$$PATH |
Michael Bestas | f0b1dd6 | 2022-10-01 00:33:17 +0300 | [diff] [blame] | 176 | endif |
Rashed Abdel-Tawab | a836d79 | 2018-09-20 15:19:57 -0700 | [diff] [blame] | 177 | |
Michael Bestas | 3b11b2a | 2022-09-10 23:19:55 +0300 | [diff] [blame] | 178 | # Set the full path to the clang command and LLVM binutils |
Michael Bestas | b9c7304 | 2022-11-01 14:41:42 +0200 | [diff] [blame] | 179 | KERNEL_MAKE_FLAGS += HOSTCC=$(TARGET_KERNEL_CLANG_PATH)/bin/clang |
| 180 | KERNEL_MAKE_FLAGS += HOSTCXX=$(TARGET_KERNEL_CLANG_PATH)/bin/clang++ |
Michael Bestas | 3b11b2a | 2022-09-10 23:19:55 +0300 | [diff] [blame] | 181 | ifneq ($(TARGET_KERNEL_CLANG_COMPILE), false) |
| 182 | ifneq ($(TARGET_KERNEL_LLVM_BINUTILS), false) |
Michael Bestas | b9c7304 | 2022-11-01 14:41:42 +0200 | [diff] [blame] | 183 | KERNEL_MAKE_FLAGS += LD=$(TARGET_KERNEL_CLANG_PATH)/bin/ld.lld |
| 184 | KERNEL_MAKE_FLAGS += AR=$(TARGET_KERNEL_CLANG_PATH)/bin/llvm-ar |
Michael Bestas | 3b11b2a | 2022-09-10 23:19:55 +0300 | [diff] [blame] | 185 | endif |
Michael Bestas | ae531bc | 2022-10-01 00:38:14 +0300 | [diff] [blame] | 186 | endif |
Michael Bestas | 3b11b2a | 2022-09-10 23:19:55 +0300 | [diff] [blame] | 187 | else |
| 188 | KERNEL_MAKE_FLAGS += HOSTCFLAGS="--sysroot=$(BUILD_TOP)/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -I$(BUILD_TOP)/prebuilts/kernel-build-tools/linux-x86/include" |
| 189 | KERNEL_MAKE_FLAGS += HOSTLDFLAGS="--sysroot=$(BUILD_TOP)/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -Wl,-rpath,$(BUILD_TOP)/prebuilts/kernel-build-tools/linux-x86/lib64 -L $(BUILD_TOP)/prebuilts/kernel-build-tools/linux-x86/lib64 -fuse-ld=lld --rtlib=compiler-rt" |
| 190 | |
Michael Bestas | b9c7304 | 2022-11-01 14:41:42 +0200 | [diff] [blame] | 191 | TOOLS_PATH_OVERRIDE += PATH=$(BUILD_TOP)/prebuilts/tools-lineage/$(HOST_PREBUILT_TAG)/bin:$(TARGET_KERNEL_CLANG_PATH)/bin:$$PATH |
Michael Bestas | ae531bc | 2022-10-01 00:38:14 +0300 | [diff] [blame] | 192 | endif |
| 193 | |
Rashed Abdel-Tawab | 60fe935 | 2019-05-16 14:01:19 -0700 | [diff] [blame] | 194 | # Set DTBO image locations so the build system knows to build them |
Luca Stefani | fe00ea9 | 2020-08-02 19:08:31 +0200 | [diff] [blame] | 195 | ifeq (true,$(filter true, $(TARGET_NEEDS_DTBOIMAGE) $(BOARD_KERNEL_SEPARATED_DTBO))) |
Michael Bestas | f0b1dd6 | 2022-10-01 00:33:17 +0300 | [diff] [blame] | 196 | TARGET_KERNEL_DTBO_PREFIX ?= |
| 197 | TARGET_KERNEL_DTBO ?= dtbo.img |
| 198 | BOARD_PREBUILT_DTBOIMAGE ?= $(TARGET_OUT_INTERMEDIATES)/DTBO_OBJ/arch/$(KERNEL_ARCH)/boot/$(TARGET_KERNEL_DTBO_PREFIX)$(TARGET_KERNEL_DTBO) |
Rashed Abdel-Tawab | 60fe935 | 2019-05-16 14:01:19 -0700 | [diff] [blame] | 199 | endif |
Rashed Abdel-Tawab | fb35b9d | 2019-09-05 21:21:13 -0700 | [diff] [blame] | 200 | |
Michael Bestas | a7999b0 | 2022-08-10 05:29:55 +0300 | [diff] [blame] | 201 | # Set the default dtb target |
| 202 | TARGET_KERNEL_DTB ?= dtbs |
| 203 | |
Neel Chauhan | e546ac8 | 2022-07-21 09:30:48 -0700 | [diff] [blame] | 204 | # Set no external modules by default |
| 205 | TARGET_KERNEL_EXT_MODULE_ROOT ?= |
| 206 | TARGET_KERNEL_EXT_MODULES ?= |
| 207 | |
Rashed Abdel-Tawab | fb35b9d | 2019-09-05 21:21:13 -0700 | [diff] [blame] | 208 | # Set use the full path to the make command |
Bruno Martins | 63d13c3 | 2020-09-24 11:51:33 +0100 | [diff] [blame] | 209 | KERNEL_MAKE_CMD := $(BUILD_TOP)/prebuilts/build-tools/$(HOST_PREBUILT_TAG)/bin/make |
Rashed Abdel-Tawab | 21ee598 | 2019-09-05 21:24:07 -0700 | [diff] [blame] | 210 | |
Michael Bestas | 4d700e7 | 2022-09-08 04:19:32 +0300 | [diff] [blame] | 211 | # Use LLVM's substitutes for GNU binutils |
Alexander Koskovich | 8655c4a | 2022-06-15 08:46:57 -0700 | [diff] [blame] | 212 | ifneq ($(TARGET_KERNEL_CLANG_COMPILE), false) |
Michael Bestas | f0b1dd6 | 2022-10-01 00:33:17 +0300 | [diff] [blame] | 213 | ifneq ($(TARGET_KERNEL_LLVM_BINUTILS), false) |
| 214 | KERNEL_MAKE_FLAGS += LLVM=1 LLVM_IAS=1 |
Michael Bestas | f0b1dd6 | 2022-10-01 00:33:17 +0300 | [diff] [blame] | 215 | endif |
Alexander Koskovich | 8655c4a | 2022-06-15 08:46:57 -0700 | [diff] [blame] | 216 | endif |
| 217 | |
LuK1337 | 4ca8781 | 2023-10-06 09:42:53 +0200 | [diff] [blame] | 218 | # Pass prebuilt LZ4 path |
| 219 | KERNEL_MAKE_FLAGS += LZ4=$(BUILD_TOP)/prebuilts/kernel-build-tools/linux-x86/bin/lz4 |
| 220 | |
dianlujitao | a24144f | 2020-03-11 19:05:29 +0800 | [diff] [blame] | 221 | # Since Linux 4.16, flex and bison are required |
Bruno Martins | 63d13c3 | 2020-09-24 11:51:33 +0100 | [diff] [blame] | 222 | KERNEL_MAKE_FLAGS += LEX=$(BUILD_TOP)/prebuilts/build-tools/$(HOST_PREBUILT_TAG)/bin/flex |
| 223 | KERNEL_MAKE_FLAGS += YACC=$(BUILD_TOP)/prebuilts/build-tools/$(HOST_PREBUILT_TAG)/bin/bison |
Michael Bestas | 3b11b2a | 2022-09-10 23:19:55 +0300 | [diff] [blame] | 224 | KERNEL_MAKE_FLAGS += M4=$(BUILD_TOP)/prebuilts/build-tools/$(HOST_PREBUILT_TAG)/bin/m4 |
dianlujitao | a24144f | 2020-03-11 19:05:29 +0800 | [diff] [blame] | 225 | TOOLS_PATH_OVERRIDE += BISON_PKGDATADIR=$(BUILD_TOP)/prebuilts/build-tools/common/bison |
| 226 | |
Bruno Martins | ca8fd56 | 2023-09-19 15:59:00 +0100 | [diff] [blame] | 227 | # Since Linux 5.10, pahole is required |
| 228 | KERNEL_MAKE_FLAGS += PAHOLE=$(BUILD_TOP)/prebuilts/kernel-build-tools/linux-x86/bin/pahole |
| 229 | |
Rashed Abdel-Tawab | ba5ea35 | 2019-09-07 17:01:13 -0700 | [diff] [blame] | 230 | # Set the out dir for the kernel's O= arg |
| 231 | # This needs to be an absolute path, so only set this if the standard out dir isn't used |
| 232 | OUT_DIR_PREFIX := $(shell echo $(OUT_DIR) | sed -e 's|/target/.*$$||g') |
| 233 | KERNEL_BUILD_OUT_PREFIX := |
| 234 | ifeq ($(OUT_DIR_PREFIX),out) |
Michael Bestas | f0b1dd6 | 2022-10-01 00:33:17 +0300 | [diff] [blame] | 235 | KERNEL_BUILD_OUT_PREFIX := $(BUILD_TOP)/ |
Rashed Abdel-Tawab | ba5ea35 | 2019-09-07 17:01:13 -0700 | [diff] [blame] | 236 | endif |