To compile a Kernel is very easy if you know your computer hardware and you follow systematically the instructions step by step. Philip de Groot has written a very good instruction and there is nothing to go wrong if you do not overwrite your old kernel and you do not overwrite your old modules. The worst that can happen is that the new kernel does not work and then you can boot on the old one.
Philip's article can be found here:
http://linuxfocus.org/English/July2002/article252.shtml
In the following I will emphasize the points which are important to avoid overwriting of the currently running kernel.
If you install new kernel sources which have a higher revision than the currently running kernel then the modules in will get a separate directory and there is not danger that you overwrite the current kernel modules. You can check you current version with the command: uname -a
If you use a kernel with the same revision as the currently running one then edit the makefile (normally /usr/src/linux/Makefile) and add something to the EXTRAVERSION in the 4th line:
VERSION = 2 PATCHLEVEL = 4 SUBLEVEL = 17 EXTRAVERSION = custom1Here I added "custom1".
now follow Philip's article:
# configure: make xconfig # compile: make dep make clean make bzImage make modules make modules_installThe last step (make modules_install) should have created a new modules directory in /lib/modules.
Now modules are installed but the kernel is still at /usr/src/linux/arch/i386/boot/zbImage. If you are fairly sure that the new kernel will work then you can copy it to /boot/vmlinuz-2.4.17-custom1 and update lilo. The saver solution is however to copy it to a floppy disk and test it. If it does not work as expected then you pull out the floppy and you are back to your old system. Nothing has changed! To make a raw copy of the kernel to floppy use the command: dd if=/usr/src/linux/arch/i386/boot/zbImage of=/dev/fd0 Don't forget to put a floppy into the drive. Set your bios such that it will boot first from floppy and test your new kernel. If you have carefully read the instructions from Philip then you notice that we have not updated /boot/System.map and the kernel on the floppy does not match the /boot/System.map file. This is not a problem. When the new kernel comes up you can run
uname -a
and check the time stamp in this printout. It must be the time and date of your kernel compilation.
If the new kernel does not work and your system fails then pull out the floppy and reboot. You will get back to your old and unchanged system.
If the test with the floppy is OK then add (!!) an extra entry to your lilo config file for the new kernel. This is also described in the instructions from Philip. It's important to still have a lilo entry for the old kernel to be able fallback in case you find later a problem that you have not noticed during the first test with the floppy.
look at the current content of /boot:
ls -al /boot copy the new kernel: cp /usr/src/linux/arch/i386/boot/zbImage /boot/vmlinuz-2.4.17-custom1 backup the old System.map: cp /boot/System.map /boot/System.map.old copy map and config file cp /usr/src/linux/System.map /boot/System.map-2.4.17-custom1 cp /usr/src/linux/System.map /boot/System.map cp /usr/src/linux/.config /boot/Config-2.4.17-custom1 edit /etc/lilo.conf run lilo: lilo reboot
Enjoy the new Kernel