Skip to contentSkip to conversation

uClibc compatibility or static linking support

DISCUSSION Cristi Magherusan 2 participants 4 messages Jul 5, 2008 – Jul 6, 2008 KVM

lore
Share & tools
lore
#0 lore raw

Hello,

As part of my GSoC project I'm working to create a small coreboot payload containing a KVM-enabled Linux kernel and the KVM tools.

This involves either compiling and linking KVM against uClibc, or making a static binary linked against glibc.

Has anyone tried compiling kvm against uClibc before? I did and it seems it has some issues. I have fixed some by including aio support inside uClibc, but it still won't work and I get some linking errors..I can provide more details if needed.

Also, it seems that currently there's no way to build it statically linked against glibc, so that I can include it in my BIOS image in this way. I used the -static CFLAG, but it seems it is still linked dinamically against the same libs. Any ideas?

Best regards,
Cristi

Signature · 4 lines
Ing. Cristi Măgherușan,
Universitatea Tehnică din Cluj-Napoca
Centrul de Comunicații "Pusztai Kalman"
Tel. 0264/401247  http://cc.utcluj.ro
#1 lore raw
Quoted 5 lines · Cristi Magherusan

Hello,

As part of my GSoC project I'm working to create a small coreboot payload containing a KVM-enabled Linux kernel and the KVM tools.

Quoted 9 lines

This involves either compiling and linking KVM against uClibc, or making a static binary linked against glibc.

Has anyone tried compiling kvm against uClibc before? I did and it seems it has some issues. I have fixed some by including aio support inside uClibc, but it still won't work and I get some linking errors..I can provide more details if needed.

Please post the build log.

Quoted 5 lines

Also, it seems that currently there's no way to build it statically linked against glibc, so that I can include it in my BIOS image in this way. I used the -static CFLAG, but it seems it is still linked dinamically against the same libs. Any ideas?

I don't see any reason for that. Perhaps the build logs will tell.

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw

Hello,

Quoted 9 lines · Avi Kivity
Quoted 8 lines · Cristi Magherusan

Hello,

As part of my GSoC project I'm working to create a small coreboot payload containing a KVM-enabled Linux kernel and the KVM tools.

This involves either compiling and linking KVM against uClibc, or making a static binary linked against glibc.

Quoted 8 lines
Quoted 6 lines

Has anyone tried compiling kvm against uClibc before? I did and it seems it has some issues. I have fixed some by including aio support inside uClibc, but it still won't work and I get some linking errors..I can provide more details if needed.

Please post the build log.

Sorry, the part about incompatibility with uClibc was an error on my side. It were just my build tools.
I had some errors in the Makefile I'm using for KVM which are now partially fixed and now I got rid of that error, but I have another strange one which again seems to be caused by my Makefile.

For building all the stuff I'm using a somehow modified version of coreboot's buildrom.

This is my build log:
http://rafb.net/p/DXMwsg76.html
And this is my Makefile that triggers the kvm make command:
http://tinyurl.com/66objx

Currently, in order to reproduce it some steps must be done manually but those will be patched in the sources later on...

So if you want to reproduce it yourself, these are the steps:

git clone git://repo.or.cz/kvm-coreboot.git
Then cd into the dir and type "make"

Beware, it will download and compile some stuff, including a 2.6.22 linux kernel, busybox and uClibc, so it will take a while to complete.

Also, note that gcc-4.3 will fail to build the kernel and you'll either have to use gcc <=4.2.x or add a strange CFLAG to the kernel Makefile, at the CFLAGS_KERNEL. I'll search for that one and include a patch for it by default, but for now I'm sticking to gcc-4.2.4.

After everything builds, kvm-70 will break at some point. First rsync -R will fail, and you must remove the line containing "$(LINUX)"/./include/asm-*/kvm*.h from work/kvm-tools/kvm-70/kernel/Makefile

It's strange that the first compilation fails with this message:
/tmp/kvm-coreboot/work/kvm-tools/kvm-70/qemu/hw/i8254-kvm.c: In function ‘kvm_pit_save’:
/tmp/kvm-coreboot/work/kvm-tools/kvm-70/qemu/hw/i8254-kvm.c:36: error:
storage size of ‘pit’ isn’t known /tmp/kvm-coreboot/work/kvm-tools/kvm-70/qemu/hw/i8254-kvm.c:41: warning:
implicit declaration of function ‘kvm_get_pit’.......

Then if you run make again it will pass over that point and you'll get some errors caused by u32 and u64 in work/kvm-tools/kvm-70/kernel/include/linux/kvm_para.h
to fix those run this command:

sed -i -e 's/u32/uint32_t/;s/u64/uint64_t/' \
work/kernel/linux-2.6.22.2/include/linux/kvm_para.h

then include <sys/user.h> in the same file.

Run make again and then you get the error I'm facing now.

Quoted 7 lines
Quoted 5 lines

Also, it seems that currently there's no way to build it statically linked against glibc, so that I can include it in my BIOS image in this way. I used the -static CFLAG, but it seems it is still linked dinamically against the same libs. Any ideas?

I don't see any reason for that. Perhaps the build logs will tell.

I hope I won't need to do this and that uClibc will be enough.

Thanks for your answer,
Cristi

Signature · 4 lines
Ing. Cristi Măgherușan,
Universitatea Tehnică din Cluj-Napoca
Centrul de Comunicații "Pusztai Kalman"
Tel. 0264/401247  http://cc.utcluj.ro
#3 lore raw
Quoted 30 lines · Cristi Magherusan

Hello,

Quoted 10 lines · Avi Kivity
Quoted 8 lines · Cristi Magherusan

Hello,

As part of my GSoC project I'm working to create a small coreboot payload containing a KVM-enabled Linux kernel and the KVM tools.

This involves either compiling and linking KVM against uClibc, or making a static binary linked against glibc.

Quoted 9 lines
Quoted 7 lines

Has anyone tried compiling kvm against uClibc before? I did and it seems it has some issues. I have fixed some by including aio support inside uClibc, but it still won't work and I get some linking errors..I can provide more details if needed.

Please post the build log.

Sorry, the part about incompatibility with uClibc was an error on my side. It were just my build tools.
I had some errors in the Makefile I'm using for KVM which are now partially fixed and now I got rid of that error, but I have another strange one which again seems to be caused by my Makefile.

Quoted 6 lines

For building all the stuff I'm using a somehow modified version of coreboot's buildrom.

This is my build log:
http://rafb.net/p/DXMwsg76.html

Okay, try to swap the order of the libraries on the command line, or look at the --start-group and --end-group linker options (you may need to use the -Wl gcc option with that as well).

Signature · 1 line
error compiling committee.c: too many arguments to function