Skip to contentSkip to conversation

How to build kvm modules with kvm-kmod for 4.0+ kernel?

DISCUSSION Dongli Zhang 2 participants 2 messages Nov 3, 2017 – Nov 4, 2017 KVM

lore
Share & tools
lore
#0 lore raw

Hi,

I am writing to ask would anyone please help how to build kvm kernel modules with kvm-kmod? I would not like to build the entire kernel including kvm modules.

Is the kvm-kmod still supported for 4.0+ kernel? I used to work with kvm-kmod for kernel version prior to 3.19. This time, when I tried to build kvm modules on ubuntu 16.04 (4.4.0-45-generic) with kvm-kmod, I got the following error:

-----------------------------------------------------------------------

make -C /lib/modules/4.4.0-45-generic/build M=`pwd` \
	LINUXINCLUDE="-I`pwd`/include -I`pwd`/include/uapi -Iinclude \
		 -Iinclude/uapi -Iarch/x86/include -Iarch/x86/include/uapi \
		-Iinclude/generated/uapi -Iarch/x86/include/generated \
		-Iarch/x86/include/generated/uapi \
		-I`pwd`/include-compat -I`pwd`/x86 \
		-include  include/generated/autoconf.h \
		-include `pwd`/x86/external-module-compat.h" \
	"$@"

make[1]: Entering directory '/usr/src/linux-headers-4.4.0-45-generic'
CC [M] /home/zhang/test/kvm-kmod/x86/kvm_main.o
In file included from <command-line>:0:0:
/home/zhang/test/kvm-kmod/x86/external-module-compat.h:1033:22: fatal error: asm/i387.h: No such file or directory compilation terminated.
scripts/Makefile.build:258: recipe for target '/home/zhang/test/kvm-kmod/x86/kvm_main.o' failed make[3]: *** [/home/zhang/test/kvm-kmod/x86/kvm_main.o] Error 1
scripts/Makefile.build:403: recipe for target '/home/zhang/test/kvm-kmod/x86' failed
make[2]: *** [/home/zhang/test/kvm-kmod/x86] Error 2
Makefile:1403: recipe for target '_module_/home/zhang/test/kvm-kmod' failed
make[1]: *** [_module_/home/zhang/test/kvm-kmod] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-45-generic'
Makefile:21: recipe for target 'all' failed
make: *** [all] Error 2

-----------------------------------------------------------------------

Here is how I build kvm modules with kvm-kmod (I would like to build kvm modules for 4.4.0-45-generic on ubuntu 16.04):

About linux source side:

# git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git mainline-linux
# cd mainline-linux
# git checkout -b v4.4_local v4.4

About kvm-kmod side (I am using the default build directory /lib/modules/4.4.0-45-generic/build):

# git clone https://github.com/bonzini/kvm-kmod
# cd kvm-kmod
# git checkout 66355d13e50d1d7896538842f3501740ad2d5e79
# ./configure
# make sync LINUX=../mainline-linux
./sync -v  v4.4 -l ../mainline-linux
# make

Would you please let me know if I am following the README correctly?

Thank you very much!

Dongli Zhang

maintainer
#1 lore raw
Quoted 7 lines

I am writing to ask would anyone please help how to build kvm kernel modules with kvm-kmod? I would not like to build the entire kernel including kvm modules.

Is the kvm-kmod still supported for 4.0+ kernel? I used to work with kvm-kmod for kernel version prior to 3.19. This time, when I tried to build kvm modules on ubuntu 16.04 (4.4.0-45-generic) with kvm-kmod, I got the following error:

The public kvm-kmod repository is way out of date. I have a local copy that should more or less work, but it would probably require a few tweaks for particular kernel versions.

I'll push the current status of my tree in the next few days (at most on Monday). Any further fixes are welcome, you can also use GitHub pull requests for that.

Paolo

Quoted 58 lines

-----------------------------------------------------------------------

make -C /lib/modules/4.4.0-45-generic/build M=`pwd` \
	LINUXINCLUDE="-I`pwd`/include -I`pwd`/include/uapi -Iinclude \
		 -Iinclude/uapi -Iarch/x86/include -Iarch/x86/include/uapi \
		-Iinclude/generated/uapi -Iarch/x86/include/generated \
		-Iarch/x86/include/generated/uapi \
		-I`pwd`/include-compat -I`pwd`/x86 \
		-include  include/generated/autoconf.h \
		-include `pwd`/x86/external-module-compat.h" \
	"$@"

make[1]: Entering directory '/usr/src/linux-headers-4.4.0-45-generic'
CC [M] /home/zhang/test/kvm-kmod/x86/kvm_main.o
In file included from <command-line>:0:0:
/home/zhang/test/kvm-kmod/x86/external-module-compat.h:1033:22: fatal error:
asm/i387.h: No such file or directory
compilation terminated.
scripts/Makefile.build:258: recipe for target '/home/zhang/test/kvm-kmod/x86/kvm_main.o' failed
make[3]: *** [/home/zhang/test/kvm-kmod/x86/kvm_main.o] Error 1 scripts/Makefile.build:403: recipe for target '/home/zhang/test/kvm-kmod/x86' failed
make[2]: *** [/home/zhang/test/kvm-kmod/x86] Error 2 Makefile:1403: recipe for target '_module_/home/zhang/test/kvm-kmod' failed make[1]: *** [_module_/home/zhang/test/kvm-kmod] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-45-generic' Makefile:21: recipe for target 'all' failed
make: *** [all] Error 2

-----------------------------------------------------------------------

Here is how I build kvm modules with kvm-kmod (I would like to build kvm modules for 4.4.0-45-generic on ubuntu 16.04):

About linux source side:

# git clone
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
mainline-linux
# cd mainline-linux
# git checkout -b v4.4_local v4.4

About kvm-kmod side (I am using the default build directory /lib/modules/4.4.0-45-generic/build):

# git clone https://github.com/bonzini/kvm-kmod
# cd kvm-kmod
# git checkout 66355d13e50d1d7896538842f3501740ad2d5e79
# ./configure
# make sync LINUX=../mainline-linux
./sync -v  v4.4 -l ../mainline-linux
# make

Would you please let me know if I am following the README correctly?

Thank you very much!

Dongli Zhang