Compiling Xen From Source: Difference between revisions
(Add section on build dependencies) |
(Add section on configuring Xen.) |
||
Line 62: | Line 62: | ||
One useful shortcut can be to use your distributions package manager to install all the prerequisite packages is to install those packages which are noted as being required to build the distribution's own Xen packages. e.g. under Debian or a Debian derived distribution: |
One useful shortcut can be to use your distributions package manager to install all the prerequisite packages is to install those packages which are noted as being required to build the distribution's own Xen packages. e.g. under Debian or a Debian derived distribution: |
||
# apt-get build-dep xen |
# apt-get build-dep xen |
||
('''TBD''' ''equivalent for RPM/yum/etc type distributions''). However you need to be mindful of new prerequisites added between whatever version of Xen is in your distribution and the version you are building when using this trick |
('''TBD''' ''equivalent for RPM/yum/etc type distributions''). However you need to be mindful of new prerequisites added between whatever version of Xen is in your distribution and the version you are building when using this trick. |
||
===Configure |
===Configure=== |
||
From Xen 4.2 onwards Xen uses the commonly used ''autoconf'' tool to provide compile time configurability of the toolstack. This allows some control of what features are built into Xen, as well as compile time sanity checking. To configure Xen simply run the provided ''configure'' script: |
|||
$ ./configure |
|||
To see the various options run the configure script with ''--help'' e.g.: |
|||
$ ./configure --help |
|||
[...] |
|||
Optional Features: |
|||
--disable-option-checking ignore unrecognized --enable/--with options |
|||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) |
|||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes] |
|||
--enable-githttp Download GIT repositories via HTTP (default is |
|||
DISABLED) |
|||
This step is only required from Xen 4.2 onwards. Prior to Xen 4.2 these options could be configured by passing a variable on the ''make'' command line during build & install or by writing the variable to a file named ''.config'' at the top level of the source tree. |
|||
====Use ''http://'' Rather Than ''git://'' to Clone Additional Repositories==== |
|||
When building Xen from Mercurial the build system will automatically clone several additional repositories from the network. Some of these repositories use the version control system which uses its own protocol on a specific port. Sometimes this causes issues due to firewalls etc blocking the git port. This can be worked around by instructing the Xen build system to clone such repositories using a less efficient HTTP based protocol: |
|||
$ ./configure --enable-githttp |
|||
Prior to Xen 4.2 this could be achieved by writing ''GIT_HTTP=y'' to your ''.config'': |
|||
$ cat .config |
|||
GIT_HTTP = y |
|||
====Python Prefix and Module Layout==== |
|||
On some distros (e.g. Debian and Ubuntu) Xen may install the python parts of Xen into the wrong place. Therefore it is necessary to set ''PYTHON_PREFIX_ARG=--install-layout=deb'': |
|||
$ cat .config |
|||
PYTHON_PREFIX_ARG=--install-layout=deb |
|||
Some versions of Ubuntu have a [https://bugs.launchpad.net/ubuntu/+bug/362570 bug] which requires instead that ''PYTHON_PREFIX_ARG'' is to set the empty string: |
|||
$ cat .config |
|||
PYTHON_PREFIX_ARG= |
|||
As of 4.2 this option is not yet supported by the ''configure'' script and therefore should still be set via ''.config'' or on the ''make'' command line. |
|||
===Build=== |
|||
'''TBD''' |
'''TBD''' |
Revision as of 16:03, 23 April 2012
Introduction
The purpose of this document is to guide users through the process of installing Xen from source (either from the tarball releases or from a source code repository).
This document was written targeting the Xen 4.2 release, but an attempt will be made to point out differences from previous releases where relevant.
An assumption is made of some familiarity with the general concept of building software and with using your distributions package manager to install relevant build tools etc.
Why Build From Source?
Before embarking on the process of building Xen yourself it is worth considering whether this is even necessary. There are many distributions around these days which have excellent support for Xen available right from the package manager, a partial list is available at Dom0 Kernels for Xen. Where possible it is highly recommended that users consume Xen via their chosen distribution wherever possible. Using the distribution packaging will give you a much more integrated solution and allow you to take advantage of all the resources provided by your distribution (e.g. documentation, support etc). You can find articles on how to install Xen on various distributions in.
The remainder of this document assumes that you have considered this and really do want to build from source.
Obtaining the Xen Source Code
The two primary ways to obtain the Xen source code for a stable release are via the release tarballs or by cloning from the appropriate Mercurial source repository. For the development version of Xen (xen-unstable) Mercurial is the only source.
Release Tarballs
The latest Xen releases are linked to from The Xen.org download page
Mercurial
Xen's source code repositories are hosted using the Mercurial version control system on xenbits.
Each stable release has it's own branch xen-X.Y-testing.hg (e.g. xen-4.1-testing.hg where code intended for the next stable point release is added. The Xen development branch is known as xen-unstable and has its own repository xen-unstable.hg.
Each Xen stable and development branch is available in two forms either tested (the main branch) or untested (the staging branch). When commits are made to a Xen tree they are first added to the staging branch and only propagated to the main branch after automated testing has passed. For example all commits to the Xen development branch will initially appear in staging/xen-unstable.hg and then propagate to xen-unstable.hg after automated testing has completed. The automated test results are posted to the xen-devel mailing list.
Xen Repositories contains information on the various repositories for the stable and development branches.
To clone the source first install the mercurial tool using your distributions package manager. Then execute the following command:
$ hg clone URL
Where URL is the URL of the repository you wish to clone. e.g. to clone the latest tested xen-unstable tree:
$ hg clone http://xenbits.xen.org/hg/xen-unstable.hg
Or to clone the staging (e.g. not yet tested) xen-unstable tree:
$ hg clone http://xenbits.xen.org/hg/staging/xen-unstable.hg
Quick-Start
The README at the top level of the Xen source code tree contains a quick-start guide to building Xen. This provides a quick overview of the process and requirements for building Xen and will generally contain the most up to date information specific to the particular Xen tree you are looking at. After obtaining the Xen source this is the first document you should read.
Building from Source
Build Dependencies
Xen uses several external libraries and tools. The primary list of these prerequisites is the list present in the README file.
Even this list assumes some sort of basic development environment. A good starting point for this is to use your distributions development install package option.
e.g. under Debian (and derived distributions) install the build-essential package:
# apt-get install build-essential
whereas under CentOS (and similar) distributions the Development Libraries and Development Tools package groups:
# yum groupinstall "Development Libraries" "Development Tools"
Having installed this you should then install each of the prerequisites listed in the README using your distribution's package management tool. In general Xen tries to only depend upon external tools and libraries which are commonly available in distributions therefore obtaining the prerequisites other than from your distribution's package management system is out of scope for this document. If you have trouble locating a particular prerequisite then please contact the xen-users mailing list.
One useful shortcut can be to use your distributions package manager to install all the prerequisite packages is to install those packages which are noted as being required to build the distribution's own Xen packages. e.g. under Debian or a Debian derived distribution:
# apt-get build-dep xen
(TBD equivalent for RPM/yum/etc type distributions). However you need to be mindful of new prerequisites added between whatever version of Xen is in your distribution and the version you are building when using this trick.
Configure
From Xen 4.2 onwards Xen uses the commonly used autoconf tool to provide compile time configurability of the toolstack. This allows some control of what features are built into Xen, as well as compile time sanity checking. To configure Xen simply run the provided configure script:
$ ./configure
To see the various options run the configure script with --help e.g.:
$ ./configure --help [...] Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-githttp Download GIT repositories via HTTP (default is DISABLED)
This step is only required from Xen 4.2 onwards. Prior to Xen 4.2 these options could be configured by passing a variable on the make command line during build & install or by writing the variable to a file named .config at the top level of the source tree.
Use http:// Rather Than git:// to Clone Additional Repositories
When building Xen from Mercurial the build system will automatically clone several additional repositories from the network. Some of these repositories use the version control system which uses its own protocol on a specific port. Sometimes this causes issues due to firewalls etc blocking the git port. This can be worked around by instructing the Xen build system to clone such repositories using a less efficient HTTP based protocol:
$ ./configure --enable-githttp
Prior to Xen 4.2 this could be achieved by writing GIT_HTTP=y to your .config:
$ cat .config GIT_HTTP = y
Python Prefix and Module Layout
On some distros (e.g. Debian and Ubuntu) Xen may install the python parts of Xen into the wrong place. Therefore it is necessary to set PYTHON_PREFIX_ARG=--install-layout=deb:
$ cat .config PYTHON_PREFIX_ARG=--install-layout=deb
Some versions of Ubuntu have a bug which requires instead that PYTHON_PREFIX_ARG is to set the empty string:
$ cat .config PYTHON_PREFIX_ARG=
As of 4.2 this option is not yet supported by the configure script and therefore should still be set via .config or on the make command line.
Build
TBD
Install
TBD