Mozilla for PlayStation 2 Cross Compiling Mini-HOWTO 1.0

by Paul A. Pietromonaco

Created: February 16, 2003

Last edited: February 23, 2003

OVERVIEW: There are occasions when you may not want to compile Mozilla on your PlayStation 2 - especially because of the large size of the source tree (14,000+ source files!), or because your PlayStation 2 is not available (i.e. you want to finish your game!) This Mini-HOWTO will show you how to set up a cross compilation environment to allow you to build Mozilla for the PlayStation 2 in a Red Hat 8.0 Intel environment.

BEFORE YOU BEGIN: You will need to have your PlayStation 2 Linux disc 2 available, and a DVD ROM drive on your computer. If you don't have a DVD ROM drive available, you will have to start NFSD on your PlayStation 2 and export disc 2. (Don't worry - I'll explain this when we get there.) This means that you will have to have a network connection between your PlayStation 2 and your Linux box.

INSTRUCTIONS: The first thing to do is decide on the location of the cross compilation environment on your Linux box. I used the directory /usr/mipsEEel-linux for this walkthrough. I strongly urge you to follow this as well - there are some scripts that depend on this structure.

Regardless if you follow my advice or not, it's important to decide the location early - it has to stay consistent during this whole process!

Then, follow these steps:

  1. Log into your Linux box as root. This will make life a lot easier!

  2. Mount Disc 2 of the PlayStation 2 Linux distribution on your DVD-ROM drive with this command: mount -t udf /dev/cdrom /mnt/cdrom

  3. Type the following command: mkdir /usr/mipsEEel-linux. This is the location of your cross compilation directory.

  4. Type the following command: mkdir /usr/mipsEEel-linux/mipsEEel-linux. This directory is the target architecture. (aka the PlayStation 2!)

    NOTE: It has to be called mipsEEel-linux, regardless of where you locate the cross compilation directory created in the previous step.

  5. Now you need to copy over the PlayStation 2 libraries and associated files so that you can cross compile. The easiest way to do this is to create a file called with the following:
    cd /usr/${xtarget_arch}/${xtarget_arch}
    for r in ${PATH2RPMS}/*.rpm; do
            rpm2cpio $r | cpio -ivd
    chmod -R 755 /usr/${xtarget_arch}/${xtarget_arch}
    ln -s usr/include sys-include
    (cd usr/src && ln -sf linux-2.2.1_ps2 linux)
    (cd lib && ln -s ../usr/lib/*.o .)
    # modify various build -config scripts
    perl -i.bak -pe "s/\/usr/\/usr\/${xtarget_arch}\/${xtarget_arch}\/usr/g" usr/bin/{glib,gtk,libIDL,orbit}-config usr/lib/
    perl -i.bak -pe "s/\/lib\/\/usr\/${xtarget_arch}\/${xtarget_arch}\/lib\/" usr/lib/
    rm -f usr/bin/{glib,gtk,libIDL,orbit}-config.bak usr/lib/
    NOTE: This script assumes that you created the /usr/mipsEEel-linux/mipsEEel-linux directory as outlined above. If you've put the directory somewhere else, you'll have to change the script (which is beyond the scope of this mini-HOWTO!)

  6. Make executable by typing: chmod 755 and execute the script: ./

  7. Copy some extra libraries to your target architecture directory:
    cp /usr/mipsEEel-linux/mipsEEel-linux/usr/lib/*.so* /usr/mipsEEel-linux/mipsEEel-linux/lib
    cp /usr/mipsEEel-linux/mipsEEel-linux/usr/lib/*.a* /usr/mipsEEel-linux/mipsEEel-linux/lib

  8. Next, you will need to compile and install binutils. Luckily, the source is already present on your PlayStation 2. Here's an easy way to make it:

  9. Add binutils to your path: export PATH=$PATH:/usr/mipsEEel-linux/bin

  10. Now, you'll need to compile and install gcc. Luckily, the source is already present on your PlayStation 2 as well! Here's an easy way to do it:

At this point, your cross compiler should be working. You can try building Mozilla if you'd like.

Don't forget! You will need to make sure /usr/mipsEEel-linux/bin is in your path before you do any cross compiling!!! (export PATH=$PATH:/usr/mipsEEel-linux/bin)

You will also have to pass some extra compiler directives to cross compile. The easiest way is by using .mozconfig. Here's an example .mozconfig that I've used:

# sh
# Build configuration script
# See for build instructions.

ac_add_options --prefix=/usr/mipsEEel-linux
ac_add_options --target=mipsEEel-linux
ac_add_options --x-includes=/usr/mipsEEel-linux/mipsEEel-linux/usr/X11R6/include
ac_add_options --x-libraries=/usr/mipsEEel-linux/mipsEEel-linux/usr/X11R6/lib

# Options for 'configure' (same as command-line options).
# all are listed so that one can manually tweak this config file.
#ac_add_options --enable-mathml
#ac_add_options --enable-svg
#ac_add_options --enable-extensions
#ac_add_options --enable-crypto
#ac_add_options --enable-logrefcnt

#ac_add_options --without-system-nspr
#ac_add_options --without-system-zlib
#ac_add_options --without-system-jpeg
#ac_add_options --without-system-png
#ac_add_options --without-system-mng

# Paul's options
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --enable-optimize
ac_add_options --without-system-nspr
ac_add_options --without-system-zlib
ac_add_options --without-system-jpeg
ac_add_options --without-system-png
ac_add_options --without-system-mng
#ac_add_options --enable-crypto #comment to disable PSM/SSL support
ac_add_options --disable-freetype2

THANKS: Much of this material was adapted from Chris Seawood's Cross Compiling Mozilla page. Also, Tyler Daniel's ps2stuff page was invaluable in getting this to work. I'm deeply indebted to both of these authors.

APPENDIX: Using NFS on your PlayStation 2 to allow your PC to access Disc 2 of PlayStation 2 Linux

You will need to network the two boxes together. Each box should have a unique IP address. For the purpose of this example, we will use for the PlayStation 2 and for the Red Hat box.

    Sharing the disc from your PlayStation 2:

    1. Log onto your PlayStation 2 as root

    2. Mount Disc 2 of the PlayStation 2 Linux distribution on your DVD-ROM drive with this command: mount -t udf /dev/cdrom /mnt/cdrom

    3. Edit your /etc/exports file, (creating it if necessary) and add the following:
      /mnt/cdrom     (ro,insecure)
    4. Start NFSD by typing: service nfs start

    5. Type the following command: exportfs -a

    6. You're now sharing your DVD-ROM

    Connecting your RedHat box to the PlayStation 2:

    1. Log onto your RedHat box as root

    2. Create a mount point in the /mnt directory: mkdir /mnt/ps2

    3. Mount the PlayStation drive: mount /mnt/ps2
    4. (where is the IP address of your PlayStation 2.)

Now, you should be able to follow the steps above, substituting /mnt/ps2 for /mnt/cdrom.


    rpm2cpio /mnt/cdrom/SRPMS/binutils-2.9EE-3a.src.rpm | cpio -ivd


    rpm2cpio /mnt/ps2/SRPMS/binutils-2.9EE-3a.src.rpm | cpio -ivd

When you're done, you'll need to basically perform the reverse of the steps outlined above:

    Disconnect the share on the PC:

    1. Log into the PC as root

    2. Type: umount /mnt/ps2

    Stop NFS on the PlayStation 2:

    1. Log onto the PlayStation 2 as root

    2. remove the line you added to exports in the step above

    3. Type exportfs -a

    4. Type service nfs stop