Compiling Kernel 2.6.32: Difference between revisions

From Xen
Jump to navigationJump to search
No edit summary
m (Removed superfluous <nowiki></nowiki> tag pairs.)
 
(2 intermediate revisions by 2 users not shown)
Line 10: Line 10:
Download the kernel from xen.git and checkout the long-term maintained 2.6.32.x branch:
Download the kernel from xen.git and checkout the long-term maintained 2.6.32.x branch:


<pre><nowiki>
<pre>
# git clone git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git linux-2.6-xen
# git clone git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git linux-2.6-xen
# cd linux-2.6-xen
# cd linux-2.6-xen
# git checkout -b xen/stable-2.6.32.x origin/xen/stable-2.6.32.x
# git checkout -b xen/stable-2.6.32.x origin/xen/stable-2.6.32.x
</nowiki></pre>
</pre>


Note! If "git clone" fails, it's most probably caused by a network problem on your end. Some broken firewalls, nat-routers, and proxies cause problems with the git clone.
Note! If "git clone" fails, it's most probably caused by a network problem on your end. Some broken firewalls, nat-routers, and proxies cause problems with the git clone.
Line 20: Line 20:
Example output from git:
Example output from git:


<pre><nowiki>
<pre>
[root@f13 kernel]# git clone git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git linux-2.6-xen
[root@f13 kernel]# git clone git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git linux-2.6-xen
Cloning into linux-2.6-xen...
Cloning into linux-2.6-xen...
Line 36: Line 36:


[root@f13 linux-2.6-xen]#
[root@f13 linux-2.6-xen]#
</nowiki></pre>
</pre>
==Configure the kernel==
==Configure the kernel==
You can run make menuconfig, and go through the config file to manually activate the relevant Xen options. (Hint: Press the '/' key to bring up a search option, and search for 'xen'.
Download the reference config-file for the 2.6.32.x kernel. Also run "oldconfig" to adapt the configuration to current kernel version (if it's different):


Alternatively, download a reference config-file for the 2.6.32.x kernel. Also run "oldconfig" to adapt the configuration to current kernel version (if it's different):
<pre><nowiki>

<pre>
# wget -O .config http://pasik.reaktio.net/xen/pv_ops-dom0-debug/config-2.6.32.25-pvops-dom0-xen-stable-x86_64
# wget -O .config http://pasik.reaktio.net/xen/pv_ops-dom0-debug/config-2.6.32.25-pvops-dom0-xen-stable-x86_64
# make oldconfig
# make oldconfig
</nowiki></pre>
</pre>


'''Note the example config-file above is DEBUG-enabled possibly causing big performance hits, so don't use it for performance testing!'''
'''Note the example config-file above is DEBUG-enabled possibly causing big performance hits, so don't use it for performance testing!'''

==Building the kernel==
==Building the kernel==
Next, build the kernel.
Next, build the kernel.
Line 51: Line 54:
Note: Replace "4" in "-j4" by the number of physical CPU cores you have to speed up the compilation:
Note: Replace "4" in "-j4" by the number of physical CPU cores you have to speed up the compilation:


<pre><nowiki>
<pre>
# make clean
# make clean
# make -j4 bzImage && make -j4 modules
# make -j4 bzImage && make -j4 modules
</nowiki></pre>
</pre>


After successful compilation install the the kernel modules and the kernel itself. In this example we assume the kernel version is "2.6.32.25":
After successful compilation install the the kernel modules and the kernel itself. In this example we assume the kernel version is "2.6.32.25":


<pre><nowiki>
<pre>
# make modules_install
# make modules_install
# depmod -a 2.6.32.25
# depmod -a 2.6.32.25
Line 66: Line 69:
# cd /boot
# cd /boot
# dracut initramfs-2.6.32.25.img 2.6.32.25
# dracut initramfs-2.6.32.25.img 2.6.32.25
</nowiki></pre>
</pre>


Don't worry about the warnings from dracut. Dracut might take a couple of minutes to execute. Example dracut output:
Don't worry about the warnings from dracut. Dracut might take a couple of minutes to execute. Example dracut output:


<pre><nowiki>
<pre>
[root@f13 boot]# dracut initramfs-2.6.32.25.img 2.6.32.25
[root@f13 boot]# dracut initramfs-2.6.32.25.img 2.6.32.25
grep: /usr/share/plymouth/themes/.plymouth/.plymouth.plymouth: No such file or directory
grep: /usr/share/plymouth/themes/.plymouth/.plymouth.plymouth: No such file or directory
The default plymouth plugin () doesn't exist
The default plymouth plugin () doesn't exist
[root@f13 boot]#
[root@f13 boot]#
</nowiki></pre>
</pre>

[[Category:Users]]
[[Category:Developers]]
[[Category:Tutorial]]
[[Category:Xen]]

Latest revision as of 16:27, 28 November 2011

This document currently assumes you are using Fedora/RHEL/CentOS to do the compilation. For other distributions (ie. Ubuntu/Debian), you'll need to use the respective package management software to get the packages.

Compiling the kernel from source - Getting ready

To actually build the kernel from source, you’ll need to download the compilers and such. To do so, run

# yum groupinstall "Development Libraries" "Development Tools"
# yum install transfig wget texi2html libaio-devel dev86 glibc-devel e2fsprogs-devel gitk mkinitrd iasl xz-devel bzip2-devel pciutils-libs pciutils-devel SDL-devel libX11-devel gtk2-devel 

Getting the kernel source

Download the kernel from xen.git and checkout the long-term maintained 2.6.32.x branch:

# git clone git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git linux-2.6-xen
# cd linux-2.6-xen
# git checkout -b xen/stable-2.6.32.x origin/xen/stable-2.6.32.x

Note! If "git clone" fails, it's most probably caused by a network problem on your end. Some broken firewalls, nat-routers, and proxies cause problems with the git clone.

Example output from git:

[root@f13 kernel]# git clone git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git linux-2.6-xen
Cloning into linux-2.6-xen...
remote: Counting objects: 1748126, done.
remote: Compressing objects: 100% (292844/292844), done.
Receiving objects: 100% (1748126/1748126), 359.40 MiB | 34.70 MiB/s, done.
remote: Total 1748126 (delta 1452892), reused 1733298 (delta 1439822)
Resolving deltas: 100% (1452892/1452892), done.

[root@f13 kernel]# cd linux-2.6-xen/

[root@f13 linux-2.6-xen]# git checkout -b xen/stable-2.6.32.x origin/xen/stable-2.6.32.x
Branch xen/stable-2.6.32.x set up to track remote branch xen/stable-2.6.32.x from origin.
Switched to a new branch 'xen/stable-2.6.32.x'

[root@f13 linux-2.6-xen]#

Configure the kernel

You can run make menuconfig, and go through the config file to manually activate the relevant Xen options. (Hint: Press the '/' key to bring up a search option, and search for 'xen'.

Alternatively, download a reference config-file for the 2.6.32.x kernel. Also run "oldconfig" to adapt the configuration to current kernel version (if it's different):

# wget -O .config http://pasik.reaktio.net/xen/pv_ops-dom0-debug/config-2.6.32.25-pvops-dom0-xen-stable-x86_64
# make oldconfig

Note the example config-file above is DEBUG-enabled possibly causing big performance hits, so don't use it for performance testing!

Building the kernel

Next, build the kernel.

Note: Replace "4" in "-j4" by the number of physical CPU cores you have to speed up the compilation:

# make clean
# make -j4 bzImage && make -j4 modules

After successful compilation install the the kernel modules and the kernel itself. In this example we assume the kernel version is "2.6.32.25":

# make modules_install
# depmod -a 2.6.32.25
# cp -a arch/x86/boot/bzImage /boot/vmlinuz-2.6.32.25
# cp -a System.map /boot/System.map-2.6.32.25
# cp -a .config /boot/config-2.6.32.25
# cd /boot
# dracut initramfs-2.6.32.25.img 2.6.32.25

Don't worry about the warnings from dracut. Dracut might take a couple of minutes to execute. Example dracut output:

[root@f13 boot]# dracut initramfs-2.6.32.25.img 2.6.32.25
grep: /usr/share/plymouth/themes/.plymouth/.plymouth.plymouth: No such file or directory
The default plymouth plugin () doesn't exist
[root@f13 boot]#