Gentoo Linux PPC Quickstart Guide David Chamberlain This guide is intended for those already familiar with Gentoo Linux. It will point out the major differences you need to be aware of between the PPC port and the x86 version. If you aren't familiar with Gentoo, you should read the Gentoo PPC Full Install Guide. 1.0 14 April 2002 Pre-Install

If you're only going to have Linux on this box, you're ready to start. If you want OS9 and/or OSX, you'll need to set up your disk from the Mac environment first. There's a thorough guide here: http://people.debian.org/~branden/ibook.html. Also look here: http://www.oreillynet.com/pub/a/mac/2002/03/29/ibook_linux.html.

Don't get carried away making lots of partitions - when you look at the drive in mac-fdisk, you're going to see that Apple already has at least 8 partitions at the start of your drive for its drivers, and you're going to need an extra one for a kind of fake MBR we'll be using. Since I've been using Linux, I've suspected that the large number of partitions on my drive has made OSX rather crash-happy. Still, one thing to consider is making a smallish, plain HFS ("Apple Standard") partition so you can comfortably swap files between Linux and Mac - that's the one format they can both read (though deleting files on HFS has given me quite a few Linux kernel panics).

A final note: most OSX users seem to agree it's a good idea to have a separate partition for OS9 ("Classic"), even though you can install it on the same one as OSX.
Using the Install CD

You can download the iso for the install CD from http://ftp.sunsite.dk/projects/gentooppc/build. If you burn it as a CD master, it will be able to boot your Mac. With the CD in the drive, power-on the Mac while holding down the C key. Alternatively, hold down the Option key for a boot menu and choose the CD. Older Macs may require arcane combinations of the keys C, D, Shift, Option etc. If you have one of these, you're on your own.

While you're logged into the ftp site, see if there's a version of build-ppc.tar.bz2 that's more recent than the CD image. If there is, grab it too - it probably has something you want in it (currently that means rsync!)

If you've successfully booted from the CD, you'll have a chance to choose your boot mode. Note that nearly all Macs made in the last four years or so are so-called "New-World" machines and can use the default boot mode.

Setting Up

Unlike the x86 boot CD, the PPC version will almost certainly activate all necessary hardware without the need to modprobe. You'll see instructions for bringing up the network - yes, there's no need to look for your ethernet driver. If ifconfig doesn't work right off the bat, you can poke around in /lib/modules to see if there are any drivers you can load, but you're probably not going to be able to do the install this way.

There are, on the other hand, some useful drivers in /lib/modules - in particular, Firewire. If you want to use a Firewire drive (or a powerbook in Target Disk mode :-) during install - e.g. to load a newer build tarball - try:

modprobe ieee1394
actually I think that's built in to the kernel
modprobe ohci1394
modprobe sbp2

This should attach your drive as an emulated scsi device - check dmesg to see where it shows up. If it doesn't work, try unloading and reloading the modules a couple of times to check - firewire support has come a long way, but it's still kinda sketchy, especially - irony of ironies - on the PPC side.

No, I haven't tried Target Disk with Linux - it's an idea though...

Once you get the network set up, you're ready to partition, which you do using mac-fdisk. It's pretty straight-forward - use "p" after partition numbers to select default starting and ending blocks. See the guides mentioned above, and don't forget to make the special bootstrap partition using the "b" command - this is our version of a MBR. If you make this the first (non-driver) partition,the Mac will try to boot from it first; but note that you don't have to do it this way. Once you're done installing, you can boot into Open Firmare (Cmd-Option-O-F) and issue some cryptic Forth commands to tell the machine which partition to boot from.

Another note: since i'm concerned about having too many partitions, I kept /boot on the root partition. No unforseen problems so far. What with all those Apple partitions, it's a good idea to write down the important partition numbers and names somewhere.
Install

You can follow through most of the standard Gentoo install guide now. Make sure your net connection is working (e.g. put an entry in /etc/resolv.conf); make your linux filesystem(s) and mount it. Unpack the build tarball onto /mnt/gentoo - note that if you want to grab an updated tarball now, wget is available - mount proc, copy over /etc/resolv.conf and chroot in.

Now you can run emerge rsync: first check /etc/make.conf - set SYNC to rsync://sunsite.dk/gentooppc/portage. You're ready to bootstrap and emerge system.

I strongly recommend getting all the sources before starting: before bootstrap, you should emerge --fetchonly baselayout, gcc, glibc, binutils and gettext. Before emerge system, emerge --fetchonly system. Be sure that /etc/make.conf has the ppc settings. It should probably just be a link to /usr/portage/profiles/default-ppc.
Configuring your system

The main difference you'll find here from x86 Linux is the bootloader, yaboot. It's a lot like lilo: settings go in /etc/yaboot.conf - here's mine:

## /etc/yaboot.conf
##
## run: "man yaboot.conf" for details. Do not make changes until you have!!
## see also: /usr/share/doc/yaboot/examples for example configurations.
##
## For a dual-boot menu, add one or more of:
## bsd=/dev/hdaX, macos=/dev/hdaY, macosx=/dev/hdaZ

## our bootstrap partition:
boot=/dev/hda9

##hd: is open firmware speak for hda
device=hd:
partition=11

root=/dev/hda11
delay=5
defaultos=macosx
timeout=30
install=/usr/lib/yaboot/yaboot
magicboot=/usr/lib/yaboot/ofboot

#################
## This section can be duplicated if you have more than one kernel or set of
## boot options
#################
image=/boot/vmlinux
	label=Linux
	read-only
##################

macos=/dev/hda13
macosx=/dev/hda12
enablecdboot
enableofboot

Once yaboot.conf is set up how you want it, you run /usr/sbin/ybin to install the settings in the bootstrap partition. Don't forget this! If all goes well, and you have the same options as me, your next reboot will give you a simple, five-entry boot menu.

Yaboot has some functionality for setting config at boot time, so take a look at http://penguinppc.org/projects/yaboot for more info.

As for configuring and compiling your kernel, the default config you'll get with the gentoo ppc sources will have most of the important stuff set up already. There are usually very few alternative drivers for Mac hardware, and the necessary ones will almost certainly be preselected. Still, use the 'help' option in make menuconfig if you have any doubts. Note that you'll have trouble making a bzImage. Stick with make vmlinux unless you know what you're doing.

If you want to know who Ben is, see http://penguinppc.org/~benh or http://ppckernel.org. He's the PPC kernel maintainer, and most PPC linux users use sources from his tree, not the kernel.org tree.

Another ppc quirk is the difficulty of setting up XFree. First, if you want to use direct rendering with a video card, try loading the appropriate kernel module first, just to be sure. Second, I've had best luck recently with XFree86 --configure. Still, what the config programs think should work may not. Your usb mouse will probably be /dev/input/mice, by the way. If you don't know what hardware (e.g. video card) you have, try emerging pci-utils, then issue the command lspci. It may pick up the relevant details.

"Option" "UseFBdev" is your friend :-) At the time of writing, ppc portage has an extra, cvs version of xfree. This may not build, so don't rely on leaving it to compile overnight or something like that.

Well, there it is. Things are functioning very well right now, but the more people we can get testing, the better. If you want to try your hand at making an architecture-independent ebuild, take a look at /usr/portage/media-sound/mpg123/mpg123r-r1.ebuild. Note also that any ebuild that downloads binary files will probably be broken, unless the author has included alternate ppc binaries (see new xanim ebuilds).

Yes, KDE3 works fine - thanks for the great ebuilds, Dan :-)