Sony Playstation 3

Sony Playstation 3 is a home theater personal computer (HTPC) class device which acts as a multimedia frontend in living room. It's an open platform computer in which Gentoo Linux can be installed using documentation found on this page.

This article intends to be an up-to-date installation/configuration Gentoo guide for the PS3. The documentation found for this purpose is very old and deprecated and should not be used nowadays.

Old articles
There are several web pages explaining how to install Gentoo on the Sony PS3. However, those are mostly deprecated.  http://overlays.gentoo.org/proj/cell/wiki/InstallGentooOnPS3  http://ps3wiki.qj.net/index.php/Gentoo_Howto  http://overlays.gentoo.org/proj/cell 

Getting started
Your installation of Gentoo should follow three main steps:
 * Prepare PS3 for the installation of other OS and partition hdd using the tools provided by Sony.
 * Install Gentoo as you would do it on any other hardware.
 * Install PS3-related packages.

Preparing the PS3
First of all, you must prepare the PS3 for the installation of another OS. The most recent bootloader for the PS3 is Petitboot, which can be found here: http://ozlabs.org/~jk/projects/petitboot/. To format your PS3 and install Petitboot, follow the instructions on this website. You can also use more recent development petitboot builds here: http://www.kernel.org/pub/linux/kernel/people/geoff/cell/ps3-petitboot/.

Getting the installation media
To perform the installation, you need a LiveCD to boot up. Gentoo PPC CDs booting on the PS3 are quite old and do not support some technologies such as ext4. You can use any other distro's PPC/PS3 LiveCD. You can also use an old but working Gentoo/PS3 LiveCD, which can be found on any gentoo mirror under experimental/ppc64/installcd-ps3-minimal[...].

Getting a stage3 and a Portage snapshot
Get the latest ppc64 Gentoo stage3 from in releases/ppc/current/ on any Gentoo mirror. See the Gentoo PowerPC installation documentation for more information and a list of mirrors. You can choose to use a 32-bit userland or a 64-bit userland. Choose the stage3 that fits your needs.

The way of getting the portage snapshot is the same than this manual. Get the stage3 and the snapshot, and put those two files on a USB stick.

Disk partitionning
Format your hard disk the same way you would for any other Gentoo installation. As the PS3 has only 512 Mib of RAM, you should create a pretty big swap partition (up to 1 Gib), just in case. A boot partition isn't necessary.

Make.conf
Note here that this configuration is accepting ~ppc64 keywords so this system may be unstable, but the packages will be more bleeding-edge.

WARNING: If you use an old LiveCD, do NOT perform any upgrade now. Wait until you have a recent kernel and booted it. Upgrading glibc will break python (and emerge is programmed in python). See bug 271367

Kernel
Build the kernel (64-bit userland)

For a 32-bit userland, you need the package kgcc64 which provides a 64-bit cross-compiler. Build the kernel (32-bit userland)

If you want an optimized kernel (and you have gcc >= 4.4.0), you may add the following in front of the make command: Build an optimized kernel (gcc 4.4.0 or higher)

kboot.conf
Petitboot needs a config file if you want it to boot your Gentoo installation. It doesn't seem to find the /boot/petitboot.conf file, so let's name it /etc/kboot.conf to avoid problems. Here is an example:

fstab and using the gpu's RAM as swap
The PS3 comes with only 256 Mb of RAM, but you can add the 256 Mb of the gpu's RAM as a high-speed SWAP. The device is named /dev/ps3vram

Adjust this file to reflect your system. (partitions, filesystems, etc).

After your first boot, create the swap filesystem on /dev/ps3vram using mkswap /dev/ps3vram. You can manage you different swaps and give priority to the vram using swapon.

When using the PS3 using the Game OS, it will destroy the swap filesystem on dev/ps3vram. You may add this file to ask udev to re-create the swap filesystem at each boot:

Cross-compiling
As the PS3 cpu isn't very fast for compiling, you should use distcc to cross-compile on another machine. Note that you need the same GCC version on all the machines used to cross-compile. More information about distcc and cross-compilation is found here : http://www.gentoo.org/doc/en/distcc.xml

PPU and SPU toolchain and utilities
You already have the PPU toolchain, as this is what you built your system with. Using crossdev to get the ppu toolchain is deprecated.

In order to get a working toolchain for the SPUs, you may use crossdev. The result will be the same (but the Gentoo-way) of getting the IBM Cell SDK's SPU toolchain, but have different names for the GCC binaries.

SPU toolchain

You should also want the libraries and utilities for the SPUs: SPU utilities

After installation
Let's assume, the Playstation is running its native OS. To boot another OS, go to Settings/System Settings/Standardsystem and select "other system". The Playstation will reboot, and the installed other OS will boot, here Gentoo.

To switch back to the PS3 native OS, execute under gentoo or at the kboot prompt.

PS3 Overlay
There is an unofficial overlay which provides a video driver for the PS3 using the SPUs. The article Overlay article explains how to add it.

The system does not boot
If your system doesn't boot and you see : "Warning: unable to open an initial console", boot the LiveCD, mount your partition, chroot, go in /dev (do not mount liveCD's /dev) and create the console node with: Creating the console node