Thursday, July 10, 2008

Upgrading Your Kernel

Dispelling The Mysticism

Much mysticism has been built around the difficulty of upgrading your Linux kernel. Truth is, it's not that difficult.


You'll need to be logged on as root whilst performing all of the following steps.

- 1 -

Download/move a kernel source file (e.g. linux-2.2.13.tar.gz) to your /usr/src directory.

- 2 -

cd /usr/src

- 3 -

rm linux remove the symbolic link named linux.

- 4 -

tar xzf linux-2.2.13.tar.gz

...(changing linux-2.2.13.tar.gz to the name of your kernel source file), to extract the compressed and archived source code files.

- 5 -

You'll now have a new directory called linux. 'cd' into it, by entering:
cd linux

- 6 -

It's now time to configure everything to your liking -- prior to actually building the kernel image. Newbies will likely find the graphical configuration utility friendlier that the console version, so in X, enter:

make xconfig


For those who prefer to do things at the console, enter: make menuconfig instead.

- 7 -

Now I know all this looks pretty scary, but the online help is excellent, and you'll soon have the hang of it. Just select the first option on the list, "Code maturity level options", and select the "Help" button to the right for help on that particular option. When you're finished with "Code maturity level options", select the "Next" button to move onto the next set of options... and so on.

When you're finished, select the "Save and Exit" button.


The reason many options are greyed out is because they rely on another option being selected.

- 8 -

Now enter each of the following in turn:
make dep
(Ensures everything gets built in the right order.)

make clean
(Cleans out information from previous compiles.)

make bzImage
(Creates the new kernel image.)

make modules
(Creates the new kernel modules.)

make module_install
(Installs modules to /lib/modules/kernel.version.number)


Show-offs could have entered:

make dep; make clean; make bzImage; make modules; make modules_install

...instead (i.e. all on one line), whilst gooroos would have an alias to run this one big line, just by entering something suitably cryptic, like: mk

- 9 -

As long as it's a x86 PC your using, enter:
mv /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.2.13

...(if not, then replace the i386 part (determined by listing /usr/src/linux/arch)). Feel free to replace the vmlinuz-2.2.13 part with whatever filename you want.

- 10 -

Now you need to tell Lilo about the kernel image so that it can boot it. Enter:
pico /etc/lilo.conf

...and enter the following at the end of the file:

...making sure to change the vmlinuz-2.2.13 part to whatever you called the kernel image in step 10, and the hda6 part to wherever your root (/) partition is located (easy to determine since the other root= entry in this file will tell you). The newlinux part is what you enter at Lilo's boot: prompt to boot this particular kernel image. Change it to whatever you want. Now save the file and exit Pico.

- 11 -

lilo update Lilo with its new configuration.

- 12 -

Reboot your computer to test out the new kernel. If it doesn't work -- don't panic. You still have your old kernel to fall back on.


Post a Comment


Subscribe in Bloglines Msn bot last visit powered by MyPagerank.Net Yahoo bot last visit powered by MyPagerank.Net
I heart FeedBurner downtime checker The Ubuntu Counter Project - user number # 31290

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Powered by TadPole