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:
#!/bin/sh PATH2RPMS=/mnt/cdrom/SCEI/RPMS xtarget_arch=mipsEEel-linux cd /usr/${xtarget_arch}/${xtarget_arch} for r in ${PATH2RPMS}/*.rpm; do rpm2cpio $r | cpio -ivd done 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/libc.so perl -i.bak -pe "s/\/lib\/libc.so.6/\/usr\/${xtarget_arch}\/${xtarget_arch}\/lib\/libc.so.6/g" usr/lib/libc.so rm -f usr/bin/{glib,gtk,libIDL,orbit}-config.bak usr/lib/libc.so.bakNOTE: 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!)
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 http://www.mozilla.org/build/unix.html for build instructions. # CROSS_COMPILE=1 GLIB_CONFIG=/usr/mipsEEel-linux/mipsEEel-linux/usr/bin/glib-config GTK_CONFIG=/usr/mipsEEel-linux/mipsEEel-linux/usr/bin/gtk-config LIBIDL_CONFIG=/usr/mipsEEel-linux/mipsEEel-linux/usr/bin/libIDL-config HOST_LIBIDL_CONFIG=/usr/bin/libIDL-config 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 10.0.0.1 for the PlayStation 2 and 10.0.0.2 for the Red Hat box.
Sharing the disc from your PlayStation 2:
/mnt/cdrom (ro,insecure)
Connecting your RedHat box to the PlayStation 2:
Now, you should be able to follow the steps above, substituting /mnt/ps2 for /mnt/cdrom.
Example
rpm2cpio /mnt/cdrom/SRPMS/binutils-2.9EE-3a.src.rpm | cpio -ivd
becomes
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:
Stop NFS on the PlayStation 2: