* kernel module won't compile when using seperate build dir @ 2008-05-07 10:40 James Pike 2008-05-07 11:25 ` Fwd: " James Pike 2008-05-07 16:43 ` David Mair 0 siblings, 2 replies; 5+ messages in thread From: James Pike @ 2008-05-07 10:40 UTC (permalink / raw) To: kvm-devel [-- Attachment #1.1: Type: text/plain, Size: 627 bytes --] Hi, I compile my kernel with make O=/home/james/compile/linux-2.6.25.1 kvm detects this as the kernel directory. However when building in the "kernel" directory of the project it fails (it tries to include linux/compiler.h which is only in /usr/src/linux/..). This used to work but started breaking in kvm-61 onwards. I want to use kvm 61 but I don't want to dirty up my kernel source tree if I can help it. I tried appending the source directory to the include path with -I but this lead to another missing include (asm/types.h), then I added /usr/include to the path as well and .. well it just got worse. Thanks, James [-- Attachment #1.2: Type: text/html, Size: 677 bytes --] [-- Attachment #2: Type: text/plain, Size: 320 bytes --] ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone [-- Attachment #3: Type: text/plain, Size: 158 bytes --] _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Fwd: kernel module won't compile when using seperate build dir 2008-05-07 10:40 kernel module won't compile when using seperate build dir James Pike @ 2008-05-07 11:25 ` James Pike 2008-05-07 11:49 ` James Pike 2008-05-07 16:43 ` David Mair 1 sibling, 1 reply; 5+ messages in thread From: James Pike @ 2008-05-07 11:25 UTC (permalink / raw) To: kvm-devel [-- Attachment #1.1: Type: text/plain, Size: 1041 bytes --] Hi, Here's a fix for the problem described below.. this fixes compilation when the kernel build directory != kernel source directory. It's very simple, please add it to the tree, Thanks, James ---------- Forwarded message ---------- From: James Pike <jpike@blaggart.com> Date: Wed, May 7, 2008 at 6:40 PM Subject: kernel module won't compile when using seperate build dir To: kvm-devel@lists.sourceforge.net Hi, I compile my kernel with make O=/home/james/compile/linux-2.6.25.1 kvm detects this as the kernel directory. However when building in the "kernel" directory of the project it fails (it tries to include linux/compiler.h which is only in /usr/src/linux/..). This used to work but started breaking in kvm-61 onwards. I want to use kvm 61 but I don't want to dirty up my kernel source tree if I can help it. I tried appending the source directory to the include path with -I but this lead to another missing include (asm/types.h), then I added /usr/include to the path as well and .. well it just got worse. Thanks, James [-- Attachment #1.2: Type: text/html, Size: 1319 bytes --] [-- Attachment #2: kvm-68-build-dir.patch --] [-- Type: application/octet-stream, Size: 1329 bytes --] diff -urN kvm/configure kvm.new/configure --- kvm/configure 2008-05-02 19:20:13.000000000 +0800 +++ kvm.new/configure 2008-05-07 19:15:05.000000000 +0800 @@ -1,7 +1,8 @@ #!/bin/bash prefix=/usr/local -kerneldir=/lib/modules/$(uname -r)/build +kerneldir=$(readlink -f /lib/modules/$(uname -r)/build) +kernelsrcdir=$(readlink -f /lib/modules/$(uname -r)/source) cc=gcc ld=ld objcopy=objcopy @@ -129,6 +130,7 @@ ARCH=$arch PREFIX=$prefix KERNELDIR=$kerneldir +KERNELSRCDIR=$kernelsrcdir LIBKVM_KERNELDIR=$libkvm_kerneldir WANT_MODULE=$want_module CROSS_COMPILE=$cross_prefix diff -urN kvm/kernel/Makefile kvm.new/kernel/Makefile --- kvm/kernel/Makefile 2008-05-02 19:20:13.000000000 +0800 +++ kvm.new/kernel/Makefile 2008-05-07 19:15:16.000000000 +0800 @@ -14,6 +14,12 @@ LINUX = ../linux-2.6 +ifeq ($(KERNELDIR),$(KERNELSRCDIR)) +LINUXINC := +else +LINUXINC := -Iinclude2 -I$(KERNELSRCDIR)/include +endif + version = $(shell cd $(LINUX); git describe) _hack = mv $1 $1.orig && \ @@ -33,7 +39,7 @@ all:: # include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat $(MAKE) -C $(KERNELDIR) M=`pwd` \ - LINUXINCLUDE="-I`pwd`/include -Iinclude -I`pwd`/include-compat \ + LINUXINCLUDE="-I`pwd`/include -Iinclude $(LINUXINC) -I`pwd`/include-compat \ -include include/linux/autoconf.h" \ "$$@" [-- Attachment #3: Type: text/plain, Size: 320 bytes --] ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone [-- Attachment #4: Type: text/plain, Size: 158 bytes --] _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Fwd: kernel module won't compile when using seperate build dir 2008-05-07 11:25 ` Fwd: " James Pike @ 2008-05-07 11:49 ` James Pike 2008-05-11 14:40 ` Avi Kivity 0 siblings, 1 reply; 5+ messages in thread From: James Pike @ 2008-05-07 11:49 UTC (permalink / raw) To: kvm-devel [-- Attachment #1.1: Type: text/plain, Size: 1309 bytes --] Sorry that doesn't work. This does. James ---------- Forwarded message ---------- From: James Pike <jpike@blaggart.com> Date: Wed, May 7, 2008 at 7:25 PM Subject: Fwd: kernel module won't compile when using seperate build dir To: kvm-devel@lists.sourceforge.net Hi, Here's a fix for the problem described below.. this fixes compilation when the kernel build directory != kernel source directory. It's very simple, please add it to the tree, Thanks, James ---------- Forwarded message ---------- From: James Pike <jpike@blaggart.com> Date: Wed, May 7, 2008 at 6:40 PM Subject: kernel module won't compile when using seperate build dir To: kvm-devel@lists.sourceforge.net Hi, I compile my kernel with make O=/home/james/compile/linux-2.6.25.1 kvm detects this as the kernel directory. However when building in the "kernel" directory of the project it fails (it tries to include linux/compiler.h which is only in /usr/src/linux/..). This used to work but started breaking in kvm-61 onwards. I want to use kvm 61 but I don't want to dirty up my kernel source tree if I can help it. I tried appending the source directory to the include path with -I but this lead to another missing include (asm/types.h), then I added /usr/include to the path as well and .. well it just got worse. Thanks, James [-- Attachment #1.2: Type: text/html, Size: 1886 bytes --] [-- Attachment #2: kvm-68-build-dir.patch --] [-- Type: application/octet-stream, Size: 1268 bytes --] diff -urN kvm/configure kvm.new/configure --- kvm/configure 2008-05-02 19:20:13.000000000 +0800 +++ kvm.new/configure 2008-05-07 19:34:28.000000000 +0800 @@ -2,6 +2,7 @@ prefix=/usr/local kerneldir=/lib/modules/$(uname -r)/build +kernelsrcdir=/lib/modules/$(uname -r)/source cc=gcc ld=ld objcopy=objcopy @@ -129,6 +130,7 @@ ARCH=$arch PREFIX=$prefix KERNELDIR=$kerneldir +KERNELSRCDIR=$kernelsrcdir LIBKVM_KERNELDIR=$libkvm_kerneldir WANT_MODULE=$want_module CROSS_COMPILE=$cross_prefix diff -urN kvm/kernel/Makefile kvm.new/kernel/Makefile --- kvm/kernel/Makefile 2008-05-02 19:20:13.000000000 +0800 +++ kvm.new/kernel/Makefile 2008-05-07 19:37:47.000000000 +0800 @@ -14,6 +14,12 @@ LINUX = ../linux-2.6 +ifeq ($(realpath $(KERNELDIR)),$(realpath $(KERNELSRCDIR))) +LINUXINC := +else +LINUXINC := -Iinclude2 -I$(KERNELSRCDIR)/include +endif + version = $(shell cd $(LINUX); git describe) _hack = mv $1 $1.orig && \ @@ -33,7 +39,7 @@ all:: # include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat $(MAKE) -C $(KERNELDIR) M=`pwd` \ - LINUXINCLUDE="-I`pwd`/include -Iinclude -I`pwd`/include-compat \ + LINUXINCLUDE="-I`pwd`/include -Iinclude $(LINUXINC) -I`pwd`/include-compat \ -include include/linux/autoconf.h" \ "$$@" [-- Attachment #3: Type: text/plain, Size: 320 bytes --] ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone [-- Attachment #4: Type: text/plain, Size: 158 bytes --] _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fwd: kernel module won't compile when using seperate build dir 2008-05-07 11:49 ` James Pike @ 2008-05-11 14:40 ` Avi Kivity 0 siblings, 0 replies; 5+ messages in thread From: Avi Kivity @ 2008-05-11 14:40 UTC (permalink / raw) To: James Pike; +Cc: kvm-devel James Pike wrote: > Sorry that doesn't work. > > This does. > > --- kvm/configure 2008-05-02 19:20:13.000000000 +0800 > +++ kvm.new/configure 2008-05-07 19:34:28.000000000 +0800 > @@ -2,6 +2,7 @@ > > prefix=/usr/local > kerneldir=/lib/modules/$(uname -r)/build > +kernelsrcdir=/lib/modules/$(uname -r)/source > cc=gcc > ld=ld > objcopy=objcopy I don't think there is a guarantee that /source will be present, only /build. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: kernel module won't compile when using seperate build dir 2008-05-07 10:40 kernel module won't compile when using seperate build dir James Pike 2008-05-07 11:25 ` Fwd: " James Pike @ 2008-05-07 16:43 ` David Mair 1 sibling, 0 replies; 5+ messages in thread From: David Mair @ 2008-05-07 16:43 UTC (permalink / raw) To: kvm-devel James Pike wrote: > Hi, > > I compile my kernel with make O=/home/james/compile/linux-2.6.25.1 > > kvm detects this as the kernel directory. However when building in the > "kernel" directory of the project it fails (it tries to include > linux/compiler.h which is only in /usr/src/linux/..). > > This used to work but started breaking in kvm-61 onwards. I want to use kvm > 61 but I don't want to dirty up my kernel source tree if I can help it. > > I tried appending the source directory to the include path with -I but this > lead to another missing include (asm/types.h), then I added /usr/include to > the path as well and .. well it just got worse. James, I have the same problem with recent kvm project kernel/Makefile. My kernel source is in /usr/src/linux. I hand patch kvm's kernel/Makefile every kvm project release as follows: --- ../original/kernel/Makefile 2008-04-28 11:54:18.000000000 -0600 +++ Makefile 2008-04-28 11:59:36.000000000 -0600 @@ -9,7 +9,7 @@ rpmrelease = devel -LINUX = ../linux-2.6 +LINUX = /usr/src/linux version = $(shell cd $(LINUX); git describe) @@ -27,7 +27,8 @@ all:: # include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat $(MAKE) -C $(KERNELDIR) M=`pwd` \ - LINUXINCLUDE="-I`pwd`/include -Iinclude -I`pwd`/include-compat \ + LINUXINCLUDE="-I`pwd`/include -Iinclude -I/usr/src/linux/include \ + -I`pwd`/include-compat \ -include include/linux/autoconf.h" \ "$$@" That's _not_ a portable patch at the very least due to the literal paths. It works for OpenSuSE 10.3 (a patched 2.6.17 kernel) and kvm at least up to kvm-68. Basically, the kernel source's include directory has to come earlier in the include path priority than kvm's kernel/include/compat. I can't remember if the change to the LINUX variable is actually necessary. --- David. ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-05-11 14:40 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-05-07 10:40 kernel module won't compile when using seperate build dir James Pike 2008-05-07 11:25 ` Fwd: " James Pike 2008-05-07 11:49 ` James Pike 2008-05-11 14:40 ` Avi Kivity 2008-05-07 16:43 ` David Mair
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox