Kernel

This entry was posted by Tuesday, 7 April, 2009
Read the rest of this entry »

To make a new kernel you will need to know a few basic commands.

Firstly go to your local kernel.org with an ftp client and grab a kernel.
There are a lot of choices so heres a simple run down of them.

2.2.xx is the 2.2 series and stable and usually gets the job done
2.3.xx is the development one and probably if this is your first time best to leave
2.4.xx is stable again and good for obscure hardware or other drivers you may need.
2.5.xx is unstable/testing/development (as are all the odd ones – even numbers are stable) 2.6.xx is stable again, and generally is the more used one currently.

I use 2.4 so I will use this as a demonstration.

Once you have saved your kernel put it in /usr/src .
This doesnt have to be the set directory this is just the USUAL place one would use.

So now apon ls you will see something like this

wishes@chary:/usr/src$ ls
linux-2.4.20.tar.bz2
wishes@chary:/usr/src$

(You may have the suffix .tar.gz which is fine)
Now you need to decompress this use tar jvxf linux-2.4.20.tar.bz This varies system to system – I use debian. If j doesnt work try I.
If you have a .tar.gz use tar zvxf linux-2.4.20.tar.gz .

Now you should have a directory called either linux or linux-2.xx.xx (x meaning some number version of your kernel)
If it is linux use mv linux linux-2.xx.xx so you know which kernel is which later on should you change.
then link ‘linux’ to linux-2.xx.xx with the command

ln -s linux-2.4.20 linux

Okay now you have decompressed your kernel. Follow these commands.


cd linux
make menuconfig

(Often debian comes without libncurses so you will need to ‘apt-get install libncurses5-dev’)
If you are not sure what to do here just leave it as default as possible as most of the defaults are good.
Use the space key for an [M] or [*]
[M] Means its built in as a module so you can load it on the fly once running the new kernel
[*] Means its built into the kernel.

Each person does their own thing. If I’m using it all the time like a network card i build it in. If i only use it sometimes I will load it as needed as a module.

Use the arrow keys to move your away around and if not sure click on the Help.

Once you have configured your kernel you need to exit and save your config.

There are numerous ways of compiling the kernel I find this is the fastest and easier to recall than running them all at once.

make dep clean modules modules_install bzImage
(for 2.6.x kernels you can drop the ‘dep’ off it)

Some people prefer

make dep && make clean && make modules && make modules_install && make bzImage
(for 2.6.x kernels you can drop the ‘dep’ off it again)

If this errors out check the error message properly and see if you can work out what caused it and perhaps change that in the kernel config.

If this finishes cleanly then do a

make install

This should install the kernel to /boot

What Should be in boot?

Check that /boot/vmlinuz is a link to vmlinuz-2.4.20 (or whatever kernel name you have)
and /boot/vmlinuz.old is a link to vmlinuz-2.xx.xx (some older version that worked as a backup)

Double check your /etc/lilo.conf to make sure that this points to the correct place. If using grub check the /boot/grub/menu.lst
If running Lilo, just rerun it (typing lilo at the prompt)

Happy Compiling!

Liz


Leave a Reply