From 2130319a7f803d8286e61c874b41d55f22def70e Mon Sep 17 00:00:00 2001 From: Nolen Johnson Date: Tue, 22 Apr 2025 15:17:00 -0400 Subject: [PATCH] Revert "kernel: Add support for external kernel configs" This reverts commit 1b1687b456ca1bf9a1c7832a0d283a1816f97d90. Reason: Breaks variant defconfigs. Change-Id: Ie81301eb5a3376ab969430eed54a432d7d300408 --- build/tasks/kernel.mk | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk index ba009bab..38674fc7 100644 --- a/build/tasks/kernel.mk +++ b/build/tasks/kernel.mk @@ -26,10 +26,6 @@ # while all the others are fragments that will be merged # to main one in .config. # TARGET_KERNEL_RECOVERY_CONFIG = Same as above, but applicable to recovery kernel instead. -# TARGET_KERNEL_CONFIG_EXT = List of path to external kernel defconfigs. -# Same as TARGET_KERNEL_CONFIG, but paths are specified -# instead of filenames. -# TARGET_KERNEL_RECOVERY_CONFIG_EXT = Same as above, but applicable to recovery kernel instead. # TARGET_KERNEL_VARIANT_CONFIG = Variant defconfig, optional # TARGET_KERNEL_SELINUX_CONFIG = SELinux defconfig, optional # @@ -66,11 +62,6 @@ # # KERNEL_LTO = Optional, force LTO to none / thin / full # -# MERGE_ALL_KERNEL_CONFIGS_AT_ONCE = Optional, whether or not to merge all kernel config -# fragments in one merge_configs.sh call. if true, -# kernel config fragments will get merged faster, but -# may cause some differences. -# # NEED_KERNEL_MODULE_ROOT = Optional, if true, install kernel # modules in root instead of vendor # NEED_KERNEL_MODULE_SYSTEM = Optional, if true, install kernel @@ -90,11 +81,8 @@ ifneq ($(TARGET_NO_KERNEL_OVERRIDE),true) ## Externally influenced variables KERNEL_SRC := $(TARGET_KERNEL_SOURCE) # kernel configuration - mandatory -MERGE_ALL_KERNEL_CONFIGS_AT_ONCE ?= false KERNEL_DEFCONFIG := $(TARGET_KERNEL_CONFIG) -KERNEL_DEFCONFIG_EXT := $(TARGET_KERNEL_CONFIG_EXT) RECOVERY_DEFCONFIG := $(TARGET_KERNEL_RECOVERY_CONFIG) -RECOVERY_DEFCONFIG_EXT := $(TARGET_KERNEL_RECOVERY_CONFIG_EXT) VARIANT_DEFCONFIG := $(TARGET_KERNEL_VARIANT_CONFIG) SELINUX_DEFCONFIG := $(TARGET_KERNEL_SELINUX_CONFIG) # dtb generation - optional @@ -124,13 +112,12 @@ else KERNEL_DEFCONFIG_ARCH := $(KERNEL_ARCH) endif KERNEL_DEFCONFIG_DIR := $(KERNEL_SRC)/arch/$(KERNEL_DEFCONFIG_ARCH)/configs - ALL_KERNEL_DEFCONFIG_SRCS := $(foreach config,$(KERNEL_DEFCONFIG),$(KERNEL_DEFCONFIG_DIR)/$(config)) -ALL_KERNEL_DEFCONFIG_SRCS += $(KERNEL_DEFCONFIG_EXT) ALL_RECOVERY_KERNEL_DEFCONFIG_SRCS := $(foreach config,$(RECOVERY_DEFCONFIG),$(KERNEL_DEFCONFIG_DIR)/$(config)) -ALL_RECOVERY_KERNEL_DEFCONFIG_SRCS += $(RECOVERY_DEFCONFIG_EXT) +BASE_KERNEL_DEFCONFIG := $(word 1, $(KERNEL_DEFCONFIG)) BASE_KERNEL_DEFCONFIG_SRC := $(word 1, $(ALL_KERNEL_DEFCONFIG_SRCS)) +BASE_RECOVERY_KERNEL_DEFCONFIG := $(word 1, $(RECOVERY_DEFCONFIG)) BASE_RECOVERY_KERNEL_DEFCONFIG_SRC := $(word 1, $(ALL_RECOVERY_KERNEL_DEFCONFIG_SRCS)) ifeq ($(TARGET_PREBUILT_KERNEL),) @@ -181,7 +168,7 @@ ifeq "$(wildcard $(KERNEL_SRC) )" "" endif else NEEDS_KERNEL_COPY := true - ifeq ($(TARGET_KERNEL_CONFIG)$(TARGET_KERNEL_CONFIG_EXT),) + ifeq ($(TARGET_KERNEL_CONFIG),) $(warning **********************************************************) $(warning * Kernel source found, but no configuration was defined *) $(warning * Please add the TARGET_KERNEL_CONFIG variable to your *) @@ -311,16 +298,9 @@ endef # Generate kernel .config from a given defconfig # $(1): Output path (The value passed to O=) -# $(2): The defconfig to process (full path to file) +# $(2): The defconfig to process (just the filename, no need for full path to file) define make-kernel-config - cp $(word 1,$(2)) $(1)/.config - $(call internal-make-kernel-target,$(1),olddefconfig) - $(if $(filter true,$(MERGE_ALL_KERNEL_CONFIGS_AT_ONCE)),\ - $(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(1) $(1)/.config $(filter %.config,$(2)), - $(foreach config,$(filter %.config,$(2)), - $(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(1) $(1)/.config $(config); \ - $(call internal-make-kernel-target,$(1),olddefconfig);)) - $(call internal-make-kernel-target,$(1),VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) olddefconfig) + $(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 \ @@ -505,7 +485,7 @@ $(KERNEL_OUT): $(KERNEL_CONFIG): $(KERNEL_OUT) $(ALL_KERNEL_DEFCONFIG_SRCS) @echo "Building Kernel Config" - $(call make-kernel-config,$(KERNEL_OUT),$(ALL_KERNEL_DEFCONFIG_SRCS)) + $(call make-kernel-config,$(KERNEL_OUT),$(KERNEL_DEFCONFIG)) $(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_CONFIG) $(DEPMOD) $(DTC) $(KERNEL_MODULES_PARTITION_FILE_LIST) $(SYSTEM_KERNEL_MODULES_PARTITION_FILE_LIST) @echo "Building Kernel Image ($(BOARD_KERNEL_IMAGE_NAME))" @@ -587,7 +567,7 @@ kerneltags: $(KERNEL_CONFIG) .PHONY: kernelsavedefconfig alldefconfig kernelconfig recoverykernelconfig kernelsavedefconfig: $(KERNEL_OUT) - $(call make-kernel-config,$(KERNEL_OUT),$(BASE_KERNEL_DEFCONFIG_SRC)) + $(call make-kernel-config,$(KERNEL_OUT),$(BASE_KERNEL_DEFCONFIG)) $(call make-kernel-target,savedefconfig) cp $(KERNEL_OUT)/defconfig $(BASE_KERNEL_DEFCONFIG_SRC) @@ -597,11 +577,11 @@ alldefconfig: $(KERNEL_OUT) kernelconfig: $(KERNEL_OUT) $(ALL_KERNEL_DEFCONFIG_SRCS) @echo "Building Kernel Config" - $(call make-kernel-config,$(KERNEL_OUT),$(ALL_KERNEL_DEFCONFIG_SRCS)) + $(call make-kernel-config,$(KERNEL_OUT),$(KERNEL_DEFCONFIG)) recoverykernelconfig: $(KERNEL_OUT) $(ALL_RECOVERY_KERNEL_DEFCONFIG_SRCS) @echo "Building Recovery Kernel Config" - $(call make-kernel-config,$(RECOVERY_KERNEL_OUT),$(ALL_RECOVERY_KERNEL_DEFCONFIG_SRCS)) + $(call make-kernel-config,$(RECOVERY_KERNEL_OUT),$(RECOVERY_DEFCONFIG)) ifeq (true,$(filter true, $(TARGET_NEEDS_DTBOIMAGE) $(BOARD_KERNEL_SEPARATED_DTBO))) ifneq ($(BOARD_CUSTOM_DTBOIMG_MK),) @@ -700,7 +680,7 @@ $(RECOVERY_KERNEL_OUT): $(RECOVERY_KERNEL_CONFIG): $(ALL_RECOVERY_KERNEL_DEFCONFIG_SRCS) @echo "Building Recovery Kernel Config" - $(call make-kernel-config,$(RECOVERY_KERNEL_OUT),$(ALL_RECOVERY_KERNEL_DEFCONFIG_SRCS)) + $(call make-kernel-config,$(RECOVERY_KERNEL_OUT),$(RECOVERY_DEFCONFIG)) $(TARGET_PREBUILT_INT_RECOVERY_KERNEL): $(RECOVERY_KERNEL_CONFIG) $(DEPMOD) $(DTC) @echo "Building Recovery Kernel Image ($(BOARD_KERNEL_IMAGE_NAME))"