Building a GameCube Linux Kernel (ARCH=ppc)

From gc-linux

Jump to: navigation, search

by Albert Herranz, 6 October 2004

Contents

BEWARE!

USE THIS TUTORIAL __ONLY__ IF YOU ARE BUILDING A KERNEL IMAGE FOR VERSION 2.6.23 OR OLDER.

For recent kernels (from 2.6.24 onwards) use the ARCH=powerpc tutorial.

Introduction

This guide explains briefly the necessary steps to produce a Linux kernel suitable for the GameCube, using a Linux PC.

Requisites

Installing the toolchain and doltool

1. Uncompress the toolchain to a directory where you have write access.

  $ cd /home/isobel
  $ tar xjvf /temp/ppc-linux-uclibc-toolchain-20040609.tar.bz2

2. Uncompress doltool sources there too.

  $ tar xzvf /temp/doltool.0.3.2.linux-TenOfTen.tgz

3. Build doltool, and copy the resulting binary to the toolchain bin directory.

  $ cd doltool.0.3.2.linux-TenOfTen
  $ g++ -o doltool *cpp
  $ cp doltool ../ppc-linux-uclibc-toolchain-20040609/bin/
  $ cd ..

Preparing to use the toolchain

1. Add the bin directory of your ppc toolchain tree to your PATH environment variable.

  $ export PATH=$PATH:/home/isobel/ppc-linux-uclibc-toolchain-20040609/bin

NOTE: This will temporarily add the toolchain directory to your path. If you plan to frequently use the toolchain you may want to modify your login script accordingly.

Installing and patching the Linux kernel sources

1. Put the kernel tarball, and the GameCube Linux kernel patches, in a directory where you have permissions.

  $ ls
  linux-2.6.8.1.tar.bz2  linux-2.6.8-gc.patch.gz

CAUTION: Do NOT use the /usr/src directory !!!

2. Unpack the kernel sources.

  $ tar xjvf linux-2.6.8.1.tar.bz2 

3. If you plan to build a ramdisk based kernel, copy your ramdisk image into the kernel source tree.

  $ cp /temp/ramdisk.image.gz linux-2.6.8.1/arch/ppc/boot/images/

4. Apply the GameCube Linux patch corresponding to your kernel version.

  $ cd linux-2.6.8.1
  $ gunzip -cd <../linux-2.6.8-gc.patch.gz | patch -p1

HINT: The patch for 2.6.8 applies also to 2.6.8.1

Building the kernel image

1. Change to the parent directory of your recently patched kernel source tree.

  $ cd ..
  $ ls
  linux-2.6.8.1  linux-2.6.8.1.tar.bz2  linux-2.6.8-gc.patch.gz

2. Start with the default GameCube Linux kernel configuration as a base config.

  $ cp linux-2.6.8.1/arch/ppc/configs/gamecube_defconfig linux-2.6.8.1/.config

3. (Optional) Modify the kernel configuration.

  $ make -C linux-2.6.8.1 ARCH=ppc CROSS_COMPILE=powerpc-linux- menuconfig

HINT: To change the initial IP settings of your kernel, go to "Platform options" and change "Default bootloader kernel arguments".

4. Build your kernel image. If you are building a ramdisk based kernel, then do a:

  $ make -C linux-2.6.8.1 ARCH=ppc CROSS_COMPILE=powerpc-linux- zImage.initrd
  $ doltool -d linux-2.6.8.1/arch/ppc/boot/images/zImage.initrd.elf

HINT: If you are building a non ramdisk based kernel, the target is zImage instead of zImage.initrd.

The resulting Linux kernel image in DOL format can be located at linux-2.6.8.1/arch/ppc/boot/images/zImage.initrd.dol

Personal tools