Upgrading Kernel using GRUB

Author: Sanjay Ahuja

 

Note: This guide assumes new kernel version 2.4.20 and old kernel version 2.4.18-14. Please change as appropriate.

 

1) Log as root user to the Linux workstation.

2) Download the full kernel from www.kernel.org to /tmp .

3) Copy the linux-2.4.20.tar.gz to /usr/src:

cp linux-2.4.20.tar.gz /usr/src

4) Open the Zip file by using tar command:

tar -xvfz linux-2.4.20.tar.gz

5) Go to cd linux-2.4.20

cd linux-2.4.20

6) Run make mrproper command to check that the source code is ok.

If you are in GUI, please run the command:

make xconfig

If you are in text mode run the command:

make menuconfig or the command make config

(I don’t recommend using the make config command)

In this section you should configure what services, hardware support and so on yours kernel would support by itself or by using modules.

After doing the changes that you need, save the configuration by pressing on save and exit, and then press Yes for the message that asks from you to save the new settings.

There is a nice command make oldconfig that gives default answers to all the Questions based on the contents of your existing /.config file.

 

7) Run the make dep command and check out the end to see if you get some error Massages. If you encounter error messages, this may indicate that you skipped

8) Repeat section 6 and check that you have configured the missing module/configuration.

9) After this, Run again the make dep command and check the ending to look out for error massages.

 

10) Run the make mrproper command.

11) Run the make clean command.

12) Run the make bzImage command.

13) Verify that the file bzImage is under /usr/src/2.4.20/arch/i386/boot by using:

cd arch/i386/boot/bzImage

ls -la

14) Return to /usr/src/linux-2.4.20

cd /usr/src/linux-2.4.20

15) Run the make modules command.

16) Run the make modules_install command.

17) Run the make init.

18) Copy the new kernel from /usr/srv/linux-2.4.20 to /boot and rename it:

cp -p arch/i386/boot/bzImage /boot/vmlinuz-2.4.20

19) Copy a file System.map

cp -p System.map /boot/System.map-2.4.20

20) Copy the .config to /boot for the kernel documentation:

cp -p .config /boot/config-2.4.20

21) Make a new ramdisk for booting (optional):

cd /boot

mkinitrd --image-version initrd 2.4.20

Rename the ramdisk image to conform to Red hats conventions:

mv initrd-2.4.20 initrd-2.4.20.img

The ramdisk is only necessary if you don't have Ext3 support in your kernel or an Old SCSI adapter. A common problem when you compile the Kernel, you notice that you forgot to configure support in ext3 file system.

22) Edit the GRUB configuration file to add the 2.4.20 kernel To the default one from the Red hat RPM. The file /boot/grub/grub.conf Should contain 2.4.20 as the first (default) kernel:

title Red Hat Linux (2.4.20)

root (hd0,0)

kernel /vmlinuz-2.4.20 ro root=/dev/hda2

initrd /initrd-2.4.20.img

title Red Hat Linux (2.4.18-14)

root (hd0,0)

kernel /vmlinuz-2.4.18-14 ro root=/dev/hda2

initrd /initrd-2.4.18-14.img

23) Reboot the machine. If the kernel 2.4.20 booting fails, Reboot once more and select the default red hat kernel (2.4.18-14) At the boot-screen.

To reboot just write there reboot command and wait.