By default, OpenWrt doesn't patch the kernel if it's downloaded from
a git tree. This option will allow OpenWrt to download the kernel from
GIT but still allow the user to apply some patches, when enabled.

It can be very convenient when working on some standard kernel
maintained in Git, shared by multiple Linux distributions, but we still
want to take advantages of all the OpenWrt patches.

Signed-off-by: Mathieu Olivari <math...@qca.qualcomm.com>
---
 config/Config-devel.in     |   12 ++++++++++++
 include/kernel-defaults.mk |    5 +++++
 2 files changed, 17 insertions(+)

diff --git a/config/Config-devel.in b/config/Config-devel.in
index 0931175..7549ed9 100644
--- a/config/Config-devel.in
+++ b/config/Config-devel.in
@@ -80,6 +80,18 @@ menuconfig DEVEL
                  In this instance, the --branch option of git clone will be 
used.
                  If unused, the clone's repository HEAD will be checked-out.
 
+       config KERNEL_GIT_PATCH_APPLY
+               bool "Apply OpenWrt patches on git kernel" if DEVEL
+               depends on (KERNEL_GIT_CLONE_URI != "")
+               default n
+               help
+                 By default OpenWrt will apply the OpenWrt specific kernel
+                 patches only if the kernel was downloaded as a regular tarball
+                 and then uncompressed. If the pulled from GIT or from a local
+                 directory, the OpenWrt patches will not be applied.
+                 Use this option if you want to apply these patches even on Git
+                 pulled kernel.
+
        config BUILD_LOG
                bool "Enable log files during build process" if DEVEL
                help
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index f1f5a81..db978c5 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -42,6 +42,10 @@ ifneq ($(strip $(CONFIG_KERNEL_GIT_BRANCH)),"")
   KERNEL_GIT_OPTS+=--branch $(CONFIG_KERNEL_GIT_BRANCH)
 endif
 
+ifneq ($(KERNEL_GIT_PATCH_APPLY),y)
+  Kernel/Patch/Git:=$(Kernel/Patch)
+endif
+
 ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
   ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
     define Kernel/Prepare/Default
@@ -52,6 +56,7 @@ ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
   else
     define Kernel/Prepare/Default
        git clone $(KERNEL_GIT_OPTS) $(CONFIG_KERNEL_GIT_CLONE_URI) $(LINUX_DIR)
+       $(Kernel/Patch/Git)
     endef
   endif
 else
-- 
1.7.10.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to