How to Enable Your Distro

Copyright © 2006 Sony Computer Entertainment Inc.
Copyright © 2006 Sony Corp.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version 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.

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 5 as an example.

Install Fedora Core 5

1. Abstract

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

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

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 CompackFlash
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) After following message is displayed. you select 'Yes'.

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

Yes No

5) 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'.

6) After selecting the item, format process is started.
7) 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) Connect a USB memory or memory card to the USB connector of your PC.
2) Open the USB memory or memory card(E drive).
3) Create PS3 folder in E drive and open PS3 folder.
4) Create otheros folder in PS3 folder.
5) Copy following files to otheros folder.
6) Extract USB memory or memory card from your PC and insert it to the USB connector of the PS3
7) Turn on the PS3. After initializing, you select "Settings -> System Settings" by using GameOS menu.
8) After selecting "Install Other OS" from sub menu, the system search Other OS installer from flash memory device. After the system found. Other OS installer, following messages are displayed.

The following installer items were found:

Title /PS3/otheros/otheros.self
Location USB Device

OK

Note: Path name of Other OS installer and Location information may vary according to your environment.

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

No applicable installer was found.

If you see above message, please confirm the data on your flash memory device.

After the system found Other OS installer and you select 'OK', following messages are displayed.

Press the X button to start the installer.
The screen will temporarily go blank. Please wait until the installer starts.

Press the X button to start the installer.

9) After initializing Other OS installer, you start installing kboot.
10) After finishing Other OS install, you can see the GameOS 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

Select 'Other OS'.

3.5 Turn off the PS3.

1) Push the "PS"  button in 2 seconds. on your Controller. Following messages are displayed.

Turn off the controller.
Turn off the system.

Select 'Turn off the system'.

3.6 Restart

1) Push the power button on the PS3.
2) You have already set the default system to 'Other OS'. So you can see the kboot message.

3.7 How to install Fedora Core 5 on your PS3

1) Insert Fedora Core 5 install DVD to the PS3.
2) After displaying kboot prompt, you start a installer program.

You can select only DVD install.
There is one Hard Disk Drive in the PS3.
After initializing boot loader, one HDD is recognized as follows.

You select 'sda' HDD for install.

DVD install

kboot: install-fc sda

After executing installer, you can see following message.

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

After you finish preparing, type 'y'.

1) Fedora Core minimum install
2) Fedore Core full install"
Select install system?

You select one of them.

Next you can see following message. If you can save the data on HDD, you have to backup them to another device.

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

To start Fedora Core 5 install, type 'y'.

HDD is initialized as follows.

Partition id  SizeTypeLabel
1Max size - 512MB  Linux  /
2512 MBswapSWAP

After Fedora Core 5 install, Fedora Core 5 install DVD is automatically ejected. Next you can see following messages.

Please insert a Addon Packages CD.
Is it OK? (y/n)

You insert a Addon Packages CD, type 'y'. Then additional packages are installed.

After Addon Packages install, Addon Packages CD is automatically ejected. And you can see following messages.

Install done.
Type reboot to start Linux or type halt to power off

3) To start Linux, type 'reboot'.

4) You can see Linux messages.

Fedora Core release 5 (Bordeaux)
Kernel 2.6.16 on an ppc64

localhost login:

4. Linux for PLAYSTATION(R) Primer.

4.1 Log in

After initializing Linux, you log in as root.

localhost login: root
Password:
Last login: Fri Aug 18 10:09:49 on tty1
[root@localhost ~] #

After you log in, you can execute Linux command.

4.2 Log out

When you want to log out the Linux, you execute 'logout' command.

[root@localhost ~] # logout

4.3 Mount BD/DVD/CD

First, you have to make a directory for mount.

[root@localhost ~] # mkdir /mnt/cdrom

After inserting a media to the drive, you execute following command.

[root@localhost ~] # mount /dev/cdrom /mnt/cdrom
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost ~] # ls /mnt/cdrom
boot doc etc target

If you mount a Fedora Core 5 install DVD, you can use a yum command.

[root@localhost ~] # yum install hogehoge.ppc.rpm

When you want to eject the media, you execute 'eject' command.

[root@localhost ~] # eject

4.4 Change Game OS/Linux mode

When you want to change from Linux mode to Game OS mode, you execute 'boot-game-os' command.

[root@localhost ~] # boot-game-os

When you want to change from Game OS mode to Linux mode, please refer 3.3.

How to use Kboot

This section describes the usage of kboot.

1. Abstract

Kboot is a Linux boot loader based on kexec. You can load and exec another Linux kernel on the Linux kernel.

2. Function

Kboot supports the following functions:

3. Executing Linux by kboot

You can boot Linux by kboot, which does the following:

(1) Hardware initialization

Reads in some device driver modules and performs initialization. During the initialization process it waits for a response from each device for 15 seconds. A device that does not respond within this period is ignored.

(2) Device file creation with udev

The udev mechanism creates device files.

(3) Network initialization

First, kboot sends DHCP request to the network. If a DHCP timeout occurs, network is set as follows:

ipv4_addr="192.168.0.10"
ipv4_netmask="255.255.255.0"
ipv4_default=""
ipv4_nameserver=""
dns_domain=""

If the filename parameter is specified from the DHCP server, kboot initializes NFS boot as follows:

E.g. dhcpd.conf

host ps3-1 {

hardware ethernet 00:13:A9:XX:YY:ZZ;
fixed-address 192.168.0.20;
option root-path "192.168.0.30:/tftpboot/linux";
next-server 192.168.0.30;
filename "/linux/boot/vmlinux-nfs";

}

NFS boot configuration is written in /etc/kboot.conf.

default=nfsboot
timeout=10
root=/dev/nfs

nfsboot='tftp://$next-server$filename ip=on nfsroot=$nfshost:$path root=/dev/nfs '

(4) Mounting File system

The kboot bootloader searches for file systems to be mounted on '/' in the following order:

  1. If a medium formatted with UDF or iso9660 that contains a /etc/kboot.conf file resides in the BD drive, kboot mounts the  medium on '/'
  2. If a medium formatted with vfat, ext2, or ext3 is inserted in the built-in memory slot and the medium is labeled BOOTMC, kboot mounts the medium on '/'.
  3. If a file system on the built-in HDD is labeled '/', kboot mounts the medium on "/".

Supported file systems are as follows: 
    vfat, ext3, ext2, udf, iso9660

After mounting the file system, etc/kboot.conf, etc/fstab, etc/hosts on the mounted file systems are copied to the /etc/kboot.conf, /etc/fstab, and /etc/hosts on the kboot RAM disk.

(5) Initialization of /etc/kboot.conf on the kboot RAM disk for new boot setting

(6) Initialization of keymap

(7) kboot prompt is displayed. After timeout, the default command is executed.

See the next section, "How to Use kboot", for details.

kboot:

4. How to use kboot

After starting, kboot displays its prompt on the system console. If a timeout is set, a key producing input (e.g., [Space], a letter, [Del], etc., but not [Shift], [Alt], and such) must be pressed in time to keep kboot from automatically proceeding with the default.

A kernel is booted by specifying its name, followed by any arguments that should be passed on the boot command line.

The kernel name can have the following forms:

label
A pre-defined expansion, see above. Label names are case-sensitive.
Example: b26161 root=/dev/hda3
/path/to/kernel
An absolute path to the kernel, stored in the booted system.
kboot automatically mounts the file systems needed to access the kernel image, according to the fstab file provided when building the initramfs.
Example: /home/k/linux-2.6.16.1/arch/i386/boot/bzImage
//path/to/kernel
An absolute path to a kernel stored on kboot's temporary file system. If this path leads out to the booted file system, the usual automatic mounting is done.
Example:
cd //tmp
wget http://some.host.net/vmlinux.gz
gzip -d vmlinux.gz
//tmp/vmlinux
relative/path/to/kernel
As above, but the path is relative to the current directory, which can be on the booted file system, or on kboot's temporary file system.
Example:
cd /home/k/linux-2.6.16
vmlinux root=/dev/sda1
device:/path/on/device
device:path/on/device
A file on an explicitly named device. The device can be specified with the path to a device file, or simply with the name of the file in /dev.
Example: sda6:kernels/vmlinux
host:/path
A file on an NFS server. The address can be specified in the numeric format, or as a name.
Example: server.my.org:/kernels/vmlinux
http://host/path/to/file
http://host:port/path/to/file
A file on an HTTP server.
Example: cat http://www.kernel.org/kdist/finger_banner
ftp://host/path/to/file
ftp://host:port/path/to/file
A file on an FTP server.
Example: ftp://server.my.org/pub/linux/kernel/v2.6/vmlinux-2.6.16
tftp://host/path/to/file
tftp://host:port/path/to/file
A file on a TFTP server.
Example: tftp://bootserver.my.net/kernel-0a000001

kboot recognizes the following "internal" commands:

cd directory
Change to the specified directory. Automatic mounting and the distinction of / and // are applied like for kernel images. Also the device:... and host:... forms can be used with "cd".
pwd
Print the current directory.

Any other command is handed to the shell for execution. In particular, a shell with command-line editing and file name completion can be be obtained by simply typing "sh".

5. kboot.conf

When the kboot starts, it looks for a file kboot.conf, which contains variable assignments. The syntax is the same as in shell scripts. (In fact, kboot.conf is a shell script.) The following variables have a special meaning:

default=<command>
Command to execute on timeout or if the user enters an empty line.
initrd=<path_to_file>
Initial RAM disk that is loaded by default. This can also be set per kernel by passing the initrd=<path_to_file> boot parameter.
root=<device>
Root device the kernel selects by default. This can also be set per kernel by passing the root=<device> boot parameter. If using the form /dev/<name>, this variable can also serve as a fall back if /etc/fstab does not contain a valid entry for the root file system.
timeout=<seconds>
Time out after that many seconds without user input. Also editing the command line (without pressing [Enter]) counts as input. "timeout" does not work (and yields a warning) if "default" is not also set.

Any other variables define a command line, which is expanded when the variable name (which we then call a "label") is entered as a command at the kboot prompt.

Example:

b26131="/boot/vmlinux root=/dev/sda7"

With this defined, "b26131 init=/bin/sh" will be expanded as follows:

/boot/vmlinux root=/dev/sda7 init=/bin/sh

You can specify a following special boot parameter on the PS3.

video=ps3fb:mode:<video mode ID>
Drawing resolution can be set explicitly, if needed. If there is no video syntax, auto mode is used.

<video mode ID>
0: auto mode , default value
YUV 60Hz 1:480i 2:480p 3:720p 4:1080i 5:1080p
YUV 50Hz 6:576i 7:576p 8:720p 9:1080i 10:1080p
RGB 60Hz 33:480i 34:480p 35:720p 36:1080i 37:1080p
RGB 50Hz 38:576i 39:576p 40:720p 41:1080i 42:1080p
VESA 11:WXGA 12:SXGA 13:WUXGA

full screen mode: <video mode ID> + 128
dither ON mode : <video mode ID> + 2048

kboot.conf sample is as follows.

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

linux="/boot/vmlinux-2.6.16 initrd=/boot/initrd.img video=ps3fb:mode:3"

6. 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 "sda1":

ext2, ext3)

# mke2fs -j -L / /dev/sda1

xfs)

# mkfs.xfs -L / /dev/sda1

reiserfs)

# mkreiserfs -l / /dev/sda1

FAT)

# mkfs.vfat -n / /dev/sda1

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

swap)

# mkswap -L SWAP /dev/sda2

1-2. Changing Label on Existing File System

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

ext2, ext3)

# e2label /dev/sda1 /

xfs)

# xfs_admin -L / /dev/sda1

reiserfs)

# reiserfstune -l / /dev/sda1

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

ext2, ext3)

# e2label /dev/sda1

xfs)

# xfs_admin -l /dev/sda1

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

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

# mke2fs -j -L / /dev/sda1

(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/sda1      /        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/sdb2      swap     swap    defaults        0 0

With labels used

LABEL=/        /        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     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.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.16-20061108.ppc64.rpm

- Root partition: ext3 file system

- Contents of /etc/modprobe.conf:

alias scsi_hostadapter ps3pf_storage
alias usb-controller ehci-hcd
alias usb-controller1 ohci-hcd

.

- Command executed to generate the image

# /sbin/mkinitrd --preload=ps3pf_storage --with-usb --with=ehci-hcd --with=ehci-hcd --with=ohci-hcd --with=usb-storage --with=usbhid initrd.img 2.6.16

6. Additional information on “install-fc”

 This section shows an internal structure of install-fc scripts.

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.

hwclock -w -u
FLASHDEV=`find-other-os-flash`
CLOCKDIFF=`other-os-flash-util -d ${FLASHDEV}` # get the difference of clock time between game os and linux
date -s ${CLOCKDIFF}Sec
hwclock -w -u

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 and '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=/        /        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     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 5 RPM on the Hard Disk.

15) Remove old RPM on the Hard Disk.

16) Eject Fedora Core install DVD.

17) Mount Additional 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=/

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

/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/rpm/platform

ppc64-redhat-linux

/etc/rpm/macros

%_transaction_color 3

/etc/modprobe.conf

alias scsi_hostadapter ps3pf_storage
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 fram buffer

/etc/init.d/kudzu

You should use xorg.conf file for virtual fram buffer

20) Unmount all partitions

21) Eject Additional CD.

22) Remove work files.

---