Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Kernel build

2,250 bytes added, 08:21, 30 May 2006
no edit summary
This FAQ will help you in case you want to apply some patches to the kernel on your own or rebuild it from sources.
On RPM based distros such as RedHat Enterprise Linux/CentOS, Fedora Core or SuSe one can simpy rebuild kernel from SRPM,
for other distros it is required to install sources, build and install kernel manually. The below are given the details for both cases.

== Rebuilding kernel from SRPM ==

=== Download ===
OpenVZ kernel SRC RPM can be download from the official downloads at http://openvz.org/download/kernel/.
Beta versions of kernels for differents OS distributions can be also found at http://openvz.org/download/beta/.

=== Installation ===
Install the downloaded SRC RPM with the following command:
<pre>
# rpm -ihv ovzkernel-2.6.16-026test012.1.src.rpm
</pre>

After successfull installtion you can find kernel sources in /usr/src/<distro>/SOURCES/
and kernel spec file (kernel-ovz.spec) in /usr/src/<distro>/SPECS, where <distro> is your distribution-specific directory.
For example, for RedHat based distros it is 'redhat', for SUSE it is 'packages'.

=== Adding your own patches ===
To modify the kernel one needs just to add specifc patches to the kernel spec file and put this patch into SOURCES directory.
Put your patch into SOURCES directory with the following command:
<pre>
# cp <patch> /usr/src/<distro>/SOURCES/
</pre>

Then open spec file /usr/src/<distro>/SPECS/kernel-ovz.spec in the editor and add the following lines:
<pre>
Patch10000: <patch-name>
</pre>
and
<pre>
%patch10000 -p1
</pre>
in appropriate places where similar text lines are.

== Rebuilding kernel from sources ==

Before rebuilding the kernel make sure that you adjusted the kernel version in kernel-ovz.spec.
This will help you to distinguish binaries then from already existing kernels
(or from official OpenVZ kernels). To do so, edit /usr/src/<distro>/SPECS/kernel-ovz.spec file and replace the following line:
<pre>
%define ksubrelease 1
</pre>
with
<pre>
%define ksubrelease 1-my.kernel.v1
</pre>


To rebuild the kernel type the following commands then:
<pre>
# cd /usr/src/<distro>/SPECS
# rpmbuild -ba --target=i686 kernel-ovz.spec
</pre>

After successfull kernel compilation binary RPMs can be found at /usr/src/<distro>/RPMS/i686
Anonymous user