Changes

Jump to: navigation, search

Kernel build

16 bytes removed, 20:41, 19 February 2007
m
change example based on 2.6.18-028test015.1
Install the downloaded SRC RPM with the following command:
<pre>
# rpm -ihv ovzkernel-2.6.1618-026test018028test015.1.src.rpm
</pre>
Then open spec file <code>$TOPDIR/SPECS/kernel-ovz.spec</code> in the editor and add the following lines:
<pre>
Patch10000Patch100000: <patch-name>
</pre>
and
<pre>
%patch10000 patch100000 -p1
</pre>
in appropriate places where similar text lines are.
# cd $TOPDIR/SPECS
# rpmbuild -bp kernel-ovz.spec
# cd $TOPDIR/BUILD/kernel-2.6.1618/linux-2.6.1618
</pre>
There you will find the configuration files in the subdirectory <code>config/*.config</code>. Copy the one you want to modifiy to <code>$TOPDIR/BUILD/kernel-2.6.1618/linux-2.6.1618/.config</code>. Then you can do a make menuconfig or something similar to adjust the kernel configuration. Afterwards copy <code>$TOPDIR/BUILD/kernel-2.6.1618/linux-2.6.1618/.config</code> to the <code>$TOPDIR/SOURCES</code> directory, but use the corresponding file name in the target directory.
Some background information on this procedure can be found in the following thread: http://www.arcknowledge.com/gmane.comp.audio.planetccrma.general/2004-11/msg00018.html
To compile OpenVZ linux kernel one need to download the original linux kernel sources and OpenVZ patches for it.
Linux kernel can be found at [http://www.kernel.org/ kernel.org], e.g. 2.6.16 18 kernel can be downloaded from [http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.1618.tar.bz2 linux-2.6.1618.tar.bz2].
Appropriate OpenVZ patches for this kernel version can be found at http://openvz.org/download/kernel/<version>/patches/. For example, at the moment there is a patch [http://download.openvz.org/kernel/devel/026test018028test015.1/patches/patch-026test018ovz028test015.1-combined.gz patch-026test018ovz028test015.1-combined.gz] available.
Kernel configs are also available at OpenVZ download site. Most frequently SMP config is used, so let's download [http://download.openvz.org/kernel/devel/026test018028test015.1/configs/kernel-2.6.16-026test01818-i686-smp.config.ovz kernel-2.6.16-026test01818-i686-smp.config.ovz]
for this example.
First, extract the kernel sources from archive:
<pre>
# tar vjxf linux-2.6.1618.tar.bz2# cd linux-2.6.1618
</pre>
Apply OpenVZ patches to the kernel:
<pre>
# gzip -dc patch-026test018ovz028test015.1-combined.gz | patch -p1
</pre>
Now we need to place the config and build the kernel:
<pre>
# cp kernel-2.6.16-026test01818-i686-smp.config.ovz .config
# make oldconfig
# make

Navigation menu