I want to upgrade my kernel...but how do I do it?
Please Note commands to type are in blue and Links (to type or otherwise) are in Blue-Green.
If you happen to not have make on your system, right-click and "Save file as..." on any of the make instances in this document. Usually, make goes into the /usr/bin directory.
You will also need to have the full version of gcc on your system. I have placed it here so you can get it if you don't happen to have gcc. To check, type find / -name gcc -print. This will display the location of gcc. You can also see if its installed easily by typing: gcc -v, which will display the gcc version that is currently installed on your system.
- Download the latest source using ftp ftp.kernel.org, login as anonymous with whatever@you.want.com as the password, then enter the (cd) /pub/linux/kernel/vx.x.x.x directory, where x.x.x.x is equal to the kernel you wish to install. Even numbers are stable kernel releases (such as 2.2.14) and odd numbers are development kernels (such as 2.3.37).
get linux-x.x.x.tar.gz to your machine (where x.x.x.x = the version you need). Although its a good idea to always type bin when you ftp, the default file transfer
encoding on this ftp site is binary, so you need not do it. Also, setup hash now if you like to see #'s when downloading.
- Move the source directory: mv /usr/src/linux to /usr/src/linux-old (or whatever you prefer to name your old source code to). This will move the
original source that you received with your distribution of redhat.
- If for some reason this source isn't the original, and you have not made any changes to the kernel, install the kernel
source package again. COMMAND HERE Otherwise, back up the source, its a good idea.... You can also tar the directory using tar cvf whatever_you_want_to_call_it.tar source_directory
- The easiest way to work with the new tar.gz file is to move it to the /usr/src directory and use:
tar -zxvf linux-x.x.x.tar.gz
This will gunzip it (-z), extract the necessary files in the directory tree (-x), use verbose (see what's going on) mode (-v)
and tell tar which file (or block device) to work with (-f)
- You should now have a new /usr/src/linux with the new x.x.x.x source located within the directory.
- Copy (cp /usr/src/linux_old/.config) the .config file from the old source to the new x.x.x.x source directory.
- Run the make oldconfig command to load the old configuration and answer any questions/options that did not exist for your system which may come up about your old kernel config.
- If your system happens to not have a /usr/src/linux directory, don't sweat. Just skip to the next step below . . . This may occur when you install a Redhat configuration without installing the source code.
- Alternately, you can install the source code from the CD-ROM, FTP, tar-file, or whatever medium you used to get Linux up and running on your system. More to come about that soon!!!
- Run the make xconfig in order to alter the older kernel.
- Must have Xwindows running, or this won't work. Believe me, this is the best way to configure the kernel. It has detailed help files on every option, including module options. You want to do it this way.
- For posterity's sake, you can run make menuconfig if you have TK installed.
- If none of these options are available, you can run make config for the command line version.
- Please note, only the xconfig has easy to read help files and an easily navigatable installation procedure. The others are really annoying, but to each his or her own.
- The command line version has help files, and its much better to read than the TCL version. Use this if you don't have Xwindows or don't want to run the TCL version in a really small terminal screen. . . .
- Now you want to make dep to create the dependencies for the source code.
- make modules to create the modules you selected from above.
- make modules_install Install the modules you just created.
- Now that we have most of the easy stuff done, let's jump ahead and edit vi, kedit, pico, or emacs/xemacs the /etc/lilo.conf file (use whatever editor makes you happy).
You will get a file that looks similar to this:
boot=/dev/hdc
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
default=linux
image=/boot/vmlinuz-2.2.12-20smp
initrd=/boot/initrd-2.2.12-20smp.img
label=linux
read-only
root=/dev/hdc6
image=/boot/vmlinuz-2.2.12-20
label=linux-up
initrd=/boot/initrd-2.2.12-20.img
read-only
root=/dev/hdc6
Add these lines:
image = /boot/vmlinuz-orig
label = orig
read-only
root = /dev/hdc6
Change root = /dev/hdc6 to reflect the other entries (this varies on your system). Don't freak out if your /etc/lilo.conf doesn't look exactly like mine.
- Now, copy (cp /boot/vmlinuz /boot/vmlinuz-orig) the original vmlinuz to vmlinuz-orig (or whatever you named your backup in lilo.conf). Also, copy the original System.map file (cp /boot/System.map /boot/System.map-orig) to a backup file.
- Next, change directory cd /usr/src/linux to the /usr/src/linux directory and
run make install to begin the kernel compilation. This will compile the kernel, install it for you, and run lilo so you can boot with the new kernel.
- At this point, cd /boot and remove the vmlinuz file and System.map (rm vmlinuz & System.map)
- Next, we need to link the new kernel with the vmlinuz file (ln -s vmlinuz-x.x.x.x vmlinuz) and link the new system map to the default file (ln -s system.map-x.x.x.x System.map
- Finally, we are almost there....just run lilo and watch it "Add" your new configurations.
Here comes the final test.....SAVE THIS PAGE and reboot now!!!
The reason I say save this page is because, depending on your system configuration, when I first did this my new kernel didn't boot, but the old Tulip.o driver file was replaced....so I didn't have LAN connectivity. It could be much worse for you if your system can't get back to my page to read the backout instructions!!!
If the system doesn't come back for whatever reason, or produces strange errors, power off your machine, wait approximately 10 seconds for the drives to spin down, then power it back up.
When you get to the Lilo: prompt, press tab and you will see a list of available boot options. You don't need to worry about Lilo booting the new kernel, it pauses when tab is pressed.
Type in the name of the previous kernel (such as orig in the example above) and you will get back into your old kernel configuration.
That's about it. If it didn't work the first time, try again. Choose different options and try again. Look on the net for more help. Send a note to a Linux Mailing List....it never hurts!
If it did work, Congratulations, you just installed a new kernel...don't forget to run uname -a to verify you are using the new kernel.
Many thanks to Nicholas Henke for helping me with my first kernel compile experience. It didn't work the first few times, but hey! Its better than trying to guess what the HOW-TO is talking about.