diff mbox

[OpenWrt-Devel,Build] Allows external kernel tree to be a relative path

Message ID CADY45mnzjEODL2kgfqZHU-Vw=d+W7NUK41Fw0YBV2DhVaHU7VA@mail.gmail.com
State Changes Requested
Delegated to: John Crispin
Headers show

Commit Message

Cuero Bugot July 11, 2016, 2:44 p.m. UTC
From: Cuero Bugot <cuero.bugot@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.

---


Signed-off-by: Cuero Bugot <cuero.bugot@gmail.com>

Comments

Cuero Bugot July 17, 2016, 12:08 p.m. UTC | #1
Should I include more description for this change? This is quite
interesting when using an external tree for the kernel sources and yet want
to share the project in the team (thus absolute path is not an option). I
do not mind keeping this patch on my private fork, only I thought it could
be interesting to other people too.



On Mon, Jul 11, 2016 at 4:44 PM, Cuero Bugot <cuero.bugot@gmail.com> wrote:

> From: Cuero Bugot <cuero.bugot@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.bugot@gmail.com>
>
>
diff mbox

Patch

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