Beruflich Dokumente
Kultur Dokumente
1/4
To acquaint the students with the principles of compiling the kernel of the Linux OS.
To teach the student how to install new packages in Linux.
EQUIPMENT REQUIRED
INTRODUCTION
Why would someone want to compile a new kernel? It is often not necessary since the default kernel shipped with
Ubuntu handles most configurations. Also, Ubuntu often offers several alternative kernels. So you may want to check
first if there is an alternative kernel image package that better corresponds to your hardware. However, it can be useful
to compile a new kernel in order to:
Handle special hardware needs, or hardware conflicts with the pre-supplied kernels.
You have hardware the stock Ubuntu kernel does not support.
You are attempting to debug a problem in the stock Ubuntu kernel for which you have filed or will file a bug
report.
Use options of the kernel which are not supported in the pre-supplied kernels (such as high memory support).
Optimize the kernel by removing useless drivers to speed up boot time.
Create a monolithic instead of a modularized kernel.
Run an updated or development kernel.
Learn more about Linux kernels.
You are a kernel developer.
PROCEDURES
Before you begin executing the following procedures, you have to:
Obtain a Linux Ubuntu 9.10 CD or ISO image. You can download the ISO image from
http://mirrors.us.kernel.org/ubuntu-releases/9.10/ubuntu-9.10-desktop-i386.iso.
Install Linux either in a real PC or in a virtual one. You can use the VirtualBox program to create a virtual PC
inside your existing OS and then install Linux in it. A copy of VirtualBox can be obtained from
Objectives
http://download.virtualbox.org/virtualbox/3.1.6/VirtualBox-3.1.6-59338-Win.exe.
Run the Linux Ubuntu OS and login to your account.
1
Linux Kernel Compilation
2/4
Run a Terminal Emulator window by clicking Applications->Accessories->Terminal. Any further commands are
executed in this Terminal window.
In this part, you will know how to obtain the Linux kernel-source package (version 2.6.31 is used in this lab) and any
other package required during the compilation process. To complete this part, follow the following procedures:
2. Run the following command to install the packages that are required to compile the kernel:
3. If you want to configure the kernel using a GUI based configurator, run the following command:
In this part, you will learn how to configure and compile the Linux kernel. Note that the kernel version used in this lab is
2.6.31. Follow the following procedures to accomplish this part:
cd /usr/src
3. Create a link (shortcut) to the directory that contains the source files
cd /usr/src/linux
5. Configure the kernel with the old configuration, so as not to compile the entire kernel from scratch. If it makes
you any questions just press Enter
2
Linux Kernel Compilation
3/4
General setup:
Kernel compression mode -> LZMA
Optimize for size -> Y
9. Compile the kernel to obtain kernel image and headers packages. The version number of “1.0” can be changed
at will; this is just a version number that you will use to track your kernel builds. Likewise, you can put any
word you like in place of “custom” (e.g., a host name). Kernel compilation may take quite a while, depending
on the power of your machine.
In this part, you will perform the final steps needed to have the new kernel ready to be used. At this, you will have
Debian packages for both the kernel-image and the kernel-headers. These packages can be installed just as any regular
package. The default location for these packages is /usr/src.
cd /usr/src
2. Check the existence of the packages. By typing the following command you should see two files ends with
“.deb”
ls
sudo reboot
6. Before the system start booting, press the ESC key repeatedly to show a list of bootable kernels (The GRUB
boot loader). You should now see your kernel image listed. Select it and press ENTER key to boot into it. Note
that if you let the system boot without pressing the ESC key, the system will boot using the newly created
Procedures
kernel image.
7. After starting the new kernel, you can check its version using the command
uname –r
3
Linux Kernel Compilation
4/4
REPORT
BIBLIOGRAPHY
1. [Online] https://help.ubuntu.com/6.10/ubuntu/installation-guide/i386/kernel-baking.html.
2. [Online] https://help.ubuntu.com/community/Kernel/Compile?highlight=%28%28Kernel%7CCompile%29%29.
3. [Online] http://ubuntuforums.org/showthread.php?t=56835.
Report