Commit 961af007 authored by Chirayu Desai's avatar Chirayu Desai Committed by dianlujitao
Browse files

kernel: Implement build time LTO choice

Change-Id: I898eb50fadb6bde5beebf46f443c5de7e6acc907
parent 3191fee6
......@@ -55,6 +55,8 @@
# aarch64-linux-gnu- for arm64
# x86_64-linux-gnu- for x86
#
# KERNEL_LTO = Optional, force LTO to none / thin / full
#
# NEED_KERNEL_MODULE_ROOT = Optional, if true, install kernel
# modules in root instead of vendor
# NEED_KERNEL_MODULE_SYSTEM = Optional, if true, install kernel
......@@ -275,6 +277,31 @@ endef
# $(2): The defconfig to process (just the filename, no need for full path to file)
define make-kernel-config
$(call internal-make-kernel-target,$(1),VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(2))
$(hide) if [ "$(KERNEL_LTO)" = "none" ]; then \
$(KERNEL_SRC)/scripts/config --file $(1)/.config \
-d LTO_CLANG \
-e LTO_NONE \
-d LTO_CLANG_THIN \
-d LTO_CLANG_FULL \
-d THINLTO; \
$(call make-kernel-target,olddefconfig); \
elif [ "$(KERNEL_LTO)" = "thin" ]; then \
$(KERNEL_SRC)/scripts/config --file $(1)/.config \
-e LTO_CLANG \
-d LTO_NONE \
-e LTO_CLANG_THIN \
-d LTO_CLANG_FULL \
-e THINLTO; \
$(call make-kernel-target,olddefconfig); \
elif [ "$(KERNEL_LTO)" = "full" ]; then \
$(KERNEL_SRC)/scripts/config --file $(1)/.config \
-e LTO_CLANG \
-d LTO_NONE \
-d LTO_CLANG_THIN \
-e LTO_CLANG_FULL \
-d THINLTO; \
$(call make-kernel-target,olddefconfig); \
fi
$(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \
echo $(KERNEL_CONFIG_OVERRIDE) >> $(1)/.config; \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment