CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >

9. Compile a kernel

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.

9.1. Why update the kernel

The kernel we have used this far is a complete 2.4 (2.2 for YellowDog) 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, you have to boot from 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:
make
gcc
cpp
glibc-devel
ncurses-devel
kernel-headers
(This list should probably be longer.)

Note that the names of this packages may change slightly among the distributions.

9.2. What files to download

We'll use the latest 2.4 kernel sources with a few patches, among those the IBM-E15 frame buffer patch from David Monro, which gives us a working frame buffer console able to run XFree86. 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/ . When downloading the kernel source and patches, place all files in /usr/src .

First we must get the working 2.4 source. To get this, we'll use the rsync tool, so check that you have it installed. Some nice people have set up an rsync server of the BitKeeper Linux/PPC development tree at source.mvista.com. Thanks so very much to them, remember them in your heart and prayers.

Note: You may use the standard Linux kernel source from any ftp.kernel.org mirror. A modern kernel like 2.4.21 should work allright. I've found the devel tree more well functioning on the 7248, so I stick with it.

Warning: Don't do this over a low-end link, like a modem. It'll take forever. So, let's rock and roll. Issue these commands:
cd /usr/src
mv linux linux.old
mkdir linux-2.4
ln -s linux-2.4 linux
cd linux
rsync -avz --delete source.mvista.com::linuxppc_2_4_devel .
chown -R root.root .
chmod -R u+w .
Note that you'll probably have to wait for some minutes to rsync over all the sources. This is normal.

Then, get David Monro's IBM E15 frame buffer patch from Leigh Brown's site page at http://www.solinno.co.uk/7043-140/files/2.4.19-2/

9.3. Patching the source

The next step is to patch the source files you just downloaded. First add the IBM E15 patch:
cd /usr/src/linux
patch -p1 < ../030-e15fb.diff
If you have more patches, add them the same way. Now the kernel source is ready for configuring.

9.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 top directory of the kernel tree , /usr/src/linux .

In the top directory (/usr/src/linux) start the configuration program by issuing the following commands:
make ibmchrp_config
cp ingvar.config-2.4 .config
make menuconfig
Inside the kernel configuration system, we check over the different menus to get to know our possibilities. Don't be afraid to change anything. We can copy the original back, and load the configuration system again. There are a few things to check out before we go on compiling and installing:

9.4.1. Initial kernel command string

A thing you really should check, and possibly change, is the Initial kernel command string, located in the General setup submenu. This string is a space-separated list of options which are sent to the kernel at boot time. This is actually configuring the bootloader, and the closest we come to LILO, Grub or Yaboot on the 7248. Change the value of the root device to the device where your root (/) filesystem is mounted. This is done with root=device. An example could be root=/dev/sda3. If unsure, log in on another terminal and check with the mount command.

9.4.2. Support for the integrated sound adapter

The 7248 is equipped with a built-in Crystal Audio cs4232 sound adapter. There is support for this adapter in the Linux kernel. When configuring the kernel, check that the settings for sound are correct. They should look like this:

  • Sound: Y

  • OSS sound modules: Y

  • Support for Crystal CS4232 based (PnP) cards: M

And check N for everything else in the sound section.

9.4.3. Support for framebuffer graphics

Some minutes ago we patched in a driver for the IBM E15 framebuffer driver. This is needed to run X (and to get a nice, smiling Tux when booting). If you for some reason don't want (or need) to run X, or you don't prefer a framebuffer console (it scrolls slower than standard VGA), remove support for the IBM E15 frame buffer in the Console drivers submenu.

9.4.4. Support for other stuff

Also check your own preferences on filesystems and other stuff you might have special need for or interest in. The downloaded config file should have sane values, though.

9.4.5. Save changes

When we have finished configuring, save our new configuration for later use, (at the bottom in the main menu) and select exit. Answer Yes to the question about saving the changes. You are now ready to compile the kernel.

9.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:
cd /usr/src/linux
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 most Linux-based systems like, we keep kernels and their setupfiles in the /boot directory. Check what version you run with a look at the Makefile, and add proper version numbers in the commands below:
head /usr/src/linux/Makefile
cp /usr/src/linux/arch/ppc/boot/images/zImage.prep /boot/vmlinuz-2.4.21
cp /usr/src/linux/System.map /boot/System.map-2.2.18
Assuming that sda1 is your boot device with a PReP Boot partition, and your kernel has version 2.4.21, install the new kernel by issuing this command:
dd if=/boot/zimage-2.4.21 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.4.21 /boot/System.map

9.6. Configure modules

Before rebooting we must send some parameters to configure the sound modules. On YellowDog, SuSE and Mandrake, this is done in /etc/modules.conf. In Debian, use /etc/modutils/sound. Edit this file, and add the following lines:
alias sound cs4232
pre-install sound /sbin/insmod sound dmabuf=1
options cs4232 io=0x534 irq=5 dma=1 dma2=0 mpuio=0x330 mpuirq=5
On Debian, run /sbin/update-modules when done.

9.7. Pray and reboot

There! We are ready to reboot. Light some candles (some people prefers to sacrifice chickens or even goats), remove the boot floppy, and issue the command:
reboot
If everything worked, 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.