Set a useful default for kerneldir
PATCH 1/1 Set a useful default for kerneldir
When no explicit kerneldir is specified use the standard /lib/modules/$(uname -r)/build
convention to find the kernel includes. This should work out of the box on a large number of distributions.
Also support separate objdirs.
configure +7 -0
@@ -1148,6 +1148,13 @@ if test "$kvm" = "yes" ; then #endif int main(void) { return 0; } EOF + if test "$kerneldir" = "" ; then + kerneldir="/lib/modules/`uname -r`/build" + if test -d "$kerneldir/source" ; then + kerneldir="$kerneldir/source" + fi + fi + echo "Kerneldir $kerneldir" if test "$kerneldir" != "" ; then kvm_cflags=-I"$kerneldir"/include if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
Signature · 1 line
[email protected] -- Speaking for myself only.
Quoted 8 lines · Andi Kleen
When no explicit kerneldir is specified use the standard
/lib/modules/$(uname -r)/build
convention to find the kernel includes. This should work out of the box on a large number of distributions.Also support separate objdirs.
Signed-off-by Andi Kleen <[email protected]>
The reason we don't specify an explicit include is that it makes it possible to have a cross compiler with headers installed in the cross compilers root. If you default to /lib/modules, you have to explicitly override it when cross compiling.
Another option would be to just include the KVM headers in QEMU.
Regards,
Anthony Liguori
Quoted 4 lines · Anthony Liguori
The reason we don't specify an explicit include is that it makes it possible to have a cross compiler with headers installed in the cross compilers root. If you default to
/lib/modules, you have to explicitly override it when cross compiling.
You can still override it for special cases. This is just a better default than /usr/include which is near always wrong.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
Quoted 5 lines · Anthony Liguori
Quoted 4 lines · Andi Kleen
When no explicit kerneldir is specified use the standard
/lib/modules/$(uname -r)/build
convention to find the kernel includes. This should work out of the box on a large number of distributions.
Quoted 7 lines
Quoted 3 lines
Also support separate objdirs.
Signed-off-by Andi Kleen <[email protected]>The reason we don't specify an explicit include is that it makes it possible to have a cross compiler with headers installed in the cross compilers root. If you default to
/lib/modules, you have to explicitly override it when cross compiling.Another option would be to just include the KVM headers in QEMU.
Or to have kvm-kmod install the headers in /usr/local/include. I'm wary about that though, it makes qemu features depend on the installation order of qemu and kvm-kmod.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 14 lines · Andi Kleen
When no explicit kerneldir is specified use the standard
/lib/modules/$(uname -r)/build
convention to find the kernel includes. This should work out of the box on a large number of distributions.Also support separate objdirs.
Signed-off-by Andi Kleen <[email protected]>configure +0
-0@@ -1148,6 +1148,13 @@ if test "$kvm" = "yes" ; then #endif
configure if test "$kvm" = "yes" ; then · line 1158
Quoted 10 lines
configure +7
-0int main(void) { return 0; } EOF + if test "$kerneldir" = "" ; then + kerneldir="/lib/modules/`uname -r`/build" + if test -d "$kerneldir/source" ; then + kerneldir="$kerneldir/source" + fi + fi + echo "Kerneldir $kerneldir"
This is the wrong place for this echo. They're all unified in a block further down in the code.
Regards,
Anthony Liguori