PS3 NFS Root File System HOWTO
2011.04.14

Copyright (c)  2007 Sony Computer Entertainment Inc.
Copyright  2007 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.

ABOUT THIS DOCUMENT

This note describes how to setup your PS3 to load the second stage kernel from a
TFTP server and how to setup an NFS mounted root file system.

You can always find the latest version of this document, and some other useful
technical documents here:

  http://www.kernel.org/pub/linux/kernel/people/geoff/cell/

Please send comments to <geoff@infradead.org>.

PS3 NFS ROOT HOWTO

1) Setup DHCP Server

  Setup the DHCP server on your host machine as described in the PS3 Linux
  Distributor's Starter Kit document 'How to Enable Your Distro'.  See the
  man pages for dhcpd and dhcpd.conf, and/or the documentation for the
  distribution installed on your host.  This discussion uses the following as an
  example dhcpd.conf entry:

    host ps3
    {
        hardware ethernet aa:bb:cc:dd:ee:ff;
        fixed-address 192.168.1.50;
        option host-name "ps3";
        next-server 192.168.1.2;
        filename "/ps3/boot/vmlinux";
        option root-path "192.168.1.2:/target/ps3";
    }


2) Install Linux Distro

  Install the distro of your choice onto the PS3 hard disk as normal, checking
  that the system boots correctly into Linux.


3) Setup TFTP Server

  Setup the TFTP server on your host machine.  See the man pages for tftpd and
  xinetd, and/or the documentation for the distribution installed on your host.
  This discussion uses the following as an example xinetd.d/tftp entry:

    service tftp
    {
      ...
      server_args = -v -s /target
      only_from   = 192.168.1.0 localhost
    }

  Note that this example uses the tftpd -s option, which is not specified in
  the default configuration of some distributions.  Also, when seting up the
  tftp server configuration consider the security implications of your
  configuration. To test the TFTP server, copy the second stage kernel image
  from the PS3 hard disk onto the TFTP server.  The proper location on the
  server is dictated by the dhcpd.conf statements next-server and filename, and
  the tftp server directory.  For the above example dhcpd.conf, the location
  would be '192.168.1.2:/target/ps3/boot/vmlinux'.

    [@host]# mkdir -p /target/ps3/boot/
    [@host]# scp 192.168.1.50:/boot/vmlinux-2.6.xx /target/ps3/boot/vmlinux

  This kernel can be test loaded from the petitboot prompt:

    ps3-linux: tftp -g -l test -r /ps3/boot/vmlinux 192.168.1.2

  Note that if the NFS server has not been configured or if the second stage
  kernel has not been built with NFS root file system support the kernel will
  panic with the message 'Unable to mount root fs'.  This is expected behavior
  for this test.

4) Setup NFS Server

  Setup the NFS server on your host machine as described in the PS3 Linux
  Distributor's Starter Kit document 'How to Enable Your Distro'.  See the
  man pages for exports and mount, and/or the documentation for the
  distribution installed on your host.

  Reboot the PS3 and get to the petitboot shell prompt.  Execute commands
  similar to these:

    ps3-linux: killall pb-discover
    ps3-linux: mkdir /local
    ps3-linux: mount /dev/ps3da1 /local
    ps3-linux: mkdir /remote
    ps3-linux: mount -o nolock 192.168.1.2:/target /remote
    ps3-linux: cp -a /local /remote/ps3
    ps3-linux: rm -rf /remote/ps3/lost+found

4a) Fedora, YDL

  Several Fedora fixups are needed to the PS3's remote file system to
  support NFS use.  Edit the file /target/ps3/etc/fstab to use the NFS root
  by changing the line

    LABEL=/    /    ext3    defaults    1 1

  to

    /dev/nfs    /    rootfs    defaults   0 0

  Remove the eth0 config file, since the startup scripts will try to
  re-initialize the interface, which then disconnects the root fs.

    [@host]# rm /target/ps3/etc/sysconfig/network-scripts/ifcfg-eth0

  Make a node for the console device on the NFS file system.

    [@host]# mknod /target/ps3/dev/console c 5 1

4b) Debian, Ubuntu (and other Debian based)

  Several Debian fixups are needed to the PS3's remote file system to support
  NFS use.  Edit the file /target/ps3/etc/fstab to use the NFS root by
  changing the line

    UUID=xxxxxxxxxxx    /    ext3    defaults,errors=remount-ro    0 1

  to

    /dev/nfs    /    rootfs    defaults   0 0

  Set the eth0 entry in the config file /etc/network/interfaces to manual,
  since the startup scripts will try to re-initialize the interface, which
  then disconnects the root file system.

    # The primary network interface
    manual eth0
    iface eth0 inet dhcp

4c) TODO

  Explain changes needed to files on server (fstab, etc.) for other distros.


5) Build Kernel With NFS Root Support

  Build and install a kernel with NFS root file system support on the TFTP
  server at '192.168.1.2:/target/ps3/boot/vmlinux'.  See the file
  Documentation/nfsroot.txt in the kernel sources, and documentation for the
  Linux distribution you installed on your PS3.