Skip to contentSkip to conversation

building kvm-userspace with separate kernel object directory?

DISCUSSION Applied Hollis Blanchard 3 participants 7 messages Jan 7, 2008 – Jan 8, 2008 KVM

lore
Share & tools
lore
#0 lore raw

I always build my kernels with the O= option, since it allows me to build multiple architectures from the same sources.

However, it looks like the kvm-userspace configure script can't handle this. It says --kerneldir should be the kernel *build* directory, but when I do that I get
libkvm.c:21:23: warning: linux/kvm.h: No such file or directory
because the build directory does not contain an include/linux symlink.

When I specify the kernel *source* directory for --kerneldir, I get
/home/hollisb/source/kvmppc.hg/include/linux/kvm.h:12:21: warning: asm/kvm.h: No such file or directory
because the source directory doesn't contain an include/asm symlink.

How can this work?

Signature · 9 lines
Hollis Blanchard
IBM Linux Technology Center


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
#1 lore raw

Create an "asm" symlink from libkvm into the kernel source directory. This allows one to use kernel trees built with the O= option.

---
This is all I can come up with... it should work by accident for user/ and qemu/ directories too, since they use "-I ../libkvm".

configure +2 -0
@@ -130,6 +130,8 @@ fi
           --arch="$arch" \
           ${cross_prefix:+"--cross-prefix=$cross_prefix"})
 
+(cd libkvm; ln -sf "$kerneldir/include/asm-$arch" asm)
+
 #configure qemu
 (cd qemu; ./configure --target-list=$target_exec \
     --disable-kqemu \
libkvm/Makefile +2 -2
@@ -10,7 +10,7 @@ CFLAGS += $(autodepend-flags) -g -fomit-
 CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall
 CFLAGS += $(call cc-option, -fno-stack-protector, "")
 CFLAGS += $(call cc-option, -fno-stack-protector-all, "")
-CFLAGS += -I $(KERNELDIR)/include
+CFLAGS += -I $(KERNELDIR)/include -I .
 
 LDFLAGS += $(CFLAGS)
 
@@ -35,4 +35,4 @@ install:
 -include .*.d
 
 clean:
-       $(RM) *.o *.a .*.d
+       $(RM) *.o *.a .*.d asm
Signature · 9 lines
Hollis Blanchard
IBM Linux Technology Center


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
#2 lore raw

Whoops should have replied to this one.

So this does not solve the issue. As it point it includes <KERNELDIR>/includes .. just you have to compile the kernel directory so that "include/asm" symlink in the kernel directory is made.

This creates a symlink to the symlink and that symlnk which is already in include path -I $(KERNELDIR)/include

What would probably be better is to add a check to see if <KERNEL_DIR>/include/asm is created. If it's not give the user an error to compile there kernel source.

Quoted 35 lines · Hollis Blanchard

Create an "asm" symlink from libkvm into the kernel source directory. This allows one to use kernel trees built with the O= option.

---
This is all I can come up with... it should work by accident for user/ and qemu/ directories too, since they use "-I ../libkvm".

configure +2 -0
@@ -130,6 +130,8 @@ fi
           --arch="$arch" \
           ${cross_prefix:+"--cross-prefix=$cross_prefix"})
 
+(cd libkvm; ln -sf "$kerneldir/include/asm-$arch" asm)
+
 #configure qemu
 (cd qemu; ./configure --target-list=$target_exec \
     --disable-kqemu \
libkvm/Makefile +1 -1
@@ -10,7 +10,7 @@ CFLAGS += $(autodepend-flags) -g -fomit-
 CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall
 CFLAGS += $(call cc-option, -fno-stack-protector, "")
 CFLAGS += $(call cc-option, -fno-stack-protector-all, "")
-CFLAGS += -I $(KERNELDIR)/include
+CFLAGS += -I $(KERNELDIR)/include -I .
 
 LDFLAGS += $(CFLAGS)
 

libkvm/Makefile install: · line 38

Quoted 5 lines
libkvm/Makefile +1 -1
@@ -35,4 +35,4 @@ install:
 -include .*.d
 
 clean:
-       $(RM) *.o *.a .*.d
+       $(RM) *.o *.a .*.d asm

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

#3 lore raw

I'm having a hard time parsing this.

Basically this patch is duplicating what Kbuild does: it is creating the appropriate asm symlink. The original problem was that kvm-userspace didn't have an asm symlink, so the patch does fix it.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
Quoted 5 lines · Jerone Young

Whoops should have replied to this one.

So this does not solve the issue. As it point it includes <KERNELDIR>/includes .. just you have to compile the kernel directory so that "include/asm" symlink in the kernel directory is made.

I have already done this. The asm symlink is located at linux/objpowerpcsequoia/include/asm .

Quoted 2 lines

This creates a symlink to the symlink and that symlnk which is already in include path -I $(KERNELDIR)/include

It does not create a symlink to a symlink: the link is asm -> linux/include/asm-foo .

Quoted 3 lines

What would probably be better is to add a check to see if <KERNEL_DIR>/include/asm is created. If it's not give the user an error to compile there kernel source.

The issue is not that I have not compiled the kernel tree. I HAVE compiled it, but I used the O= option when doing so.

Quoted 34 lines · Hollis Blanchard
Quoted 33 lines

Create an "asm" symlink from libkvm into the kernel source directory. This allows one to use kernel trees built with the O= option.

---
This is all I can come up with... it should work by accident for user/ and qemu/ directories too, since they use "-I ../libkvm".

configure +2 -0
@@ -130,6 +130,8 @@ fi
           --arch="$arch" \
           ${cross_prefix:+"--cross-prefix=$cross_prefix"})
 
+(cd libkvm; ln -sf "$kerneldir/include/asm-$arch" asm)
+
 #configure qemu
 (cd qemu; ./configure --target-list=$target_exec \
     --disable-kqemu \
libkvm/Makefile +1 -1
@@ -10,7 +10,7 @@ CFLAGS += $(autodepend-flags) -g -fomit-
 CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall
 CFLAGS += $(call cc-option, -fno-stack-protector, "")
 CFLAGS += $(call cc-option, -fno-stack-protector-all, "")
-CFLAGS += -I $(KERNELDIR)/include
+CFLAGS += -I $(KERNELDIR)/include -I .
 
 LDFLAGS += $(CFLAGS)
 
Quoted 7 lines

libkvm/Makefile install: · line 38

Quoted 7 lines
libkvm/Makefile +1 -1
@@ -35,4 +35,4 @@ install:
 -include .*.d
 
 clean:
-       $(RM) *.o *.a .*.d
+       $(RM) *.o *.a .*.d asm

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

#4 lore raw

Sorry for the cryptic language ;-o

No your right. I wasn't thinking about that.

Quoted 6 lines · Hollis Blanchard

I'm having a hard time parsing this.

Basically this patch is duplicating what Kbuild does: it is creating the appropriate asm symlink. The original problem was that kvm-userspace didn't have an asm symlink, so the patch does fix it.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

Applied
#5 lore raw
In reply to Hollis Blanchard
Quoted 4 lines · Hollis Blanchard

Create an "asm" symlink from libkvm into the kernel source directory. This allows one to use kernel trees built with the O= option.

Applied, thanks.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
#6 lore raw
In reply to Hollis Blanchard

oh your problem is you must first build your kernel that you are pointing too. Or you can cheat and point "include/asm" where you need to point it. That solves the issue. It's all that userspace including kernel headers :-)

Quoted 9 lines · Hollis Blanchard

I always build my kernels with the O= option, since it allows me to build multiple architectures from the same sources.

However, it looks like the kvm-userspace configure script can't handle this. It says --kerneldir should be the kernel *build* directory, but when I do that I get
libkvm.c:21:23: warning: linux/kvm.h: No such file or directory
because the build directory does not contain an include/linux symlink.

Quoted 6 lines

When I specify the kernel *source* directory for --kerneldir, I get
/home/hollisb/source/kvmppc.hg/include/linux/kvm.h:12:21: warning: asm/kvm.h: No such file or directory
because the source directory doesn't contain an include/asm symlink.

How can this work?

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace