|
|
Upgrading
Your Kernel
|
|
|
Well as you
all know new kernel version come out regularly with a number of
fixes and improvements to make your Linux machine more stable, reliable
and perform better. For this reason it is a good idea to learn how
to upgrade your kernel so that you can keep your box upto date.
You will notice
that the new kernel for Linux is the 2.4.x series that comes with
Red Hat 7.1 and Mandrake 8.0 etc, this is a rather big change from
the 2.2.x kernel that Red Hat 6.x runs, we will mainly describe
how to upgrade the Red Hat 6.2 Kernel (2.2.14-5) to the latest version
available which is 2.2.19, although we are specifically dealing
with a certain kernel version you can still apply these techniques
and procedures to updating your kernel no matter what version you
are running. Before you get started I must warn you that your playing
with the heart for Linux, although this is rather easy to do it
still can cause great problems if not done correctly.
A bit of background
information might be advisable at this point, the Linux kernel is
a program that is loaded when your machine boots, it is the core
of Linux and controls other aspects of the system, you may have
heard of people talking about kernel image, basically is a single
compiled file that runs after the initialisations of the system,
so what we are doing is just creating a new kernel image to replace
the old, this method of updating allows great flexibility if anything
goes wrong, you can simply force your system to boot the older image
and then correct any problems. So make sure you DON'T delete you
old kernel images as they will come in handy is any problems occur
during this process.
Full information
is available in the README
file that comes with the source and we advise that you read that
before you get started, alot of the information here is just the
same as contained in that file, with some explanations along the
way.
|
|
|
|
|
|
|
Instructions
|
|
|
Downloading Latest Kernel Release |
|
In order
to update your Kernel you will need to download the lastest
version from www.kernel.org
or another appropriate location. To download the 2.2.19 Kernel
you can either get the full
kernel or the patch
(the same can be done for the 2.4.x kernel series that is
available here),
the difference is that the patch version just updates the
appropriate changes made in the new kernel where are the full
source just contains everything you need for the latest kernel,
we will be using the full kernel source version.
On the
main page at kernel.org
the tell you the latest stable and the latest pre release
version of the kernel, this will be a 2.4.x version, they
also provided changelogs that inform you of what modification
and updates have been made in that particular version of the
release. It is advisable that you read up on the kernel and
updating documentation that is available on the site, this
will help you to understand what you are doing.
Once
you have selected the appropriate version then you need to
download it, you can either just download it in Netscape (or
whatever browser you prefer) or you can use a console based
program like wget.
We recommend that you download the files to the /usr/src/
directory as that is where you will be working in.
|
Starting
the Upgrade
|
|
Now that
you have downloaded the files you will need to extract them,
this can be done by typing tar
xzvf linux-2.2.19.tar.gz (or whatever the name of the
file is that you have downloaded), this will extract all the
appropriate files into a newly created directory, i.e. something
like /usr/src/linux-2.2.19/,
you will notice there is another directory with similar name,
this is your old kernel source code, there is also a file
linux in the
directory, this is a symbolic link file to the kernel that
the system uses, you will need to delete this file and point
it to the new kernel directory, to do this rm
linux then confirm yes, now create the new symbolic
link by typing ln
-s linux-2.2.19 linux..
Once
you have extracted all the files then you can begin configuring
the kernel so that it suits your system, to do this you want
to go into the directory of the kernel (e.g. cd linux/).
There are a number of ways of configuring your kernel, you
can do it graphically in X-Windows by typing in make
xconfig, you can also do it a number of ways in the
console, select make
config and it will prompt you will all the configuration
questions, if you do a make
oldconfig it will only ask you for the new options
and configurations available in this kernel version. Unless
you want to get down and dirty and understand Linux then we
recommend doing just a make
oldconfig. One the newer 2.4.x kernels you type in
make menuconfig
whcih will give you a graphics based configuration setup,
this is for both the console and X-Windows.
Finally,
when you have configured your kernel do a make
dep to set up all the dependencies correctly.
If this
is your first time with the 2.4.x kernel then you can download
some example configuration files and edit them to suit, if
you would like to do this than you can download them from
here,
all you need to do is select the config file that is best
for your system and then copy it as .config
to the /usr/src/linux-2.4.x/
directory that you ware compiling from. Once you have done
this simply type in make
config and change anything that you man need to, then
simply follow the rest of the instructions. You can setup
the 2.4.x kernel for either IPCHAINS support or IPTABLES,
this is simply done by selecting Y or N when the CONFIG_NETFILER
option is asked.
|
Compiling the New Kernel Image |
|
To make
the new kernel image you need to type make
zImage, this will create a new Linux kernal image.
If your image is too big you will get an error saying "System
is too big. Try using bzImage or modules.", this
means that you will need to make a compressed image file,
not to fear that is almost as easy, just type in make
bzImage to compile the kernel. This is a good point
to make sure that you have the backup kernel handy, make sure
you know where it is as you might need this if the system
doesn't want to boot, you especially don't want to delete
the old image because that will cause a big problem if the
system doesn't want to work.
The next
thing to do is a make
modules and then
make modules_install, you can now move onto
putting the new kernel into place. You will need to make sure
that the appropriate modules for all your hardware are present,
i.e. when compiling you would want to make sure that the modules
for your network card are correct and present (this was the
only problem that I had during this entire process).
|
Replacing
the Old Kernel Image
|
|
In order
to boot your new kernel, you'll need to copy the kernel image
(found in /usr/src/linux/arch/i386/boot/zImage
after compilation) to the place where your regular bootable
kernel is found, this should be /boot/,
copy the file and call it vmlinuz-2.2.19,
you will then need to delete the symbolic link file vmlinuz
and create a new one for the new kernel, ln
-s vmlinuz-2.2.19 vmlinuz.
The kernel
file you just compiled should be in the /usr/src/linux/arch/i386/boot/compressed/
directory and its called vmlinux.
You will also want to copy this and put it in your boot directory,
cp vmlinux /boot/vmlinux-2.2.19
should do it.
Now you
need to modify your /etc/lilo.conf
to add the new image and keep an entry for the old (just in
case you need to use it).
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
linear
default=linux
image=/boot/vmlinuz-2.2.19
label=linux
read-only
root=/dev/hda1
append="mem=128M"
image=/boot/vmlinuz-2.2.14-5.0
label=linux.old
read-only
root=/dev/hda1
append="mem=128M"
Your
/etc/lilo.conf
file should look something like the above when you have completed
it. The BOLD text are the things that you will need
to add. Now your ready for the final steps.
|
Rebooting
and Testing |
|
Reinstalling
LILO is usually a matter of running /sbin/lilo.
You should see something like the following:
Added linux
*
Added linux.old
After
reinstalling LILO, you should be all set. Shutdown the system,
reboot, (you should know this by now, shutdown
-r now) and enjoy!
|
Problem
Recovery
|
|
One of
the beauties of Linux is its total flexibility, if you have
any problems with setting up your new kernel (i.e. it wont
boot properly or you can't use any networking features) then
you can resort to your old kernel. When you machine boots
and your are at the LILO prompt, hit TAB,
you should see linux
and linux.old
(or whatever images you setup in your lilo.conf
file above), to boot your original (or old) configuration
and kernel then just type in linux.old.
Once
the machine has booted you will be using your old kernel (in
this case 2.2.14-5.0)
and you can fix any problems with the new kernel before rebooting
again, you will be able to keep doing this until your machine
is working properly. This is one of many features that make
Linux such a diverse and flexible Operating System.
|
|
|
|
|
|
Proudly Hosted By:
Please
read our Legal Notice for information concerning our site and its content.
All logos and trademarks in this site are property of their respective owner. All the rest © 2000 - 2016 by Linuxathome.net
|
|