Linux kernel compilation
Author: Nediam <javier@nediam.com.mx>
Publication date: 2005-11-30
Requirements: To have on hand all the characteristics of the hardware of the computer (video card, monitor, hard disk, motherboard, processor, RAM, sound card, network card, modem, etc.). It is also recommended to have previous knowledge in the configuration of some boot loader, either LILO, GRUB, or some other one.
- Download from the official kernel site http://kernel.org/ the sources. Supposing that the version of the kernel is 2.4.31, the tar.bz2 file would be linux-2.4.31.tar.bz. Place that file in the directory /usr/src/.
- SERVER:/usr/src# bzcat linux-2.4.31.tar.bz2 | tar -xvf -
- SERVER:/usr/src# ln -s linux-2.4.31 linux
- SERVER:/usr/src# cd linux
- SERVER:/usr/src/linux# make menuconfig (and configure the kernel options according to the computer hardware)
- SERVER:/usr/src/linux# make dep
Tip: if you got errors during make dep, it could be due to the gcc version that is being used, in particular version 4. This can be solved installing gcc-3 and after that making a symbolic link so that /usr/bin/gcc points to /usr/bin/gcc-3. - SERVER:/usr/src/linux# make modules
Tip: if the kernel was configured without module support ([] Enable loadable module support), this step is not necessary. - SERVER:/usr/src/linux# make modules_install
Tip: if the kernel was configured without module support ([] Enable loadable module support), this step is not necessary. - SERVER:/usr/src/linux# nohup make bzImage &
- SERVER:/usr/src/linux# tail -f nohup.out (it will take a while for the kernel image to be generated)
- SERVER:/usr/src/linux# cd boot
- SERVER:/boot# cp /usr/src/linux/arch/i386/boot/bzImage kernel_2.4.31
- SERVER:/boot# cp /usr/src/linux/System.map System.map-2.4.31
- SERVER:/boot# ln -s System.map-2.4.31 System.map
- For versions 2.6.x of the kernel:
SERVER:/boot# mkdir /sys
SERVER:/boot# echo "none /sys sysfs defaults 0 0 " >> /etc/fstab - Configure the boot loader (LILO, GRUB, etc.). For example, for LILO, the following lines should be added to /etc/lilo.conf:
image=/boot/kernel_2.4.31
label=Linux_2.4.31
read-only
- SERVER:/usr/src# Reboot
Note: For kernel versions 2.6.x, if during the 'make' an error related module utilities appears, it is necessary to install that
package. It can be downloaded from this page (then
check the README and install it).
The latest version of this document is available at:
http://nediam.com.mx/en/tips/kernel_compilation.php



