[ovs-discuss] kernel build dir != kernel src dir

Ian Campbell Ian.Campbell at eu.citrix.com
Tue Jul 6 08:30:02 UTC 2010


On Fri, 2010-07-02 at 18:10 +0100, Ben Pfaff wrote:
> On Fri, Jul 02, 2010 at 07:16:10AM +0100, Ian Campbell wrote:
> > On Fri, 2010-07-02 at 03:25 +0100, Jad Naous wrote:
> > > Hi Guys,
> > > 
> > > I'm trying to build openvswitch on opensuse, but I'm having issues
> > > running configure with kernel src dir not found. The thing is that
> > > opensuse has a separate linux/ source dir and a linux-obj/ dir, and I
> > > can't pass both to the --with-l26 command.
> > > 
> > > Is there a workaround or fix?
> > 
> > I needed to do this a few weeks ago and hacked up the below. I'm pretty
> > sure it isn't ready for prime time but it's a start.
> 
> Thanks, Ian!
> 
> Here's a cleaned up version.  Works for me.  Can I have your
> Signed-off-by on this?

Looks good to me (although I've not actually tested) so:
Acked-by: Ian Campbell <ian.campbell at citrix.com>

(feel free to morph into a signed-off-by if you think that more
appropriate).

BTW, Jad, is there not a pair of /lib/modules/<uname>/{source,build}
symlinks under opensuse?

Ian.

> 
> Thanks,
> 
> Ben.
> 
> --8<--------------------------cut here-------------------------->8--
> 
> From 3c8c23b60cb9adc99c528ad291548f3bacc7243e Mon Sep 17 00:00:00 2001
> From: Ben Pfaff <blp at nicira.com>
> Date: Fri, 2 Jul 2010 10:08:47 -0700
> Subject: [PATCH] configure: Add --with-l26-source option to specify source dir explicitly.
> 
> OVS can usually find the kernel source itself, but when it can't it's
> handy if the user can just specify it on the "configure" command line.
> 
> Based on work by Ian Campbell <Ian.Campbell at citrix.com>.
> Reported-by: Jad Naous <jnaous at gmail.com>
> ---
>  AUTHORS      |    1 +
>  acinclude.m4 |   41 ++++++++++++++++++++++++++++++-----------
>  2 files changed, 31 insertions(+), 11 deletions(-)
> 
> diff --git a/AUTHORS b/AUTHORS
> index eda90e0..b0f31d9 100644
> --- a/AUTHORS
> +++ b/AUTHORS
> @@ -32,6 +32,7 @@ Brandon Heller          brandonh at stanford.edu
>  Cedric Hobbs            cedric at nicira.com
>  Ghanem Bahri            bahri.ghanem at gmail.com
>  Henrik Amren            henrik at nicira.com
> +Jad Naous               jnaous at gmail.com
>  Jan Medved              jmedved at juniper.net
>  Jeongkeun Lee           jklee at hp.com
>  Joan Cirer              joan at ev0.net
> diff --git a/acinclude.m4 b/acinclude.m4
> index 015bf66..80794da 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -20,8 +20,14 @@ dnl Configure linux kernel source tree
>  AC_DEFUN([OVS_CHECK_LINUX26], [
>    AC_ARG_WITH([l26],
>                [AC_HELP_STRING([--with-l26=/path/to/linux-2.6],
> -                              [Specify the linux 2.6 kernel sources])],
> +                              [Specify the linux 2.6 kernel build directory])],
>                [KBUILD26="$withval"], [KBUILD26=])dnl
> +  AC_ARG_WITH([l26-source],
> +              [AC_HELP_STRING([--with-l26-source=/path/to/linux-2.6-source],
> +                              [Specify the linux 2.6 kernel source directory
> +			       (usually figured out automatically from build
> +			       directory)])],
> +              [KSRC26="$withval"], [KSRC26=])dnl
>    if test -n "$KBUILD26"; then
>      KBUILD26=`eval echo "$KBUILD26"`
>      case $KBUILD26 in
> @@ -44,18 +50,29 @@ AC_DEFUN([OVS_CHECK_LINUX26], [
>      # We want the source headers, but $KBUILD26 gives us the "build" headers.
>      # Use heuristics to find the source headers.
>      AC_MSG_CHECKING([for Linux 2.6 source directory])
> -    KSRC26=$KBUILD26
> -    if test ! -e $KSRC26/include/linux/kernel.h; then
> -      case `echo "$KBUILD26" | sed 's,/*$,,'` in # (
> -        */build)
> -          KSRC26=`echo "$KBUILD26" | sed 's,/build/*$,/source,'`
> -          ;; # (
> -        *)
> -          KSRC26=`(cd $KBUILD26 && pwd -P) | sed 's,-[[^-]]*$,-common,'`
> -          ;;
> +    if test -n "$KSRC26"; then
> +      KSRC26=`eval echo "$KSRC26"`
> +      case $KSRC26 in
> +          /*) ;;
> +          *) KSRC26=`pwd`/$KSRC26 ;;
>        esac
>        if test ! -e $KSRC26/include/linux/kernel.h; then
> -        AC_MSG_ERROR([cannot find source directory])
> +        AC_MSG_ERROR([$KSRC26 is not a kernel source directory)])
> +      fi
> +    else
> +      KSRC26=$KBUILD26
> +      if test ! -e $KSRC26/include/linux/kernel.h; then
> +	case `echo "$KBUILD26" | sed 's,/*$,,'` in # (
> +	  */build)
> +	    KSRC26=`echo "$KBUILD26" | sed 's,/build/*$,/source,'`
> +	    ;; # (
> +	  *)
> +	    KSRC26=`(cd $KBUILD26 && pwd -P) | sed 's,-[[^-]]*$,-common,'`
> +	    ;;
> +	esac
> +      fi
> +      if test ! -e $KSRC26/include/linux/kernel.h; then
> +        AC_MSG_ERROR([cannot find source directory (please use --with-l26-source)])
>        fi
>      fi
>      AC_MSG_RESULT([$KSRC26])
> @@ -80,6 +97,8 @@ AC_DEFUN([OVS_CHECK_LINUX26], [
>  	AC_MSG_ERROR([Linux kernel source in $KBUILD26 is not configured])
>      fi
>      OVS_CHECK_LINUX26_COMPAT
> +  elif test -n "$KSRC26"; then
> +    AC_MSG_ERROR([--with-l26-source may not be specified without --with-l26])
>    fi
>    AM_CONDITIONAL(L26_ENABLED, test -n "$KBUILD26")
>  ])






More information about the discuss mailing list