summaryrefslogtreecommitdiff
path: root/include/kernel-build.mk
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2016-11-09 09:34:18 -0800
committerFelix Fietkau <nbd@nbd.name>2016-12-04 11:41:51 +0100
commit9a08c0ba807b7e362de5afe78140f3bb4188746c (patch)
tree4d2a00971b5c782deea4b2101699207a88449888 /include/kernel-build.mk
parentb9aab34eb4ddf935ee6296f587857e5a495cae0e (diff)
downloadmtk-20170518-9a08c0ba807b7e362de5afe78140f3bb4188746c.zip
mtk-20170518-9a08c0ba807b7e362de5afe78140f3bb4188746c.tar.gz
mtk-20170518-9a08c0ba807b7e362de5afe78140f3bb4188746c.tar.bz2
include/kernel: Switch to git download method
Utilize the existing git download logic from include/download.mk and migrate the kernel download over to it. This avoids repeatedly cloning kernel sources after a make target/linux/clean for instance. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> [fix build error]
Diffstat (limited to 'include/kernel-build.mk')
-rw-r--r--include/kernel-build.mk19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 04878f8..062c458 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -46,6 +46,24 @@ define Download/kernel
MD5SUM:=$(LINUX_KERNEL_MD5SUM)
endef
+KERNEL_GIT_OPTS:=
+ifneq ($(strip $(CONFIG_KERNEL_GIT_LOCAL_REPOSITORY)),"")
+ KERNEL_GIT_OPTS+=--reference $(CONFIG_KERNEL_GIT_LOCAL_REPOSITORY)
+endif
+
+ifneq ($(strip $(CONFIG_KERNEL_GIT_BRANCH)),"")
+ KERNEL_GIT_OPTS+=--branch $(CONFIG_KERNEL_GIT_BRANCH)
+endif
+
+define Download/git-kernel
+ URL:=$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI))
+ PROTO:=git
+ VERSION:=$(CONFIG_KERNEL_GIT_BRANCH)
+ FILE:=$(LINUX_SOURCE)
+ SUBDIR:=linux-$(KERNEL_PATCHVER)
+ OPTS:=$(KERNEL_GIT_OPTS)
+endef
+
ifdef CONFIG_COLLECT_KERNEL_DEBUG
define Kernel/CollectDebug
rm -rf $(KERNEL_BUILD_DIR)/debug
@@ -73,6 +91,7 @@ endif
define BuildKernel
$(if $(QUILT),$(Build/Quilt))
$(if $(LINUX_SITE),$(call Download,kernel))
+ $(if $(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),$(call Download,git-kernel))
.NOTPARALLEL: