Since updated software for OS X on PPC is getting hard to find, I decided that a source based Linux distro could extend the life of the machine a little longer (debateable, some feel an OS like Debian has more support). Although to be honest, a more practical option would be to keep OS X and compile any Linux software I wanted for OS X. But what's the fun in that? I haven't really used OS X but I would definitely like to experiment with it, so my goal is to have a dual boot system with OS X and Gentoo Linux.
I don't have any experience with Linux on PPC (especially the bootloader), so I decided to take no chances and removed the hard drive with OS X on it and put in a spare 160GB sata drive I had, just to make sure I didn't ruin some data. (fdisk /dev/sda instead of /dev/sdb has been known to happen...)
This walkthrough is heavily inspired from the PPC Gentoo Handbook. I had to make a few modifications since I didn't want a fully 64 bit system and the regular PPC handbook won't work for a G5 if you follow it exactly.
The Gentoo minimal install CD can be downloaded here: http://distfiles.gentoo.org/releases/ppc/current-iso/
This walkthrough was made using "install-powerpc-minimal-20091018.iso"
Burn the iso to a CD-R with a program like Iso Recorder, Nero, or K3B.
Booting from the Install CD
Insert the CD (you may have to boot into OS X to eject the drive without forcing it manually). Reboot and hold down the "c" key after the startup tone sounds.
If you did it right, some information and boot options will be displayed by yaboot. Type "G5" and hit enter to boot from the livecd. If the display is corrupted (I had some problems with the pcie Radeon) try rebooting and typing "G5 video=ofonly" at the prompt.
The livecd should detect the network interface and start dhcp automatically.
When it's finished booting, start ssh so we can install from a different computer.
passwd password (use your desired password)
Take note of the ipaddress and open an ssh connection from another computer. From Linux:
Prepare the Hard Drive
This part can get a little tricky. The drive needs a minimum of 4 partitions (counting swap), 2 of which are not used by linux. We will use mac-fdisk to partition the drive. Since, I am installing to a separate drive I'm not going to worry about mac partitions.
Press "i" to wipe the drive and initialize it. Warning: All data will be lost!
After the drive has been initialized, press "b" and enter "2p" when asked for the start block. This installs the Apple_Bootstrap partition.
Now we need a swap. Press "c" and enter "3p" for the block. Enter "512M" or greater when asked for the size. Most people generally use twice the installed memory. Type "swap" when the name prompt appears.
Finally, the root partition. Press "c" and enter "4p" to select the starting root block. When the size prompt comes up, type "4p" again to use up all the remaining space. When asked for a name, enter "root."
Hit "w" to save the changes, and then "q" to exit.
Set the Time
Maybe it's already correct? Type "date" and verify. If not set the correct time and date:
date 051018002010 (mmddhhmmyyyy - Month Day Hour Minute Year)
Create the Filesystems
I used ext3, a nice solid file system with plenty of support. Yaboot will not boot from ext4, so if you want to use it you will need a separate boot partition.
mke2fs -j /dev/sda4
Create and activate the swap partition:
mkswap /dev/sda3Mount the root partition so we can install Gentoo on it:
mount /dev/sda4 /mnt/gentoo
Download and Install the Latest System Files
Move to /mnt/gentoo to make things easier.
Now navigate to the Gentoo mirrors to download the latest stage 3 file:
Navigate to releases/ppc/current-stage3 and download:
tar xvpjf stage3-ppc64-32ul*.tar.bz2
Now portage needs to be downloaded and installed/updated.
Navigate to releases/snapshots/current and download:
Now install it:
tar xvjf portage-latest.tar.bz2 -C /mnt/gentoo/usr
It might take a while to finish decompressing.
We need to optimize compiling for the G5 processor.
Here's what I have in my make.conf:
CFLAGS="-O2 -pipe -mcpu=970"
Note since the 32bit User Land is being used, there is no 64 after the powerpc above.
Chroot to the New Installation
Copy over the DNS info so that the internet is accessible:
cp -L /etc/resolv.conf /mnt/gentoo/etcNow /proc and /dev needs to be mounted:
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev/ /mnt/gentoo/dev/
chroot /mnt/gentoo /bin/bash
You should now be inside the new Gentoo installation. Portage should already be up to date, but you can run "emerge --sync" to make sure.
List a profile:
eselect profile list
Select your desired profile:
eselect profile set 9 (9 is the 64/32 gnome desktop that I used)
Set the Timezone
Find your timezone with "ls /usr/share/zoneinfo"
Select it by "cp /usr/share/zoneinfo/America/Los_Angeles /etc/localtime"
You can see that I'm using PST time. Adjust to your needs.
While we are messing the time, might as well configure the clock.
Uncomment the line with "Factory" in it and replace "Factory with your zone/city. For me, that's "America/Los_Angeles"
Install and Compile the Kernel
For simplicity, I'm sticking with gentoo-sources.
Now change directories:
Configure the default settings for the G5:
I've found the above command is all you need for a bootable system. Of course you should probably configure to your liking with "make menuconfig"
Now the tricky part! The G5 needs a 64bit kernel to boot, but we are using a 32bit User Land! This means we have to cross-compile the kernel. Just typing "make" will not work! Use the following:
CROSS_COMPILE="powerpc64-unknown-linux-gnu-" make && make modules_install
Wait until it's finished compiling (probably about 30 minutes) and then copy the kernel to /boot:
cp vmlinux /boot/kernel-2.6.32
Getting close! Bet you thought I forgot about fstab. Think again!
Make sure to comment out the line for the /boot partition
Change "ROOT" to "sda4"
Change "SWAP" to "sda3"
The default settings are configured for an ext3 /root and swap on sda3.
Set Hostname and Network
Now emerge dhcp:
If you are using DHCP on your network, you most likely don't need to configure anything else. Gentoo will automatically get an address on boot.
Set the Root Password
This one is kinda important ;)
To speed things up, I'm only installing a System Logger.
Now make sure it starts on boot:
rc-update add syslog-ng default
The bootloader was one of the most confusing steps to me as I was used to grub.
Since we are using 32bit UL, we need regular yaboot (NOT yaboot-static)
emerge yabootNow, either exit out of the chroot, or just start a seperate ssh session to the live cd and run:
yabootconfig --chroot /mnt/gentoo
It's important you run the above command out of the chroot environment or it will error out.
If the fstab is configured correctly there should be no problems.The bootstrap should be /dev/sda2.
When it asks for a kernel type: "/boot/kernel-2.6.32" (or whatever you named your kernel)
Leave initfs blank.
When it's done, we are ready to reboot! Unmount /mnt/gentoo/proc /mnt/gentoo/dev/ and /mnt/gentoo
If all goes well, gentoo will boot to the command prompt!
From here on out, software can be instaled using standard emerge commands. After emerging gnome, a few other apps, and fiddeling with the appearence (thanks gnome-look.org), I ended up with this:
I actually had some fun working through this project, but I have to say I probably won't be using it as my main desktop. The system is noticeably snappier than OS X, but that may be because I have no 3D effects turned on. The main drawback is closed source software that isn't precompiled for PPC (Adobe Flash, Skype) won't work, which greatly reduces the usability of the system. (Maybe HTML5 will change that?)The OS X drive will be going back in soon and I'll experiment with compiling linux software in OS X. Oh well, it was a fun, project.