Compiling Xen From Source on NetBSD: Difference between revisions

From Xen
Jump to navigationJump to search
(Replacing pre tags by indentation.)
Line 11: Line 11:
The first step is to install the dependencies needed by Xen, they can all be found in pkgsrc. Here is the list of packages that should be installed for 4.2:
The first step is to install the dependencies needed by Xen, they can all be found in pkgsrc. Here is the list of packages that should be installed for 4.2:


devel/mercurial
<pre>
devel/mercurial
devel/scmgit
devel/scmgit
devel/gmake
lang/python27
devel/gmake
devel/py27-curses
lang/python27
devel/py27-curses
devel/dev86
devel/dev86
devel/glib2
devel/glib2
devel/yajl
devel/yajl
</pre>


If you followed the [http://www.netbsd.org/docs/pkgsrc/using.html#building-packages-from-source pkgsrc instructions for building from source], and didn't install anything aside from the minimal selection of sets, the <code>comp</code> and the <code>text</code> sets, you also have to install:
If you followed the [http://www.netbsd.org/docs/pkgsrc/using.html#building-packages-from-source pkgsrc instructions for building from source], and didn't install anything aside from the minimal selection of sets, the <code>comp</code> and the <code>text</code> sets, you also have to install:


shell/bash
<pre>
devel/pkg-config
shell/bash
devel/pkg-config
</pre>


==Cloning==
==Cloning==
Line 33: Line 29:
To clone the repository with git, use:
To clone the repository with git, use:


git clone -b <BRANCH> git://xenbits.xen.org/xen
<pre>
git clone -b <BRANCH> git://xenbits.xen.org/xen
</pre>


Where branch is one of the following (-b accepts branches as well as tags):
Where branch is one of the following (-b accepts branches as well as tags):
Line 98: Line 92:
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. Since pkgsrc installs packages in /usr/pkg, we will need to instruct configure to search for the required libraries there:
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. Since pkgsrc installs packages in /usr/pkg, we will need to instruct configure to search for the required libraries there:


$ ./configure PYTHON=/usr/pkg/bin/python2.7 APPEND_INCLUDES=/usr/pkg/include APPEND_LIB=/usr/pkg/lib --prefix=/usr/xen42
<pre>
$ ./configure PYTHON=/usr/pkg/bin/python2.7 APPEND_INCLUDES=/usr/pkg/include APPEND_LIB=/usr/pkg/lib --prefix=/usr/xen42
</pre>


Please note that "prefix" has been set to /usr/xen42, you can change this to install it in /usr/pkg or whatever directory that suits your needs.
Please note that "prefix" has been set to /usr/xen42, you can change this to install it in /usr/pkg or whatever directory that suits your needs.
Line 108: Line 100:
Now that the configuration has finished, let's start the building. Stubdomains are not available on NetBSD, so we will skip the build of those:
Now that the configuration has finished, let's start the building. Stubdomains are not available on NetBSD, so we will skip the build of those:


$ gmake PYTHON=/usr/pkg/bin/python2.7 xen
<pre>
$ gmake PYTHON=/usr/pkg/bin/python2.7 xen
$ gmake LD_LIBRARY_PATH=/usr/pkg/lib tools
$ gmake LD_LIBRARY_PATH=/usr/pkg/lib tools
</pre>


{{Info|The Xen build system supports running several jobs at the same time, so it's recomendable to use the -jX option to speed up the build process if you have a SMP machine.}}
{{Info|The Xen build system supports running several jobs at the same time, so it's recomendable to use the -jX option to speed up the build process if you have a SMP machine.}}
Line 119: Line 109:
First, we will copy the Xen kernel to /:
First, we will copy the Xen kernel to /:


# cp xen/xen.gz /xen.gz
<pre>
# cp xen/xen.gz /xen.gz
</pre>


Now we need to fetch a Dom0 kernel for the NetBSD version we are running, Dom0 kernels can be found at:
Now we need to fetch a Dom0 kernel for the NetBSD version we are running, Dom0 kernels can be found at:


ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-<version>/<arch>/binary/kernel/netbsd-XEN3_DOM0.gz
<pre>
ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-<version>/<arch>/binary/kernel/netbsd-XEN3_DOM0.gz
</pre>


Download it to /, unpack and rename it to netbsd.xen. The next step is to modify the bootloader to correctly boot the Xen kernel and NetBSD. The following line should be added to /boot.cfg:
Download it to /, unpack and rename it to netbsd.xen. The next step is to modify the bootloader to correctly boot the Xen kernel and NetBSD. The following line should be added to /boot.cfg:


menu=NetBSD Xen:load /netbsd.xen console=com0;multiboot /xen.gz dom0_mem=512M
<pre>
menu=NetBSD Xen:load /netbsd.xen console=com0;multiboot /xen.gz dom0_mem=512M
</pre>


For a serial console boot use the following:
For a serial console boot use the following:


menu=NetBSD Xen com0:load /netbsd.xen console=com0;multiboot /xen.gz dom0_mem=512M console=com1 com1=115200,8n1
<pre>
menu=NetBSD Xen com0:load /netbsd.xen console=com0;multiboot /xen.gz dom0_mem=512M console=com1 com1=115200,8n1
</pre>


Also, set the dom0_mem parameter to an appropriate value for your use case. More info about the Xen kernel boot parameters can be found at [[Xen Command Line and Boot Options]].
Also, set the dom0_mem parameter to an appropriate value for your use case. More info about the Xen kernel boot parameters can be found at [[Xen Command Line and Boot Options]].
Line 145: Line 127:
Finally, we should install the tools that we compiled previously:
Finally, we should install the tools that we compiled previously:


# gmake install-tools
<pre>
# gmake install-tools
</pre>


Now we can reboot into the newly installed Xen system:
Now we can reboot into the newly installed Xen system:


# shutdown -r now
<pre>
# shutdown -r now
</pre>


==Basic usage==
==Basic usage==
Line 159: Line 137:
If you have installed Xen in a location different than /usr/pkg you will need to add it to your LD_LIBRARY_PATH, PATH and PYTHONPATH:
If you have installed Xen in a location different than /usr/pkg you will need to add it to your LD_LIBRARY_PATH, PATH and PYTHONPATH:


# export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/xen42/lib"
<pre>
# export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/xen42/lib"
# export PATH="${PATH}:/usr/xen42/sbin:/usr/xen42/bin"
# export PATH="${PATH}:/usr/xen42/sbin:/usr/xen42/bin"
# export PYTHONPATH="/usr/xen42/lib/python2.7/site-packages"
# export PYTHONPATH="/usr/xen42/lib/python2.7/site-packages"
</pre>


{{warning|If the directory <code>/var/lib/xenstored</code> is missing, both the xencommons script and the tools will hang indefinitely. Please check that this directory exists before proceeding further.}}
{{warning|If the directory <code>/var/lib/xenstored</code> is missing, both the xencommons script and the tools will hang indefinitely. Please check that this directory exists before proceeding further.}}
Line 169: Line 145:
To begin using Xen, xencommons has to be started:
To begin using Xen, xencommons has to be started:


# /usr/xen42/etc/rc.d/xencommons onestart
<pre>
# /usr/xen42/etc/rc.d/xencommons onestart
</pre>


If you built xen onto another system, runtime dependencies are required:
If you built xen onto another system, runtime dependencies are required:

<pre>
devel/yajl
devel/yajl
</pre>


Check that xl is working:
Check that xl is working:


# xl list
<pre>
# xl list
</pre>


[[Category:Users]] [[Category:Host Install]] [[Category:NetBSD]]
[[Category:Users]] [[Category:Host Install]] [[Category:NetBSD]]

Revision as of 10:59, 25 April 2013

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, which is the first release to build natively on NetBSD without any specific patches.

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.

Dependencies

The first step is to install the dependencies needed by Xen, they can all be found in pkgsrc. Here is the list of packages that should be installed for 4.2:

devel/mercurial
devel/scmgit
devel/gmake
lang/python27
devel/py27-curses
devel/dev86
devel/glib2
devel/yajl

If you followed the pkgsrc instructions for building from source, and didn't install anything aside from the minimal selection of sets, the comp and the text sets, you also have to install:

shell/bash
devel/pkg-config

Cloning

To clone the repository with git, use:

git clone -b <BRANCH> git://xenbits.xen.org/xen

Where branch is one of the following (-b accepts branches as well as tags):

Note: For the sake of brevity, many versions are listed using {n..m}, n being the lower limit, m being the higher one.

  • Tags (advised, they are like detached heads)
    • Releases
      • RELEASE-4.2.{0..2}
      • RELEASE-4.1.{0..5}
      • RELEASE-4.0.{0..4}
      • RELEASE-3.0.0
      • RELEASE-2.0.{0..6}
    • Release candidates
      • 4.2.2-rc{1..2}
      • 4.2.1-rc{1..2}
      • 4.2.0-rc{1..5}
      • 4.1.5-rc{1..2}
      • 4.1.4-rc{1..2}
      • 4.1.3-rc{1..3}
      • 4.1.2-rc{1..3}
      • 4.1.1-rc{1..2}
      • 4.1.0-rc{1..8}
      • 4.0.4-rc{1..3}
      • 4.0.3-rc{1..3}
      • 4.0.2-rc{3..6}
      • 4.0.1-rc{1..6}
      • 4.0.0-rc{1..9}
      • 3.3.0-rc{1..7}
      • 3.2.0-rc{1..6}
      • 3.0.2-rc
    • Branched
      • 4.2.0-branched
      • 4.1.0-branched
      • 4.0.0-branched
      • 3.3.0-branched
      • 3.1.0-branched
      • 3.0.4-branched
      • 3.0.3-branched
      • 3.0.2-branched
    • Misc
      • sparse-tree-deprecated
      • ia64-stable
      • semistable
      • latest-semistable
      • latest-stable
      • split-1.1
      • split-1.0
      • beta1
  • Branches (not advised, unless if you want to contribute)
    • master (or HEAD)
    • stable-4.0
    • stable-4.1
    • stable-4.2
    • staging
    • staging-4.0
    • staging-4.1
    • staging-4.2

Configuration

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. Since pkgsrc installs packages in /usr/pkg, we will need to instruct configure to search for the required libraries there:

$ ./configure PYTHON=/usr/pkg/bin/python2.7 APPEND_INCLUDES=/usr/pkg/include APPEND_LIB=/usr/pkg/lib --prefix=/usr/xen42

Please note that "prefix" has been set to /usr/xen42, you can change this to install it in /usr/pkg or whatever directory that suits your needs.

Building

Now that the configuration has finished, let's start the building. Stubdomains are not available on NetBSD, so we will skip the build of those:

$ gmake PYTHON=/usr/pkg/bin/python2.7 xen
$ gmake LD_LIBRARY_PATH=/usr/pkg/lib tools
Icon Info.png The Xen build system supports running several jobs at the same time, so it's recomendable to use the -jX option to speed up the build process if you have a SMP machine.


Install

First, we will copy the Xen kernel to /:

# cp xen/xen.gz /xen.gz

Now we need to fetch a Dom0 kernel for the NetBSD version we are running, Dom0 kernels can be found at:

ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-<version>/<arch>/binary/kernel/netbsd-XEN3_DOM0.gz

Download it to /, unpack and rename it to netbsd.xen. The next step is to modify the bootloader to correctly boot the Xen kernel and NetBSD. The following line should be added to /boot.cfg:

menu=NetBSD Xen:load /netbsd.xen console=com0;multiboot /xen.gz dom0_mem=512M

For a serial console boot use the following:

menu=NetBSD Xen com0:load /netbsd.xen console=com0;multiboot /xen.gz dom0_mem=512M console=com1 com1=115200,8n1

Also, set the dom0_mem parameter to an appropriate value for your use case. More info about the Xen kernel boot parameters can be found at Xen Command Line and Boot Options.

Finally, we should install the tools that we compiled previously:

# gmake install-tools

Now we can reboot into the newly installed Xen system:

# shutdown -r now

Basic usage

If you have installed Xen in a location different than /usr/pkg you will need to add it to your LD_LIBRARY_PATH, PATH and PYTHONPATH:

# export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/xen42/lib"
# export PATH="${PATH}:/usr/xen42/sbin:/usr/xen42/bin"
# export PYTHONPATH="/usr/xen42/lib/python2.7/site-packages"
Icon Ambox.png If the directory /var/lib/xenstored is missing, both the xencommons script and the tools will hang indefinitely. Please check that this directory exists before proceeding further.


To begin using Xen, xencommons has to be started:

# /usr/xen42/etc/rc.d/xencommons onestart

If you built xen onto another system, runtime dependencies are required:

devel/yajl

Check that xl is working:

# xl list