How to Enable Your Distro

© 2008 Sony Computer Entertainment Inc.
© 2006,2007,2008 Sony Corporation

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

DISCLAIMER

THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.

TRADEMARK NOTICE

          "PLAYSTATION" and "PS3" are registered trademarks of Sony Computer Entertainment Inc. "Cell Broadband Engine" is a trademark of
          Sony Computer Entertainment Inc. Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.
          Other company, product and service names may be registered trademarks, trademarks or service marks of others.

As a hint of enabling your own distribution, we’ll show how to install existing free Linux distribution for PPC64. We’ll explain this using with Fedora Core 6 as an example. 

Install Fedora Core 6

1. Abstract

This section shows how to install Fedora Core 6 on a PS3.

To install Fedora Core 6 on a PS3, you have to execute following steps.

For the person who have installed FC5 according to Distro Kit v1.1, install procedure described in this material will over writes and erase entire HDD with FC6.

2. Requirements

Hardware

Software

3. Setup procedure.

3.1 Setup your PS3.

1) Connecting power cables.
2) Connecting monitor
3) Making other interface connections.

3.2 How to create a Linux partition.

1) Turn on the PS3. After initializing, you can see GameOS menu.  You select "Settings -> System Settings".
2) After selecting "Format Utility" from sub menu, following messages are displayed.

Format Memory Stick
Format SD Memory Card
Format CompactFlash
Format Hard Disk

To allocate a Linux partition on the Hard Disk, select "Format Hard Disk".

3) After following message is displayed. you select 'Yes'.

Do you want to format the hard disk?

Yes No

4) You can see following message.

Select a partition setting for the hard disk.

Use All for the PS3 System
Custom

To allocate a Linux partition on the Hard Disk, select "Custom".
After selecting "Custom", following messages are displayed.

Select a partition setting for the hard disk.

Use All for the PS3 System
Allot 10GB to the Other OS
Allot 10GB to the PS3 System

To allocate a Linux partition on the Hard Disk, select one of following items.

Allot 10GB to the Other OS
Allot 10GB to the PS3 System

If your hard disk size is 20GB, you have to select 'Allot 10GB to the Other OS'.

5) After selecting the item, following messages are displayed.

Select the hard disk format method.

Quick Format
Full Format

You can select either  'Full Format' or 'Quick Format'.
6) After following message is displayed. you select 'Yes'.

If you format, all data will be deleted.
This data cannot be restored.
Are you sure you want to continue?

Yes No

7) After selecting 'Yes', format process is started.
8) After creating a Linux partition, following messages are displayed.

Format Complete.
Press the X button to restart the system.

After pressing the X button, restart the system software and you can see GameOS menu.

3.3 How to install kboot.

1)  Insert Addon Packages CD to the BD drive of the PS3
2) Turn on the PS3. After initializing, you select "Settings -> System Settings" by using GameOS menu.
3) After selecting "Install Other OS" from sub menu, the system search Other OS installer from flash memory device. After the system found. Other OS image, following messages are displayed.

The following installer items were found:

   Title /PS3/otheros/otheros.bld
Location Disc

Start

If the system cannot find Other OS image, following message is displayed.

No applicable installer was found.

If you see above message, please confirm the data on your CD.

After the system found Other OS image and you select 'Start', install process is started.

4) After finishing Other OS install, you can see the following messages.

Install completed.
To start another system, go to [Settings] > [System Settings] >
[Default System] and set to [Other OS]. Then restart the system.

After pressing the O button,  you can see the XMB menu

3.4 Change the default system to boot

To start kboot, you have to change the default system to boot.

1) Turn on the PS3. After initializing, you select "Settings -> System Settings" by using GameOS menu.
2) After selecting "Default System" from sub menu, following messages are displayed.

PS3
Other OS

3) After selecting "Other OS" , following messages are displayed.

Do you want to quit the PS3 system and start the other system
now?
                Yes        No

After selecting 'Yes',  kboot is automatically started.

3.5 How to install Fedora Core 6 on your PS3

1) After displaying kboot prompt, you start a installer program.

kboot: install

2) After initializing a installer program, you can see the following messages.

Starting PS3 Linux installer
1) ps3da
Select device to install?

There is one built-in hard disk drive in the PS3.
After initializing boot loader, this drive is recognized as 'ps3da'.

If you connected external USB hard disk drives with the PS3, these drives
are recognized as scsi devices. And you can see see the following messages.

Starting PS3 Linux installer
1) ps3da
2) sda
Select device to install?

You can select one of the hard disk drive for install. In this document, we assume that
Linux is installed on the built-in hard disk drive(= ps3da). 

3) After selecting the device, PS3 Linux Distributor's Starter Kit CD is automatically ejected
and you can see the following messages.

Please insert Fedora Core install DVD.
Is it OK? (y/n):

4) After you insert a Fedora Core 6 install DVD, type 'y'. Then you can see the following messages.

1) Fedora Core 6 minimum install
2) Fedora Core 6 full install
Select install system?

You can select one of them.

5) After selecting the installation type, you can see the following messages. If you can save
the data on HDD, you have to backup them to another device.

Caution!! All data in /dev/ps3da are removed.
Is it OK? (y/n):

6)  To start Fedora Core 6 install, type 'y'.

HDD is initialized as follows.

Partition id   Size Type Label
1 Max size - 512MB   Linux   /1
2 512 MB swap SWAP-ps3da2

7) After installing Fedora Core 6, Fedora Core 6 install DVD is automatically ejected.
Next you can see following messages.

Please insert a PS3 Linux Distributor's Starter Kit CD.
Is it OK? (y/n)

8) After you insert a PS3 Linux Distributor's Starter Kit CD, type 'y'. Then additional packages are installed.
9) After installing addon packages, PS3 Linux Distributor's Starter Kit CD is automatically ejected.
And you can see following messages..

Install done.
Please type any key to restart :

10) To start Linux, type any key.
11) You can see Linux messages.

Fedora Core release 6 (Zod)
Kernel 2.6.24 on an ppc64

localhost login:


4. PS3 Linux Distributor's Starter Kit CD file layout

We describes a file layout of the PS3 Linux Distributor's Starter Kit CD.

TOP directory

    PS3
         - otheros/otheros.bld       (kboot binary file)

    boot 
         - vmlinux                            (Linux kernel for the PS3 Linux installl program)
         - initrd.bin                          (PS3 Linux install program)

    etc 
         - kboot.conf                      (kboot configuration file)

    target
         - *.rpm                               (Additional packages for PS3 Linux)

    doc
         - *.html                               (PS3 Linux documents)

    src                                          (PS3 Linux source codes)

After intializing kboot, kboot read a '/etc/kboot.conf' on the PS3 Linux Distributor's
Starter Kit CD. Current kboot.conf file is as follows.

default=install
root=/dev/sr0

install='/boot/vmlinux initrd=/boot/initrd.bin video=safe'

Vmlinux is a Linux kernel image for the PS3 Linux install program.
Initrd.bin is a PS3 Linux install program image.

After selecting 'install' entry, kboot read a vmlinux and initrd.bin and starts the PS3 LInux install
program. After initializing the PS3 Linux install program, /sbin/install-fc in the 'initrd.bin' image is
automatically executed. We describe the 'install-fc' more details in the next section.

5. Additional information of “install-fc”

This section shows an internal structure of install-fc script. This scripts install the Fedora Core 6
files to the hard disk drive connected with a PS3.

1) Check command arguments.

2) Check Hard Disk size. If disk size is smaller then 9GB, you can not install linux.

3) Calculate disk partition size.

4) Disable screen saver.

5) Synchronize a linux clock with a game clock.

GAMETIME=`/sbin/ps3-flash-util -s | grep 'p\.rtc_diff' | grep -o '[0-9]*$'
/sbin/ps3-flash-util -F
/sbin/ps3-flash-util -D 2 1 ${GAMETIME}
hwclock -s

6) Mount Fedora Core install DVD and copy stage2.img file to ramdisk.

7) Mount stage2.img file and create install environment.

8) Select either 'minimum' install or 'full' install.

9) Delete All partitions on the Hard Disk.

10) Create Linux and swap partition on the Hard Disk.

11) Mount Linux and swap partition.

12) Create some configuration files.

/etc/fstab

LABEL=/1        /        ext3    defaults 1 1
/dev/devpts    /dev/pts devpts  gid=5,mode=620 0 0
/dev/shm       /dev/shm tmpfs   defaults 0 0
none           /spu     spufs   defaults 0 0
/dev/proc      /proc    proc    defaults 0 0
/dev/sys       /sys     sysfs   defaults 0 0
LABEL=SWAP-ps3da2     swap     swap    defaults 0 0

/etc/sysconfig/keyboard

KEYTABLE="us"

/etc/sysconfig/i18n

LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"

/etc/udev/makedev.d/45-ps3pf.nodes

hvc0

/etc/sysconfig/network

NETWORKING=yes
HOSTNAME=localhost.localdomain

/etc/resolv.conf

/etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost

/etc/sysconfig/authconfig

USEWINBINDAUTH=no
USEHESIOD=no
USESYSNETAUTH=no
USEKERBEROS=no
USESHADOW=yes
USESMBAUTH=no
USELDAPAUTH=no
USELOCAUTHORIZE=no
USEWINBIND=no
USEDB=no
USEPASSWDQC=no
USEMD5=yes
USELDAP=no
USECRACKLIB=yes
USENIS=no

13) Initialize RPM database.

14) Install Fedora Core 6 RPM on the Hard Disk.

15) Remove old RPM on the Hard Disk.

16) Eject Fedora Core install DVD.

17) Mount PS3 Linux Distributor's Starter Kit CD.

18) Install some PS3 specific RPMs.

19) Create and change some configuration files for PS3.

/etc/kboot.conf

default=linux
timeout=10
root=LABEL=/1

safe='/boot/vmlinux-$KERNELVER initrd=/boot/initrd.img-$KERNELVER video=safe'
linux='/boot/vmlinux-$KERNELVER initrd=/boot/initrd.img-$KERNELVER '

/etc/sysconfig/clock

ZONE="Asia/Tokyo"
UTC=true
ARC=false

/etc/localtime

cp /usr/share/zoneinfo/Japan /etc/localtime

/etc/sysconfig/modules/ps3pf.modules

#!/bin/sh
for i in snd_ps3pf;do
modprobe \$i >/dev/null 2>&1
done

/etc/alsa/cards/PS3.conf

PS3 sound configuration

/etc/rpm/platform

ppc64-redhat-linux

/etc/rpm/macros

%_transaction_color 3

/etc/modprobe.conf

alias scsi_hostadapter ps3disk
alias scsi_hostadapter1 ps3rom
alias scsi_hostadapter2 ps3flash
alias usb-controller ehci-hcd
alias usb-controller1 ohci-hcd

/etc/X11/xorg.conf
/etc/X11/xorg.conf-vfb

You should use xorg.conf file for virtual frame buffer

/etc/init.d/kudzu

disable X configuration 

20) Unmount all partitions

21) Eject PS3 Linux Distributor's Starter Kit CD.

22) Remove work files.

5. kboot-Related Information

(1) File systems and labels

To address the problem that the device name of an USB storage device cannot uniquely identify the device, kboot and Linux commands identify file systems by their labels instead of their device names. The labeling convention is as follows:

There are some ways to label a file system.

1-1. Setting Label at Creation of File System

To put a "/" label on a partition to be named "ps3da1":

ext2, ext3)

# mke2fs -j -L / /dev/ps3da1

xfs)

# mkfs.xfs -L / /dev/ps3da1

reiserfs)

# mkreiserfs -l / /dev/ps3da1

FAT)

# mkfs.vfat -n / /dev/ps3da1

(Note) The number of characters for a label specified with mkfs.vfat must be 11 or less.

swap)

# mkswap -L SWAP /dev/ps3da2

1-2. Changing Label on Existing File System

To put a "/" label on an existing partition named "ps3da1":

ext2, ext3)

# e2label /dev/ps3da1 /

xfs)

# xfs_admin -L / /dev/ps3da1

reiserfs)

# reiserfstune -l / /dev/ps3da1

Some of the commands may also be used to display the current file system label.

ext2, ext3)

# e2label /dev/ps3da1

xfs)

# xfs_admin -l /dev/ps3da1

The following labelling procedure assumes that the built-in HDD is seen as /dev/ps3da1.

First, initialize /dev/sda1 with ext3 adding a "/" label.

# mke2fs -j -L / /dev/ps3da1

(2) Settings for Using Labels

/etc/fstab

At startup of Linux, file systems are mounted according to /etc/fstab.

To address the problem that the device name of an USB storage device cannot uniquely identify the device, a storage device must be identified with its label instead of the device name in the /etc/fstab file.

Usual

/dev/ps3da1    /        ext3    defaults         1 1
/dev/devpts    /dev/pts  devpts gid=5,mode=620   0 0
/dev/shm       /dev/shm tmpfs   defaults         0 0
none           /spu     spufs   defaults         0 0
/dev/proc      /proc     proc   defaults         0 0
/dev/sys       /sys     sysfs   defaults         0 0
/dev/ps3da2    swap     swap    defaults         0 0

With labels used

LABEL=/1       /        ext3    defaults         1 1
/dev/devpts    /dev/pts devpts  gid=5,mode=620   0 0
/dev/shm       /dev/shm tmpfs   defaults         0 0
none           /spu     spufs   defaults         0 0
/dev/proc      /proc    proc    defaults         0 0
/dev/sys       /sys     sysfs   defaults         0 0
LABEL=SWAP-ps3da2     swap     swap    defaults         0 0

/etc/blkid.tab

This file acts as cache for mapping between labels/UUIDs and device names. This file should be removed when a device name is changed to avoid the use of the old cache file for the mapping.

# rm /etc/blkid/blkid.tab

(3) Kernel and initrd

The kernel and intrd should be placed in /boot with the file names specified in kboot.conf. The initrd must contain modules necessary to mount the root partition. See man mkintrd for details. This release includes a bootloader/initrd.img file, which is created in the environment described below.

Generation Environment

- Kernel: the one included in kernel-2.6.24-20080131.ppc64.rpm

- Root partition: ext3 file system

- Contents of /etc/modprobe.conf:

alias scsi_hostadapter ps3disk
alias scsi_hostadapter1 ps3rom
alias scsi_hostadapter2 ps3flash
alias usb-controller ehci-hcd
alias usb-controller1 ohci-hcd

- Command executed to generate the image

# /sbin/mkinitrd --preload=ps3disk --preload=ps3rom --preload=ps3flash --with-usb initrd.img-2.6.24 2.6.24

7. How to build kboot

 This section shows how to build a kboot binary from source code.

Revision History

1.7Mar 25 2008Correct kboot build command
1.6Feb 1 2008Update PS3 System software version for PS3 Linux
1.5Oct 26 2007Update PS3 System software version for PS3 Linux
1.4Aug 17 2007Change built-in HDD device name. Update kboot kernel version
1.3Apr 25 2007Support PS3 System Software 1.60. Update to Fedora Core 6
1.1Dec 8 2006Added "Revision History" and  "About This Document"
1.0Nov 11 2006Initial Revision