|Compiling & Upgrading The Linux Kernel|
Joey's Compiling and Upgrading your Kernel Guide
Before you begin the upgrade please make sure you create an emergency boot floopy by typing mkbootdisk --device /dev/fd0 2.2.18 (You might have to change the 2.2.18 part if you're currently running a different kernel). It is extremely important that you make this backup disk. If the kernel upgrade goes wrong, you can end up being locked out of your system. Please note that if you have any trouble with the mkbootdisk command, either type man mkbootdisk or come and see us in #LinuxGroup.
If you're running Debian GNU/Linux then the command is mkboot /boot/vmlinuz-2.2.18 and as also stated above, you will have to change the 2.2.16 part to reflect the current kernel you are using.
If at any part you run into a problem with your kernel, please check the troubleshooting section at the end of this guide for hints.
So now that it's all clear we can begin. Once you log in as root, you should download the latest source (linux-2.4.7.tar.gz) at ftp://ftp.kernel.org/pub/linux/kernel/v2.4. That will probably take awhile, it is a 14+ meg file. Once it is done downloading, place the file into /tmp and then untar it by doing:
tar -zxvf linux-2.4.7.tar.gz
Once it untar's then you should move it to /usr/src by typing:
mv /tmp/linux /usr/src/linux-2.4.7
Now that that's done, go into /usr/src and remove the linux symlink by typing:
Now recreate the link pointing it to the latest kernel.
ln -s /usr/src/linux-2.4.7 linux
If you have previously compiled a kernel and you are now upgrading it, then, you can save yourself some time by copying the .config file from the old kernel directory to the new kernel directory. If you haven't and you have no idea what I'm talking about, don't worry about it and just continue on with the guide.
Now go into /usr/src/linux-2.4.7 and type:
make menuconfig if you are in console or type:
make xconfig if you are in X.
In a couple of seconds there will be a menu with a bunch of options for you to choose from. I can't really tell you what to select and what not to select in these menus due to the fact that every system has different hardware needs etc. I suggest you go through each of the listing and read the help for each of the options and decide if you wish to have that feature in the kernel. I will however include my /usr/src/linux-2.4.7/.config file for you to look at.
If you really aren't sure if you need something in the kernel, and you have already made a rescue boot disk like I said to do in the beginning of this guide, then you can probably just include it into the kernel. Besides having a bigger kernel, it probably won't harm your system. But you shouldn't be messing with something if you have no idea what it is. So I leave it up to you to decide.
Once that is all done and you choose "Exit" and save your config file, you must run the following:
make dep followed by:
Now the real fun begins, type make bzImage to build your kernel. This will take awhile (15mins+) depending on your system, so go browse our site a little and send us some feedback ;).
Instead of make bzImage, you can run make zdisk which will write your kernel to a floppy disk instead. This is a good way to test your new kernel without having to really endanger your system.
Now that it's done, you have to run the following commands:
This will build all the modules (M) that you selected in the kernel configuration menu. Now it's time to set up LILO. First you have to move the newly created Kernel to your /boot directory. Do this by typing:
cp /usr/src/linux-2.4.7/arch/i386/boot/bzImage /boot/vmlinuz-2.4.7
The next step would be to move the System.map file to your /boot directory. Do that by typing:
cp /usr/src/linux-2.4.7/System.map /boot/System.map-2.4.7
Next up, you'll have to edit your /etc/lilo.conf file. Do this by typing:
You should see something like this:
boot=/dev/hda map=/boot/map install=/boot/boot.b prompt timeout=50 image=/boot/vmlinuz-2.2.18 label=linux root=/dev/hda5 read-only other=/dev/hda1 label=windows table=/dev/hda
You should change it to look like this:
boot=/dev/hda map=/boot/map install=/boot/boot.b prompt timeout=50 image=/boot/vmlinuz-2.4.7 label=linux root=/dev/hda5 read-only image=/boot/vmlinuz-2.2.18 label=linux.old root=/dev/hda5 read-only other=/dev/hda1 label=windows table=/dev/hda
Note that if your root=/dev/hda# is different then mine, that's perfectly fine. The number 5 on mine means that the partition where the Kernel is located is the 5th partition. Yours could be hda6 etc. Once that is done, exit pico by hitting control x and it will ask you if you want to save it, say yes and it will return you to the prompt.
Also, please note that you might not have the windows portion in your /etc/lilo.conf file if you do not have windows installed on that machine.
You must rerun LILO now by typing /sbin/lilo and if everything goes okay, you will see something like this:
[firstname.lastname@example.org boot/]# /sbin/lilo Added linux * Added linux.old Added windows [email@example.com boot/]#
Do you know what that means? It means that everything so far is going ok. Now the ultimate test, reboot your computer and see if it works. If all goes well you should see your computer boot up as usual and you will see something like:
Red Hat Linux Release 7.1 [LinuxHelp.net] Kernel 2.4.7 tty1 linuxhelp.net login:
Congratulations, you have just installed your new Kernel.
One last thing, if you get those net-pf-5 errors when you boot your system, you can get rid of them by adding the following lines to your /etc/conf.modules file (/etc/modules.conf in Debian):
alias ppp-compress-21 bsd_comp
Okay, it's not easy to just sit here and think of problems and solutions without having it happen to myself on my machine. With that said I'll just cover some problems that I have had and how I fixed them.
Problem 1. make menuconfig wont run
Problem 2. Kernel Panic on reboot
Problem 3. Modules have unmet dependancies at boot
Problem 4. I recompiled my kernel and now something doesn't work
Having trouble? Got questions? Require further assistance? If so please feel free to visit our Help Forums and ask the experts!
Copyright © 1997 - 2013 Private World Domination Inc. All rights reserved.