h1

How To: Compile Kernel

July 5, 2007

Hey!. Sometimes, we need to compile our Kernel to update drivers or other somethings. Some people thinks that it is a hard task, but not!. It’s simply. In a few steps we can compile our own Kernel in any Linux distribution.

1) We must have installed the following packages:

 

  • kernel-package
  • libncurses5-dev
  • fakeroot
  • wget
  • bzip2
  • build-essential

If not, try to use apt-get [package name] after a apt-get update

 

2) Move to /usr/src/ path. To do this, use cd /usr/src

3) Get the Kernel. To this, open your browser and go to http://www.kernel.org and download the latest, or you needed.

You can use “wget” to this. For example if we want to use the 2-6-25 Kernel, we type this in the console wget http://www.eu.kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.5.tar.gz

4) When the kernel have been downloaded. Unpack the ‘tar.gz’, using tar xvf [tar.gz package name]

5) Make a simbolic link to the original folder which contains the (Just unpacked) Kernel. Type ln -s [Kernel folder name] linux.

Why we do this? The folder we created with “ln -s” it’s a simply link to the original folder. This folder it’s only to facilitate the work.

6) Move to the symnolic link folder “linux”. Just type cd linux

7) Make sure you’re in /usr/src/linux folder, and now type make clean && make mrproper

8 ) Now, type make menuconfig NOTE: There’s other kinds of compile, but i ever use this. It’s the most easy and secure, i think.

A screen like that will be loaded

In this, you must select the things you need to run your system and the modules you want.

Before this, you must save a configuration file with the settings you’ve selected.

9) Then, you must type the following:

make all
make modules_install
make install

10) We’ve installed out Kernel, but now we should say the system where’s the new Kernel.

To this, type:

depmod [number of kernel] Example -> depmod 2.6.21.5

apt-get install yaird

mkinitrd.yaird -o /boot/initrd.img-[Number of kernel] [Number of kernel]

update-grub

 

After all, we’ve compiled our own Kernel :). To load it, just reboot the computer.

 Sources : HowToForge , Frikis.org

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: