-   Linux - Newbie (
-   -   Kernel Upgrade Steps (

smartes 01-08-2003 03:03 PM

Kernel Upgrade Steps
Can anybody who has done a kernel upgrade check out my steps please and provide feedback


Create a boot disk
Backup files
$ rpm -qa | grep 'kernel'


Download the 2.4.20 source to the /usr/src directory
As root, cd /usr/src
ls -l - This showed that /usr/src/linux was a link to /usr/src/linux-2.4.18-14, the current kernel.
rm /usr/src/linux - remove the link
untar the source: creates a new linux sub directory containing new kernel source files
tar -xjvf linux-2.4.20.tar.bz2
ln -s /usr/src/linux-2.4.20 /usr/src/linux
cd /usr/src/linux

Apply Patches:
The ACPI Patch. Once you download that file, put it in the same directory you extracted your linux source into
(should be linux-2.4.20). Example: `zcat patch46.gz | patch -p0' (or `patch -p0 < patch46' if the patch isn't compressed)
patch -p1 < acpi-20021212-2.4.20.diff

The Sound patch ( by Fedor Karpelevitch). To apply this patch run the following patch command:
patch -p1 < presario_sound_fix.diff

Compile new kernel:
Read through the README file, which explains the make commands you're about to enter:

`make mrproper' will do a more extensive `clean'ing. It is sometimes necessary; you may wish to do it at every patch.
`make mrproper' will also delete your configuration file, so you might want to make a backup of it (.config)
make mrproper T

make config
Make sure you enable the appropriate modules for network (8139too), sound (OSS and trident), video (radeon, vesa),
usb, firewire (experimental), and disable machine check exception. Also disable the "Set version information on all
module symbols" option if you plan to include module support in your kernel--without this, your modules will fail
with an MMX-related bug.

When prompted, enter "m" to make a module for new options
After you finish configuration, a message tells you that your kernel has been configured, and to ``check the top-level
Makefile for additional configuration,'' etc. So, look at the Makefile.

When the configure script ends, it also tells you to `make dep' and (possibly) `clean'. This insures that all of the
dependencies, such the include files, are in place. Do not forget this step before attempting to recompile a kernel.
make dep

After depending and cleaning, you may now `make bzImage' (this is the part that takes a long time.). `make bzImage'
will compile the kernel, and leave a file in arch/i386/boot called `bzImage' (among other things). This is the new
compressed kernel. A compressed kernel automatically decompresses itself when executed.
make bzImage

To use loadable modules, first make sure that you don't configure them into the regular kernel; that is, don't say y to it
during `make config'. Compile a new kernel and reboot with it. Then, cd to /usr/src/linux again, and do a `make modules'.
This compiles all of the modules which you did not specify in the kernel configuration, and places links to them in
/usr/src/linux/modules. You can use them straight from that directory or execute `make modules_install', which installs
them in /lib/modules/x.y.z, where x.y.z is the kernel release.
make modules
make modules_install

cd /boot ls -l Remove the folloing links and create new ones as follows:
rm /boot/
rm /boot/vmlinuz
Copy the newly created kernel and to /boot
cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.4.20
ln -s /boot/vmlinuz-2.4.20 /boot/vmlinuz
cp /usr/src/linux/ /boot/
ln -s /boot/ /boot/
Create /boot/initrd.2.4.20.img by typing:
/sbin/mkinitrd /boot/initrd-2.4.20.img 2.4.20
Edit the /etc/grub.conf by copying the linux section and giving it a new label and updating the image and intitrd files.
Use the following line for kernel options: kernel /vmlinuz-2.4.20 ro root=/dev/hda2 hdc=ide-scsi noisapnp
To run the new kernel reboot the machine

Not sure but need to cater for this -
If you are using PCMCIA (for example, a laptop), you also need to install the kernel-pcmcia-cs
and keep the old version. If you use the -i switch, it will probably return a conflict because the older
kernel needs this package to boot with PCMCIA support. To work around this, use the --force
switch as follows (the version might vary):
rpm -ivh --force kernel-pcmcia-cs-3.1.24-2.i386.rpm

niknah 01-08-2003 08:06 PM

next time you can use "make menuconfig" instead of "make config", it's prettier.

and after you edit grub you should type..
/sbin/grub-install /dev/hda(or whatever disk u boot from)

as long as you've copied and made a new label in /etc/grub.conf, everything should be fine, even if you stuff or there're incompatibilties, you can still boot your old kernel.

smartes 01-09-2003 05:26 AM

Thanks a lot - I will use menuconfig and have added the line
/sbin/grub-install /dev/hda2 to my steps.

How about the
Is this going to be there when I untar the kernel source - this is essential for a laptop

And the rest of the steps are OK? As you can realise this is my first time and I want to get it right first time. But I am feeling more confident than I was before

wdingus 01-09-2003 07:05 PM

Since you list RedHat as your distro and for anyone else looking for an "easier" way:

From RedHat's _rawhide_ site is this 2.4.20 source RPM.

# rpm -ivh kernel-2.4.20-2.6.src.rpm
# cd /usr/src/redhat/SPECS
# rpmbuild -bb --target i686 kernel.spec

A bit later in ../RPMS/i686 is a kernel RPM ready to install. A "RedHat kernel" is the same as a regular kernel just usually packaged as an RPM and pre-configured with basically every piece of hardware imaginable as a module.

PS. Or for pre-built kernels just search on and download/install.

All times are GMT -5. The time now is 07:31 AM.