Code: Difference between revisions

From KVM
No edit summary
Line 32: Line 32:
/!\ This only works for the x86 architecture.
/!\ This only works for the x86 architecture.


If you wish to use a distribution kernel (or just some random kernel you like) with kvm,
#If you wish to use a distribution kernel (or just some random kernel you like) with kvm,
you can get both the userspace and kernel (via git).  In the userspace                   
you can get both the userspace and kernel (via git).  In the userspace                   
toplevel directory, type                                                              
toplevel directory, type:
                                                                                          
                                                                                          
  ./configure
  ./configure [--kerneldir=/path/to/kernel/dir]
 
#If you are using a released kvm-XX.tar.gz, skip to step 3. If you got the source from git, you need to run the following commands:
 
  cd kernel
  cd kernel
  make sync LINUX=/path/to/kvm/git/tree
  make sync LINUX=/path/to/kvm/git/tree
Line 42: Line 45:
  make
  make


 
#Finally, build KVM and the KVM modules:
There are three important directories in this scenario:
There are three important directories in this scenario:
{|
{|
! kvm-userspace
! kvm-userspace
| Already contains a "kernel" subdirectory from a kvm.git snapshot. The files in thisdirectory can be overwritten by <code>make sync</code>.
| Contains a <code>kernel</code> subdirectory. If you got the source from git, it needs to be populated with files from the kvm.git repository (using <code>make sync</code>).
|-
|-
! host kernel tree
! host kernel tree
| Older kernel you want to use newer KVM modules with. Refer to it with <code>configure --kerneldir</code>.
| Older kernel you want to use newer KVM modules with. Refer to it with <code>configure --kerneldir</code>.
You need to point to a '''configured''' kernel source tree corresponding to the kernel you are building modules for. The default is to look for the sources of the running kernel at <code>/lib/modules/`uname -r`/build</code>.
|-
|-
! kvm kernel tree (from git)
! kvm kernel tree (from git)
| Used as the source of the KVM modules. Refer to it with <code>LINUX=path</code> in <code>make sync</code>.
| A clone of the kvm.git repository. Used as the source of the KVM modules. Refer to it with <code>LINUX=path</code> in <code>make sync</code>.
|}
|}



Revision as of 11:30, 8 March 2009

kernel git tree

The kvm kernel code is available through a git tree. To create a repository using git, type

git clone git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git

Alternatively, it is also accessible through the kernel.org gitweb interface: [1]

For subsequent upgrades use the command

git-pull

in the git working dir.

userspace git tree

The kvm userspace code (libkvm and qemu) is available through a git tree. To create a repository using git, type

git clone git://git.kernel.org/pub/scm/virt/kvm/kvm-userspace.git

Alternatively, it is also accessible through the kernel.org gitweb interface: [2]

linux guest drivers kit

This kit converts a virtio-capable kernel into a package that can generate linux guest drivers for older kernels.

git clone git://git.kernel.org/pub/scm/virt/kvm/kvm-guest-drivers-linux.git

The corresponding kernel tree can found in the virtio branch of kvm.git.

building an external module with older kernels

/!\ This only works for the x86 architecture.

  1. If you wish to use a distribution kernel (or just some random kernel you like) with kvm,

you can get both the userspace and kernel (via git). In the userspace toplevel directory, type:

./configure [--kerneldir=/path/to/kernel/dir]
  1. If you are using a released kvm-XX.tar.gz, skip to step 3. If you got the source from git, you need to run the following commands:
cd kernel
make sync LINUX=/path/to/kvm/git/tree
cd ..
make
  1. Finally, build KVM and the KVM modules:

There are three important directories in this scenario:

kvm-userspace Contains a kernel subdirectory. If you got the source from git, it needs to be populated with files from the kvm.git repository (using make sync).
host kernel tree Older kernel you want to use newer KVM modules with. Refer to it with configure --kerneldir.

You need to point to a configured kernel source tree corresponding to the kernel you are building modules for. The default is to look for the sources of the running kernel at /lib/modules/`uname -r`/build.

kvm kernel tree (from git) A clone of the kvm.git repository. Used as the source of the KVM modules. Refer to it with LINUX=path in make sync.

release tags

kvm releases are tagged with kvm-nn where nn is the release number.

Binary Packages

CentOS / RHEL

Unofficial packages of latest releases can be found at http://www.lfarkas.org/linux/packages/centos/5/

nightly snapshots

Nightly snapshots, for those who are uncomfortable with git, are available. When reporting a problem with a snapshot, please quote the snapshot name (which includes the date) and the contents of the SOURCES file in the snapshot tarball.