Building a kernel

When I started, I used the "Standard" kernel source obtained from kernel.org. I later learned of linux-pmac-stable, a kernel source tree, where the macintosh adaptions are introduced, before they are merged into the "Standard" source tree. You can obtain the sources using anonymous rsync. With the command
rsync -avz linuxcare.com.au::linux-pmac-stable /src/linux

(when /src/linux is empty) you can get a copy of the source tree. Executing the same command later will update the directory when files in the distribution have changed. Besides linux-pmac-stable, which is based on the most recent 2.2.x kernel, there is linux-pmac-devel, which is based on 2.3.x. If you preferred to use the standard kernel, you could get it from www.kerneli.org together with the crypto patches.

As you see, I suppose the kernel source is located in /src/linux and therefore also prepared the necessary links in /usr/include to point there:

rm /usr/include/asm
ln -s /src/linux/include/asm /usr/include/asm
rm /usr/include/linux
ln -s /src/linux/include/linux /usr/include/linux

As rsync transfers the unpacked files, you don't need these steps which would be necessary, had you fetched the standard source:

cd /src tar xzvf linux-2.2.13.tar.gz
cd linux
gzip -dc ../patch- | patch -p 1
rm asm
ln -s asm-ppc asm

The steps to produce the kernel are pretty straightforward. Using the standard kernel it took me nevertheless several trials, until I had a working kernel. This, because the README file was written for PC Linux, and did not tell everything I needed to know. A great help was the Guy de Riencourt's page on how to build a kernel on a PowerBook. Here the successful steps, with the indication if they are always needed, or only when using the standard kernel:

make mrproper
This cleans up the directory removing any leftover files from an earlier compilation attempt. This destroys also .config so don't execute it, if you want to compile the kernel you got from rsync archive using their .config file.
make pmac_config
Only needed when using the standard kernel, this sets the default config file to something useful for the powermac.
make config
Now I was presented with a lot of questions, about what I want in the kernel, and what not. For my first attempt, I mostly accepted the default answer. The given answers are stored into .config. If you want to build a kernel using the configuration as you got it from the rsync archive you would use the command make oldconfig.

The .config file may be overwritten by rsync. Thus if you made any changes to the standard configuration, store the resulting .config file in some safe place outside the linux source directory. Then, after your next update from the rsync archive, you would copy back your config file over .config.

make dep
Create some dependency information.
make vmlinux
Create the kernel.
make modules
Create the modules.
make modules_install
Install the modules into /lib/modules/version

As result of the last step I had a new kernel named vmlinux, which I copied to my mounted Mac partition, so that BootX could use it.

Benjamin Herrenschmidt's web page contains the newest version of BootX and MountX. The first is the system extension, which let's you choose to boot Linux or MacOS. MountX allows you to mount your Linux partition under MacOS, but it didn't work for me.

Last updated: 2000-04-16 by Claudio Nieder