Sponsored Links
Note: This installation is not really appropriate for Linux newbies, try YDL first.

Installing Gentoo on a PS3?

Given the hardware inside the PS3, the preferred method for installing Gentoo on a PS3 is to start with a stage4 tarball. The stage4 tarball will contain more precompiled binary packages and therefore can be setup faster.

The rest of this document describes the setup procedure. It assumes a certain level of experience with both Gentoo and Linux. If you have questions, ask and clarification can be made.

Obtain the Install media? To complete the install, you can either:

Install CD? While you can install Gentoo from the kboot prompt, it is far more convenient to do so using a minimal Install CD. The install CD is available from the Gentoo mirrors under the experimental directory as an ISO image. For example: [Register or Login to view links]

Stage 4 tarball? On a PS3, you can either run a 32bit-userland or a 64bit-userland. Both run 64bit kernels. The choice of which userland to use depends on what you intend to use the PS3 for. Many people find the 32bit-userland more desktop-friendly. You can find the tarball on the Gentoo mirrors under the experimental directory. To find a mirror near you, use this URL: [Register or Login to view links].

You can download the stage4 now and store it somewhere locally or download it later during the install. The tarball contains a normal stage3 install plus several required applications which are already compiled for you, like X, vim, eject, the kernel, and even the fluxbox window manager. It also contains a kboot.conf example and a working xorg.conf file.

Optional? The following items are optional and not required. The author finds having these make the setup faster:

You may find it more convienent or perhaps faster to use a portage snapshot. Snapshots of portage can be found on your favorite Gentoo mirror under the snapshots directory. Put the stage4 and a portage snapshot on a USB memory stick in a vfat or ext3 filesystem.

Prepare your PS3 to boot another OS? Before you can install Linux on your PS3, you must prepare it to run another operating system (hereafter referred to as otheros). This is done through the PS3 operating system (hereafter referred to as game-os) and requires that you also download the Sony Installer (otheros.self) and an otheros image (otheros.bld), which is also available from Sony or Gentoo PS3-capable Install media. To complete this task, follow the instructions here: [Register or Login to view links]

Boot the Install CD? The Install CD contains a PS3 kernel and the required applications to complete a Gentoo install.

Insert the Install CD into the PS3 and power-on the PS3. The PS3 will load the kboot kernel and you will soon see a "kboot:" prompt (hereafter referred to as the kboot prompt). If you have not installed Linux on the hard disk before, you should be able to hit "tab" to scroll through the list of kernel labels until you find a label that has a resolution that most closely matches your TV or monitor.

Note: If you have installed Linux on your hard-drive before, the prior kboot.conf configuration file may interfere with the kboot configuration file on the Install CD. You can avert this by renaming or deleting the configuration file on the hard-drive, copying the kboot.conf from the Install CD to the kboot ramdisk, or by using e2label to rename the disk partition (i.e. e2label /dev/sda1 "") that contains it.

Hit 'Enter' to boot the kernel. The LiveCD will boot and automatically configure itself for the PS3 including network settings if you have a DHCP server on your network.

The rest of this procedure is very similar to a regular Gentoo install. The steps are grouped logically and little explanation will be given about them, unless it's a PS3 specific task

Prepare the hard disk for installation? You must partition your hard drive for an install. You should make at least two disk partitions: one for the root filesystem and one for swap. At the time of this writing, the PS3 can only dedicate 10GB to another os. An example of partitioning looks like:
livecd ~ # fdisk /dev/sda
The number of cylinders for this disk is set to 10239.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n
Command action
e  extended
p  primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-10239, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-10239, default 10239): +9000M

Command (m for help): n
Command action
e  extended
p  primary partition (1-4)
Partition number (1-4): 2
First cylinder (8585-10239, default 8585): 
Using default value 8585
Last cylinder or +size or +sizeM or +sizeK (8585-10239, default 10239): 
Using default value 10239

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap / Solaris)

Command (m for help): p

Disk /dev/sda: 10.7 GB, 10737414144 bytes
64 heads, 32 sectors/track, 10239 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot   Start     End   Blocks  Id System
/dev/sda1        1    8584   8790000  83 Linux
/dev/sda2      8585    10239   1694720  82 Linux swap / Solaris

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
livecd ~ #
Now you should format the root filesystem and swap, and then enable swap.
livecd ~ # mkfs.ext3 -j /dev/sda1 
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1098880 inodes, 2197500 blocks
109875 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2252341248
68 block groups
32768 blocks per group, 32768 fragments per group
16160 inodes per group
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done              
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 25 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
livecd ~ # mkswap /dev/sda2 
Setting up swapspace version 1, size = 1735389 kB
no label, UUID=56270620-3485-4396-b65b-269517a5451c
livecd ~ # swapon /dev/sda2 
livecd ~ #
Lastly, mount the root filesystem so you can begin installing the software.
livecd ~ # mount /dev/sda1 /mnt/gentoo/
Install the base system? The next series of steps will install the stage4 software on to your PS3 hard drive.
livecd ~ # cd /mnt/gentoo/
livecd gentoo # links2 
From here, select the stage4 of your choice and download it. It should then be in /mnt/gentoo. Now extract the tarball.
livecd gentoo # tar -xjpf stage4-ppc64-ps3_32ul.tar.bz2
You now need to mount procfs and /dev for our chroot. Also, copy resolv.conf into the chroot so name resolution will work.
livecd ~ # mount -t proc none /mnt/gentoo/proc
livecd ~ # mount -o bind /dev /mnt/gentoo/dev
livecd ~ # cp /etc/resolv.conf /mnt/gentoo/etc
You can now begin the chroot portion of the install.
livecd gentoo # chroot /mnt/gentoo/ /bin/bash
livecd / # export PS1="(chroot) $PS1"
chroot) / # env-update && source /etc/profile
--- 'profiles/arch.list' is empty or not available. Empty portage tree?
>>> Regenerating /etc/ld.so.cache...
At this point, you need to add the portage tree onto your hard drive. This can be done with a portage snapshot or over the network. The author chooses to get portage over the network with:
(chroot) / # emerge --sync
Alternatively, you can use a snapshot of portage. This can be an advantage when dealing with GRP packages later. First obtain the snapshot from a mirror:
wget http://ftp.osuosl.org/pub/gentoo-ps3/snapshots/portage-DATE.tar.bz2
Then unpack the snapshot and update the cache:
tar -xjf portage-DATE.tar.bz2 -C /usr
emerge --metadata
Final configuration of your system? The following steps are the minimum number of changes you need to make to have a bootable, working Gentoo install on your PS3.

Set the timezone? You first need to select your timezone so that your system knows where it is located. Look for your timezone in /usr/share/zoneinfo, then copy it to /etc/localtime. Please avoid the /usr/share/zoneinfo/Etc/GMT* timezones as their names do not indicate the expected zones. For instance, GMT-8 is in fact GMT+8.
(chroot) ls /usr/share/zoneinfo
(Suppose you want to use GMT)
(chroot) cp /usr/share/zoneinfo/GMT /etc/localtime
Configure the kboot bootloader? In many cases, the otheros images depend on a label being set on the root filesystem partition. Usually it is set to "/". You can set the label using e2label. Using the disk partitioning scheme, you would set the label like:
(chroot) e2label /dev/sda1 /
Kboot's configuration comes from the file /etc/kboot.conf. An example kboot configuration has been provided in /etc/ of the stage4 tarball. Use it as a starting point for your configuration file.
(chroot) / # cd /etc
(chroot) / # cp kboot.conf.example kboot.conf
(chroot) / # vim kboot.conf
Note: For systems where 64 bit user space will be installed, make sure to change the kernel and initrd to kernel-genkernel-ppc64-2.6.16-ps3 and initramfs-genkernel-ppc64-2.6.16-ps3. (Notice the added '64')

An example kboot.conf file for the stage4 and 720p resolution could look like:
# The following is an example kboot configuration file. Edit it
# to suit your needs before attempting to reboot your system or
# you may be unable to boot the new install.

# default: the default kernel label to boot should the user not make
# a selection. Uncomment the following line and set a default kernel label.

# timeout: number of seconds to wait for user input before the default
# kernel label is booted. Uncomment the following line and set timeout.
# timeout=20

# The format from this point on is within a kernel label. At a minimum,
# you must pass the kernel and root device. The syntax is as follows:
label='device:<path_to_kernel> initrd=device:<path_to_initrd> kernel_options'
# You should also pass the video options as well. An example of video 
# options are as follows:
# 480i = ps3fb:mode:1
# 576i = ps3fb:mode:6
# 720p = ps3fb:mode:3
# 1080i = ps3fb:mode:4
# 1080p = ps3fb:mode:5
# You can review all possible video modes using the ps3videomode application
# provided by the ps3pfutils package. i.e. ps3videomode -v will display 
# possibilities.

# The following is an example kernel label. Uncomment and edit as needed. 
gentoo='sda1:/boot/kernel-genkernel-ppc-2.6.16-ps3 initrd=sda1:/boot/initramfs-genkernel-ppc-2.6.16-ps3 root=/dev/ram0 real_root=/dev/sda1 init=/linuxrc video=ps3fb:mode:8 rhgb'
Edit /etc/fstab ?
Given the prior disk partitioning scheme, you need to make sure /etc/fstab reflects the proper device naming. Here is an fstab entry with that assumption in mind:
/etc/fstab: static file system information.
# noatime turns off atimes for increased performance (atimes normally aren't 
# needed; notail increases performance of ReiserFS (at the expense of storage 
# efficiency). It's safe to drop the noatime options if you want and to 
# switch between notail / tail freely.
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
# See the manpage fstab(5) for more information.

# <fs>         <mountpoint>  <type>     <opts>     <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sda1        /        ext3      noatime     0 1
/dev/sda2        none      swap      sw       0 0
/dev/sr0        /mnt/cdrom   iso9660     noauto,ro    0 0
#/dev/fd0        /mnt/floppy   auto      noauto     0 0

# NOTE: The next line is critical for boot!
proc          /proc      proc      defaults    0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for 
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
# use almost no memory if not populated with files)
shm           /dev/shm    tmpfs      nodev,nosuid,noexec   0 0
none  /spu  spufs  default  0 0
Set root password? You must set the root password using the 'passwd' utility.

Add a default non-root user? You should now add a default user, in this case John, and set his password.
(chroot) / # useradd -m -G users,wheel,audio -s /bin/bash john
(chroot) / # passwd john
Password: (Enter the password for john)
Re-enter password: (Re-enter the password to verify)
Exit the chroot, unmount filesystems, and reboot? You can now exit the chroot in order to reboot. Be sure to unmount the filesystems prior to rebooting.
(chroot) etc # exit
livecd mnt # cd /mnt/
livecd mnt # umount gentoo/proc/ gentoo/dev/ gentoo/
livecd mnt # umount /mnt/usb/
livecd mnt # reboot
Eject the Install CD when the PS3 power-cycles. You now have a working install on your PS3. Remember this already has X, a working xorg.conf, and fluxbox on it so you can begin using it immediately.

Installing GRP packages?

Note: Due to a number of bugs in the current stable version of portage, you must use at least portage-2.1.2-rc4-8 to install GRP over the network. If you do not have this version of portage, you should add 'sys-apps/portage ~ppc' or 'sys-apps/portage ~ppc64' to your /etc/portage/package.keywords file and then 'emerge -u portage'. In the release of 2.1.2-r1, there will also be at least one fix in the dependency resolution of binary packages.

Our GRP packages are currently hosted on three sites:

[Register or Login to view links]

[Register or Login to view links]

[Register or Login to view links]

Edit /etc/make.conf? To begin using GRP packages, you must tell portage about the repository by adding a reference to it in your /etc/make.conf file. Depending on your location and whether you are 32 or 64-userland, you would add something like this to your make.conf:
Installing packages? To install a GRP file, you simply pass the -g flag to emerge. For example, to install xfce4 you would:
# emerge -G xfce4
With GRP installs, you might differences in the dependency resolution of the -G and -g switches. Consider trying both before performing the20jonstall the see the differences.