OSDN Git Service

kernel.mk: avoid conflict with kernel.mk of LineageOS
authorChih-Wei Huang <cwhuang@linux.org.tw>
Tue, 6 Mar 2018 07:02:29 +0000 (15:02 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Tue, 6 Mar 2018 07:02:29 +0000 (15:02 +0800)
We defined TARGET_PREBUILT_KERNEL to be equal to INSTALLED_KERNEL_TARGET
but LineageOS's kernel.mk would copy TARGET_PREBUILT_KERNEL to
INSTALLED_KERNEL_TARGET that results in a dependency cycle.

Adjust our definition to avoid that.

build/tasks/kernel.mk

index abdd312..cb9b22d 100644 (file)
@@ -51,9 +51,8 @@ $(KERNEL_DOTCONFIG_FILE): $(KERNEL_CONFIG_FILE) $(wildcard $(TARGET_KERNEL_DIFFC
 BISON := $(HOST_OUT_EXECUTABLES)/bison$(HOST_EXECUTABLE_SUFFIX)
 
 BUILT_KERNEL_TARGET := $(KBUILD_OUTPUT)/arch/$(TARGET_ARCH)/boot/$(KERNEL_TARGET)
-$(INSTALLED_KERNEL_TARGET): $(KERNEL_DOTCONFIG_FILE) | $(ACP) $(BISON)
+$(BUILT_KERNEL_TARGET): $(KERNEL_DOTCONFIG_FILE) | $(BISON)
        $(mk_kernel) $(KERNEL_TARGET) $(if $(MOD_ENABLED),modules)
-       $(hide) $(ACP) -fp $(BUILT_KERNEL_TARGET) $@
        $(if $(FIRMWARE_ENABLED),$(mk_kernel) INSTALL_MOD_PATH=$(abspath $(TARGET_OUT)) firmware_install)
 
 ifneq ($(MOD_ENABLED),)
@@ -61,12 +60,12 @@ KERNEL_MODULES_DEP := $(firstword $(wildcard $(TARGET_OUT)/lib/modules/*/modules
 KERNEL_MODULES_DEP := $(if $(KERNEL_MODULES_DEP),$(KERNEL_MODULES_DEP),$(TARGET_OUT)/lib/modules)
 
 ALL_EXTRA_MODULES := $(patsubst %,$(TARGET_OUT_INTERMEDIATES)/kmodule/%,$(TARGET_EXTRA_KERNEL_MODULES))
-$(ALL_EXTRA_MODULES): $(TARGET_OUT_INTERMEDIATES)/kmodule/%: $(INSTALLED_KERNEL_TARGET)
+$(ALL_EXTRA_MODULES): $(TARGET_OUT_INTERMEDIATES)/kmodule/%: $(BUILT_KERNEL_TARGET)
        @echo Building additional kernel module $*
        $(hide) mkdir -p $(@D) && $(ACP) -fr $(EXTRA_KERNEL_MODULE_PATH_$*) $(@D)
        $(mk_kernel) M=$(abspath $@) modules
 
-$(KERNEL_MODULES_DEP): $(INSTALLED_KERNEL_TARGET) $(ALL_EXTRA_MODULES)
+$(KERNEL_MODULES_DEP): $(BUILT_KERNEL_TARGET) $(ALL_EXTRA_MODULES)
        $(hide) rm -rf $(TARGET_OUT)/lib/modules
        $(mk_kernel) INSTALL_MOD_PATH=$(abspath $(TARGET_OUT)) modules_install
        + $(hide) for kmod in $(TARGET_EXTRA_KERNEL_MODULES) ; do \
@@ -88,19 +87,19 @@ endif
 
 installclean: FILES += $(KBUILD_OUTPUT) $(INSTALLED_KERNEL_TARGET)
 
-TARGET_PREBUILT_KERNEL := $(INSTALLED_KERNEL_TARGET)
+TARGET_PREBUILT_KERNEL := $(BUILT_KERNEL_TARGET)
 
 .PHONY: kernel $(if $(KERNEL_ARCH_CHANGED),$(KERNEL_HEADERS_COMMON)/linux/binder.h)
-kernel: $(TARGET_PREBUILT_KERNEL)
+kernel: $(INSTALLED_KERNEL_TARGET)
 
-else
+endif # TARGET_PREBUILT_KERNEL
 
+ifndef LINEAGE_BUILD
 $(INSTALLED_KERNEL_TARGET): $(TARGET_PREBUILT_KERNEL) | $(ACP)
        $(copy-file-to-new-target)
 ifdef TARGET_PREBUILT_MODULES
        mkdir -p $(TARGET_OUT)/lib
        $(hide) cp -r $(TARGET_PREBUILT_MODULES) $(TARGET_OUT)/lib
 endif
-
-endif # TARGET_PREBUILT_KERNEL
+endif # LINEAGE_BUILD
 endif # KBUILD_OUTPUT