From: Cuero Bugot <cuero.bu...@gmail.com>

CONFIG_EXTERNAL_KERNEL_TREE .config settings allows building the kernel
from an external tree directory. It currently only accept absolute path.
This patch is about allowing relative path. This is particularly convenient
if you have your openwrt and kernel sources hosted remotely, have several
persons working on the same sources, but possibly on different location on
their machine!
The code bellow check if the path is relative or absolute, and if relative
prepend it with openwrt TOPDIR path.

---

diff --git a/config/Config-devel.in b/config/Config-devel.in
index 938f0b3..5ab32d6 100644
--- a/config/Config-devel.in
+++ b/config/Config-devel.in
@@ -64,6 +64,9 @@ menuconfig DEVEL
  config EXTERNAL_KERNEL_TREE
  string "Use external kernel tree" if DEVEL
  default ""
+ help
+  Path to the external kernel source tree. If the provided path is not
absolute, it is
+  relative to the openwrt top directory.

  config KERNEL_GIT_CLONE_URI
  string "Enter git repository to clone" if DEVEL
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 406fd46..fdfcb23 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -63,7 +63,13 @@ else
  if [ -d $(LINUX_DIR) ]; then \
  rmdir $(LINUX_DIR); \
  fi
- ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR)
+ # Check if the provided external path is absolute or relative
+ # if the path is relative, build the proper path from the openwrt top dir.
+ if [ "${CONFIG_EXTERNAL_KERNEL_TREE:0:1}" = "/" ]; then \
+ ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR); \
+ else \
+ ln -s $(TOPDIR)/$(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR); \
+ fi
   endef
 endif


Signed-off-by: Cuero Bugot <cuero.bu...@gmail.com>
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to