summaryrefslogtreecommitdiffstats
path: root/core/tasks/kernel.mk
diff options
context:
space:
mode:
Diffstat (limited to 'core/tasks/kernel.mk')
-rw-r--r--core/tasks/kernel.mk46
1 files changed, 42 insertions, 4 deletions
diff --git a/core/tasks/kernel.mk b/core/tasks/kernel.mk
index dc56927..7a98302 100644
--- a/core/tasks/kernel.mk
+++ b/core/tasks/kernel.mk
@@ -62,13 +62,17 @@ TARGET_KERNEL_SOURCE ?= $(TARGET_AUTO_KDIR)
KERNEL_SRC := $(TARGET_KERNEL_SOURCE)
# kernel configuration - mandatory
KERNEL_DEFCONFIG := $(TARGET_KERNEL_CONFIG)
+KERNEL_RECOVERY_DEFCONFIG := $(TARGET_KERNEL_RECOVERY_CONFIG)
VARIANT_DEFCONFIG := $(TARGET_KERNEL_VARIANT_CONFIG)
SELINUX_DEFCONFIG := $(TARGET_KERNEL_SELINUX_CONFIG)
## Internal variables
KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
KERNEL_CONFIG := $(KERNEL_OUT)/.config
+KERNEL_RECOVERY_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_RECOVERY_OBJ
+KERNEL_RECOVERY_CONFIG := $(KERNEL_RECOVERY_OUT)/.config
KERNEL_OUT_STAMP := $(KERNEL_OUT)/.mkdir_stamp
+KERNEL_RECOVERY_OUT_STAMP := $(KERNEL_RECOVERY_OUT)/.mkdir_stamp
TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH))
ifeq ($(TARGET_KERNEL_ARCH),)
@@ -83,6 +87,7 @@ else
KERNEL_DEFCONFIG_ARCH := $(KERNEL_ARCH)
endif
KERNEL_DEFCONFIG_SRC := $(KERNEL_SRC)/arch/$(KERNEL_DEFCONFIG_ARCH)/configs/$(KERNEL_DEFCONFIG)
+KERNEL_RECOVERY_DEFCONFIG_SRC := $(KERNEL_SRC)/arch/$(KERNEL_DEFCONFIG_ARCH)/configs/$(KERNEL_RECOVERY_DEFCONFIG)
TARGET_KERNEL_HEADER_ARCH := $(strip $(TARGET_KERNEL_HEADER_ARCH))
ifeq ($(TARGET_KERNEL_HEADER_ARCH),)
@@ -112,6 +117,7 @@ else
endif
TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(TARGET_PREBUILT_INT_KERNEL_TYPE)
+TARGET_PREBUILT_INT_KERNEL_RECOVERY := $(KERNEL_RECOVERY_OUT)/arch/$(KERNEL_ARCH)/boot/$(TARGET_PREBUILT_INT_KERNEL_TYPE)
# Clear this first to prevent accidental poisoning from env
MAKE_FLAGS :=
@@ -158,6 +164,7 @@ ifeq "$(wildcard $(KERNEL_SRC) )" ""
$(warning ***************************************************************)
FULL_KERNEL_BUILD := false
KERNEL_BIN := $(TARGET_PREBUILT_KERNEL)
+ KERNEL_RECOVERY_BIN := $(TARGET_PREBUILT_KERNEL)
else
$(warning ***************************************************************)
$(warning * *)
@@ -187,6 +194,10 @@ else
FULL_KERNEL_BUILD := true
KERNEL_BIN := $(TARGET_PREBUILT_INT_KERNEL)
endif
+ ifneq ($(TARGET_KERNEL_RECOVERY_CONFIG),)
+ FULL_KERNEL_BUILD := true
+ KERNEL_RECOVERY_BIN := $(TARGET_PREBUILT_INT_KERNEL_RECOVERY)
+ endif
endif
ifeq ($(FULL_KERNEL_BUILD),true)
@@ -266,6 +277,13 @@ $(KERNEL_OUT_STAMP):
$(hide) mkdir -p $(KERNEL_MODULES_OUT)
$(hide) touch $@
+$(KERNEL_RECOVERY_OUT_STAMP):
+ $(hide) mkdir -p $(KERNEL_RECOVERY_OUT)
+ $(hide) touch $@
+
+$(KERNEL_RECOVERY_OUT):
+ mkdir -p $(KERNEL_RECOVERY_OUT)
+
KERNEL_ADDITIONAL_CONFIG_OUT := $(KERNEL_OUT)/.additional_config
.PHONY: force_additional_config
@@ -284,7 +302,11 @@ $(KERNEL_CONFIG): $(KERNEL_OUT_STAMP) $(KERNEL_DEFCONFIG_SRC) $(KERNEL_ADDITIONA
$(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(KERNEL_OUT) $(KERNEL_OUT)/.config $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG); \
$(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) KCONFIG_ALLCONFIG=$(KERNEL_OUT)/.config alldefconfig; fi
-TARGET_KERNEL_BINARIES: $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL_STAMP)
+$(KERNEL_RECOVERY_CONFIG): $(KERNEL_RECOVERY_OUT_STAMP) $(KERNEL_RECOVERY_DEFCONFIG_SRC) $(KERNEL_ADDITIONAL_CONFIG_OUT)
+ @echo -e ${CL_GRN}"Building Recovery Kernel Config"${CL_RST}
+ $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_RECOVERY_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNEL_RECOVERY_DEFCONFIG)
+
+TARGET_KERNEL_BINARIES: $(BUILT_RAMDISK_TARGET) $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL_STAMP)
@echo -e ${CL_GRN}"Building Kernel"${CL_RST}
$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE)
$(hide) if grep -q 'CONFIG_OF=y' $(KERNEL_CONFIG) ; \
@@ -312,6 +334,9 @@ $(TARGET_PREBUILT_INT_KERNEL): $(TARGET_KERNEL_MODULES)
$(mv-modules)
$(clean-module-folder)
+$(TARGET_PREBUILT_INT_KERNEL_RECOVERY): $(recovery_ramdisk) $(KERNEL_RECOVERY_OUT) $(KERNEL_RECOVERY_CONFIG) $(KERNEL_DEPS)
+ $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_RECOVERY_OUT) ARCH=$(TARGET_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNEL_LOADADDR) $(TARGET_PREBUILT_INT_KERNEL_TYPE)
+
$(KERNEL_HEADERS_INSTALL_STAMP): $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG)
@echo -e ${CL_GRN}"Building Kernel Headers"${CL_RST}
$(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \
@@ -357,13 +382,26 @@ endif # FULL_KERNEL_BUILD
## Install it
ifeq ($(NEEDS_KERNEL_COPY),true)
-file := $(INSTALLED_KERNEL_TARGET)
-ALL_PREBUILT += $(file)
-$(file) : $(KERNEL_BIN) | $(ACP)
+installed_kernel := $(INSTALLED_KERNEL_TARGET)
+ALL_PREBUILT += $(installed_kernel)
+$(installed_kernel) : $(KERNEL_BIN) | $(ACP)
$(transform-prebuilt-to-target)
ALL_PREBUILT += $(INSTALLED_KERNEL_TARGET)
+
+installed_recovery_kernel := $(INSTALLED_RECOVERY_KERNEL_TARGET)
+ALL_PREBUILT += $(installed_recovery_kernel)
+$(installed_recovery_kernel) : $(KERNEL_RECOVERY_BIN) | $(ACP)
+ $(transform-prebuilt-to-target)
+
+ALL_PREBUILT += $(INSTALLED_RECOVERY_KERNEL_TARGET)
endif
+ifneq ($(TARGET_KERNEL_RECOVERY_CONFIG),)
+.PHONY: kernel recovery_kernel
+else
.PHONY: kernel
+endif
+
kernel: $(INSTALLED_KERNEL_TARGET)
+recovery_kernel: $(INSTALLED_RECOVERY_KERNEL_TARGET)