10. Update the kernel and tune the X Window system

In this chapter we will download the Linux kernel sources, add a few patches, and compile and install our own custom kernel on the harddisk. When we have successfully accomplished this exciting event, we don't have to boot from the installation boot floppy anymore.

10.1. Why update the kernel

The kernel we have used this far is a 2.2.18 kernel that I have provided. This is a quite stable and good kernel, but it's not sure that it's what you want. You should make your own kernel so you know what patches you need and what modules you can install when you really need them. Here are links to all sources and patches, and a step by step guide to compile your new kernel.

As for the installation we just have done, X does work, but only when you boot from the boot floppy. Would it not have been nice to be able to boot directly off the hard disk - and by the way, what about sound support? Let's set up this together as quickly as possible.

Before starting downloading files and compiling the kernel, check that you have these packages installed:

10.2. What files to download

We'll use the 2.2.18 kernel sources. The 2.2.19 kernel is availble, but it has some problems with compiling on ppc, so we'll stay with 2.2.18. To add better support for our Carolina motherboard, well add two patches from David Monro's Carolina page. This may sound complicated, but believe me, it's not. Follow the steps below here, and we'll get you up in an hour or so.

We're going to use the standard place for linux kernels, that is /usr/src/ There might be a linux directory there already, so let's rename it:
	mv /usr/src/linux /usr/src/linux.old
	
When downloading the kernel source and patches, place all files in /usr/src.

Begin with the linux-2.2.18.tar.gz source from the /pub/linux/kernel/v2.2 directory at ftp.kernel.org or a local mirror (recommended for faster download).

Then, get the Carolina patch and the IBM E15 frame buffer patch from David Monro's Carolina page at http://www.amberdata.demon.co.uk/carolina

10.3. Unpacking and patching the source

The next step is to unpack and patch the source files you just downloaded. cd to the directory where you downloaded the files, and unpack the kernel source by issuing this command:
        tar xzvf linux-2.2.18.tar.gz
        

(On some mirrors there are only bz2 files availble. If this is the issue, use xvIf instead of xvzf.)

This will make a directory called "linux" with all the kernel source. Now we shall add the patches. If the patches have the extentions "gz", unpack them with gunzip like this:
        gunzip carolina.diff.gz
        gunzip ibm_e15fb.diff.gz
        
Now add the carolina patch by issuing the commands:
        mv linux new
        patch -p0 <carolina.diff
        
Last, add the IBM E15 patch by issuing the command:
        patch -p0 <ibm_e15fb.diff
        
For a clean compile later, rename the kernel tree to its original name by issuing this command:
        mv new linux
        
If you get through these steps succesfully, the kernel source is now ready for configuring.

10.4. Configuring the kernel

The details of configuring the kernel are way outside the scope of this document. To get more help, try The Kernel HOWTO. Here, we'll just cover the basics to get a working kernel. Download my kernel config file into the linux directory in the kernel tree top directory.

In the directory containing the linux kernel tree, start the configuration program by issuing these commands:
        cd linux
        make menuconfig
        
Select the almost last option Load an Alternate Configuration File. Press backspace to remove the text in the box, type ingvar.config instead, and press enter. This config file has support for most you'll need on this box, including sound and the frame buffer device to run X. This should be enough to get the kernel to compile, but while you're in there, check over the different menus to get to know your possibilities. Don't be afraid to change anything. You can always load the configuration file again. A thing you really should check, and possibly change, is the Initial kernel command string, located in the General setup submenu. Change the value of the root device to the device where your root (/) filesystem is mounted. If unsure, press ALT+F2, log in and try the command mount. Press ALT+F1 to get back again (supposed that you are on virtual terminal 1). Also check your own preferences on filesystems and other stuff you might have special need for or interest in. If you for some reason don't want (or need) to run X, eg. because the console becomes much slower, remove support for the IBM E15 frame buffer in the Console drivers submenu.

In the main menu, save your new configuration for later use, if you like, and select exit. Answer Yes to the question about saving the changes. You are now ready to compile the kernel.

10.5. Compiling and installing the kernel

To compile the kernel is quite straightforward. If you're not in there already, enter the linux directory in the top level of the kernel tree, and issue this command series:
        make dep && make clean && make zImage && make modules && make modules_install 
        
Now, go and make yourself a cup of tea or coffee or have a beer or a bible study for some minutes. This can take some time. If everything is alright, you'll finally have a kernel to install when the text stops scrolling after maybe as much as 20 minutes, depending on your kernel configuration.

Now it's time to install your fresh-baked kernel. On RedHat-like systems like LinuxPPC, we keep kernels and their setupfiles in the /boot directory.
        cp /usr/src/linux/arch/ppc/boot/zImage /boot/vmlinuz-2.2.18
        cp /usr/src/linux/System.map /boot/System.map-2.2.18
        
Assuming that sda1 is your boot device, install the new kernel by issuing this command:
        dd if=/boot/zimage-2.2.18 of=/dev/sda1
        
We also want the System map link to point to our new System.map. Issue these commands:
        mv /boot/System.map /boot/System.map.old
        ln -s /boot/System.map-2.2.18 /boot/System.map
        
There! You are ready to reboot. Light some candles, remove the boot disk, and issue the command:
        reboot
        
If everything works out, the system will go down nicely, and (assuming you compiled in support for the E15 frame buffer) come up again with Tux, the Linux Penguin Mascot smiling to you while booting.

10.6. Set up X

In this chapter we will set up X, if it does not work properly already.

To set up X, check that you have installed the following packages:

Then as root, just run the command:
        Xconfigurator
        
And it will set up X for you. The usage of Xconfigurator is beyond the scope of this document, but it's quite easy. If you need help, try the Xconfigurator section in the Red Hat Installation guide.