Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Kernel build

6 bytes removed, 07:16, 1 August 2006
use TOPDIR in Rebuilding kernel from SRPM
== Rebuilding kernel from SRPM ==
'''Note''': some of the paths below include $TOPDIR, which is distribution-dependent and can be further redefined by user. To find out the proper location on your system, issue this command:
 
<code>rpm --eval "%{_topdir}"</code>
=== Download ===
Source RPMS for different OpenVZ kernel branches can be downloaded from http://openvz.org/download/kernel/. You can also access http://download.openvz.org/kernel/ directly, or use one of the [[download mirrors|mirrors]].
</pre>
After successfull installation, you can usually find kernel sources in <code>/usr/src/<distro>$TOPDIR/SOURCES/</code>and kernel spec file (<code>kernel-ovz.spec</code>) in <code>/usr/src/<distro>$TOPDIR/SPECS</code>, where <code><distro></code> is your distribution-specific directory.For example, for Red Hat based distros it is <code>redhat</code>, for SUSE it is <code>packages</code>.
=== Adding your own patches ===
To modify the kernel one needs just to add specific patches to the kernel spec file and put this patch into <code>$TOPDIR/SOURCES</code> directory.
Put your patch into SOURCES directory with the following command:
<pre>
# cp <patch> /usr/src/<distro>$TOPDIR/SOURCES/
</pre>
Then open spec file <code>/usr/src/<distro>$TOPDIR/SPECS/kernel-ovz.spec</code> in the editor and add the following lines:
<pre>
Patch10000: <patch-name>
Before rebuilding the kernel make sure that you adjusted the kernel version in <code>kernel-ovz.spec</code>.
This will help you to distinguish binaries then from already existing kernels
(or from the official OpenVZ kernels). To do so, edit the <code>/usr/src/<distro>$TOPDIR/SPECS/kernel-ovz.spec</code> file and replace the following line:
<pre>
%define ksubrelease 1
To rebuild the kernel, type the following commands:
<pre>
# cd /usr/src/<distro>$TOPDIR/SPECS
# rpmbuild -ba --target=i686 kernel-ovz.spec
</pre>
After successfull kernel compilation binary RPMs can be found at <code>/usr/src/<distro>$TOPDIR/RPMS/i686</code>.
== Rebuilding kernel from sources ==