diff mbox

fix detection of kernel source directory

Message ID 20090603125954.GA16220@dupont.ts-a (mailing list archive)
State New, archived
Headers show

Commit Message

James Pike June 3, 2009, 12:59 p.m. UTC
Fix detection of kernel source directory when it is different to build
directory.
Signed-off-by: James Pike <james@chilon.net>

Comments

Jan Kiszka June 8, 2009, 8:31 a.m. UTC | #1
James Pike wrote:
> Fix detection of kernel source directory when it is different to build
> directory.
> Signed-off-by: James Pike <james@chilon.net>
> 
> diff --git a/configure b/configure
> index e01ba98..c3b7a5f 100755
> --- a/configure
> +++ b/configure
> @@ -91,7 +91,7 @@ arch=${arch%%-*}
>  
>  # see if we have split build and source directories
>  if [ -d "$kerneldir/include2" ]; then
> -    kernelsourcedir=${kerneldir%/*}/source
> +    kernelsourcedir=`readlink -f $kerneldir/source`
>  fi
>  
>  if [ -n "$no_uname" -a "$want_module" ]; then

So far I can't reproduce any problem that the above could fix, but maybe
Avi sees why we need it and that it doesn't regress elsewhere.

Jan
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Avi Kivity June 8, 2009, 8:49 a.m. UTC | #2
Jan Kiszka wrote:
> James Pike wrote:
>   
>> Fix detection of kernel source directory when it is different to build
>> directory.
>> Signed-off-by: James Pike <james@chilon.net>
>>
>> diff --git a/configure b/configure
>> index e01ba98..c3b7a5f 100755
>> --- a/configure
>> +++ b/configure
>> @@ -91,7 +91,7 @@ arch=${arch%%-*}
>>  
>>  # see if we have split build and source directories
>>  if [ -d "$kerneldir/include2" ]; then
>> -    kernelsourcedir=${kerneldir%/*}/source
>> +    kernelsourcedir=`readlink -f $kerneldir/source`
>>  fi
>>  
>>  if [ -n "$no_uname" -a "$want_module" ]; then
>>     
>
> So far I can't reproduce any problem that the above could fix, but maybe
> Avi sees why we need it and that it doesn't regress elsewhere.
>
>   

I don't.  James, what triggered this?
James Pike Aug. 15, 2009, 10:24 p.m. UTC | #3
> kernelsourcedir=${kerneldir%/*}/source
This is incorrect when using an out of place build tree. For example if
my build directory is..

/lib/modules/2.6.20/build
then this will end up as /lib/modules/2.6.20/source which is correct.

But if I build my kernel out of place in /home/compile/linux/2.6.20
Then this will end up as:
/home/compile/linux/source

Obviously the kernel source directory here.

However the kernel build scripts do create a symlink inside of my build
directory called source that points at the kernel sources, so the
correct and simple solution would be:

kernelsourcedir=kerneldir/source

Which is simpler than my patch.

Don't you also build your kernels out of place? I thought it was fairly
standard practice to do "make O=<build dir>" from your kernel source
directory to avoid the source and build objects getting mixed up?

On Mon, Jun 08, 2009 at 11:49:17AM +0300, Avi Kivity wrote:
> Jan Kiszka wrote:
> > James Pike wrote:
> >   
> >> Fix detection of kernel source directory when it is different to build
> >> directory.
> >> Signed-off-by: James Pike <james@chilon.net>
> >>
> >> diff --git a/configure b/configure
> >> index e01ba98..c3b7a5f 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -91,7 +91,7 @@ arch=${arch%%-*}
> >>  
> >>  # see if we have split build and source directories
> >>  if [ -d "$kerneldir/include2" ]; then
> >> -    kernelsourcedir=${kerneldir%/*}/source
> >> +    kernelsourcedir=`readlink -f $kerneldir/source`
> >>  fi
> >>  
> >>  if [ -n "$no_uname" -a "$want_module" ]; then
> >>     
> >
> > So far I can't reproduce any problem that the above could fix, but maybe
> > Avi sees why we need it and that it doesn't regress elsewhere.
> >
> >   
> 
> I don't.  James, what triggered this?
> 
> -- 
> error compiling committee.c: too many arguments to function
> 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/configure b/configure
index e01ba98..c3b7a5f 100755
--- a/configure
+++ b/configure
@@ -91,7 +91,7 @@  arch=${arch%%-*}
 
 # see if we have split build and source directories
 if [ -d "$kerneldir/include2" ]; then
-    kernelsourcedir=${kerneldir%/*}/source
+    kernelsourcedir=`readlink -f $kerneldir/source`
 fi
 
 if [ -n "$no_uname" -a "$want_module" ]; then