summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-01-11 04:08:36 +0100
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-01-11 04:08:36 +0100
commit7b76723375405e200d1e6c5767eab62a7013716a (patch)
treedcfce34011b93a5d24340a2f785d5f65a0866554
parent7553e31f7c235de6bd002e68dde05909743298d7 (diff)
downloadbuild-7b76723375405e200d1e6c5767eab62a7013716a.zip
build-7b76723375405e200d1e6c5767eab62a7013716a.tar.gz
build-7b76723375405e200d1e6c5767eab62a7013716a.tar.bz2
Standalone recovery kernel build
Port of commit f6fe3cf5 from Replicant 4.2 Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
-rw-r--r--core/Makefile5
-rw-r--r--core/tasks/kernel.mk46
2 files changed, 46 insertions, 5 deletions
diff --git a/core/Makefile b/core/Makefile
index b9f7c2e..5475edc 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -477,8 +477,10 @@ else
endif # TARGET_NO_BOOTLOADER
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
+ INSTALLED_RECOVERY_KERNEL_TARGET := $(PRODUCT_OUT)/kernel-recovery
else
INSTALLED_KERNEL_TARGET :=
+ INSTALLED_RECOVERY_KERNEL_TARGET :=
endif
ifeq ($(TARGET_XLOADER_MLO),true)
@@ -1031,7 +1033,8 @@ $(recovery_ramdisk): $(MINIGZIP) \
$(hide) $(MINIGZIP) < $(recovery_uncompressed_ramdisk) > $@
ifndef BOARD_CUSTOM_BOOTIMG_MK
-$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(recovery_ramdisk) $(recovery_kernel) \
+$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) \
+ $(recovery_ramdisk) $(recovery_kernel) \
$(RECOVERYIMAGE_EXTRA_DEPS)
@echo -e ${CL_CYN}"----- Making recovery image ------"${CL_RST}
$(call build-recoveryimage-target, $@)
diff --git a/core/tasks/kernel.mk b/core/tasks/kernel.mk
index 0d8c888..eb7bc12 100644
--- a/core/tasks/kernel.mk
+++ b/core/tasks/kernel.mk
@@ -61,13 +61,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),)
@@ -82,6 +86,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),)
@@ -111,6 +116,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 :=
@@ -167,6 +173,7 @@ ifeq "$(wildcard $(KERNEL_SRC) )" ""
$(warning ***************************************************************)
FULL_KERNEL_BUILD := false
KERNEL_BIN := $(TARGET_PREBUILT_KERNEL)
+ KERNEL_RECOVERY_BIN := $(TARGET_PREBUILT_KERNEL)
else
$(warning ***************************************************************)
$(warning * *)
@@ -196,6 +203,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)
@@ -270,6 +281,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
@@ -288,7 +306,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) ; \
@@ -316,6 +338,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 \
@@ -361,13 +386,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)