Warning: Be careful when typing commands. I use both opt/ps2dev and /opt/ps2dev, the first being the directory in the current directory, and the second being the directory located in the root / directory.
Note: The removal of libiberty.a and ee-c++filt.exe from gcc are because the versions built by binutils-2.14 are newer and they create conflicts when installing the toolchain from the archives.
Compiling GCC:- 1) Open MSYS
2) Type: cd ~/ps2dev
3) Type: export PATH=$PATH:/opt/ps2dev/ee/bin:/opt/ps2dev/iop/bin
4) Type: mkdir ee-gcc ee-gcc-bin iop-gcc-bin iop-gcc
5) Extract the gcc-3.2.2 tarball using tar
6) Type: patch -p0 < ps2dev-patches/gcc-3.2.2-PS2.patch
7) For each target, ee and iop:- a) Type: cd <target>-gcc
b) Type: CFLAGS="-std=c99 -D__USE_MINGW_ACCESS" ../gcc-3.2.2/configure --prefix=/opt/ps2dev/<target> --target=<target> --enable-languages="c" --with-newlib --without-headers
c) Type: CFLAGS="-std=c99 -D__USE_MINGW_ACCESS" make clean
d) Type: CFLAGS="-std=c99 -D__USE_MINGW_ACCESS" make
e) Type: CFLAGS="-std=c99 -D__USE_MINGW_ACCESS" make -j1 DESTDIR=/home/<username>/ps2dev/<target>-gcc-bin install
8) Type: cd ..
9) Optional: Remove any sys-include directories made from the configure script in /opt/ps2dev/<target>/<target>
10) Type: rm ee-gcc/opt/ps2dev/ee/lib/libiberty.a
11) Type: rm iop-gcc/opt/ps2dev/iop/lib/libiberty.a
12) Type: tar cfz iop-gcc-bin.tar.gz iop-gcc-bin
13) Type: cd ee-gcc-bin && cp -i -r opt / && cd ..
14) Type: cd iop-gcc-bin && cp -i -r opt / && cd ..
15) Remove the ee-gcc and ee-gcc-bin directories
Now iop-gcc is built and archived and the ee-gcc base is built to build newlib.
Compiling ee-newlib:- 1) Open MSYS
2) Type: cd ~/ps2dev
3) Type: export PATH=$PATH:/opt/ps2dev/ee/bin
4) Extract the newlib-1.10.0 tarball using tar
5) Type: patch -p0 < ps2dev-patches/newlib-1.10.0-PS2.patch
6) Type: mkdir ee-newlib ee-newlib-bin
7) Type: cd ee-newlib
8) Type: ../newlib-1.10.0/configure --prefix=/opt/ps2dev/ee --target=ee
9) Type: CPPFLAGS="-G0" make clean
10) Type: CPPFLAGS="-G0" make
11) Type: CPPFLAGS="-G0" make -j1 DESTDIR=/home/<username>/ps2dev/ee-newlib-bin install
12) Type: cd ..
13) Type: tar cfz ee-newlib-bin.tar.gz ee-newlib-bin
14) Type: cd ee-newlib-bin && cp -i -r opt /
Compiling ee-gcc:- 1) Open MSYS
2) Type: cd ~/ps2dev
3) Type: mkdir ee-gcc-bin ee-gcc
4) Type: export PATH=$PATH:/opt/ps2dev/ee/bin
5) Type: cd ee-gcc
6) Type: CFLAGS="-std=c99 -D__USE_MINGW_ACCESS" ../gcc-3.2.2/configure --prefix=/opt/ps2dev/ee --target=ee --enable-languages="c,c++" --with-newlib --with-headers=/opt/ps2dev/ee/ee/include --enable-cxx-flags="-G0"
7) Type: CFLAGS="-std=c99 -D__USE_MINGW_ACCESS" CFLAGS_FOR_TARGET="-G0" make clean
8) Type: CFLAGS="-std=c99 -D__USE_MINGW_ACCESS" CFLAGS_FOR_TARGET="-G0" make
9) Type: CFLAGS="-std=c99 -D__USE_MINGW_ACCESS" CFLAGS_FOR_TARGET="-G0" make -j1 DESTDIR=/home/<username>/ps2dev/ee-gcc-bin install
10) Type: cd ../ee-gcc-bin
11) Type: rm opt/ps2dev/ee/bin/ee-c++filt.exe
12) Type: rm opt/ps2dev/ee/lib/libiberty.a
13) Type: cd ..
14) Type: tar cfz ee-gcc-bin.tar.gz ee-gcc-bin
15) Type: cd ee-gcc-bin && cp -i -r opt /
That should be it. You should have 4 archives called ps2-binutils.tar.gz, iop-gcc-bin.tar.gz, ee-newlib-bin.tar.gz, and ee-gcc-bin.tar.gz. I usually remove /opt/ps2dev and install the binaries from the archives at this point by extracting, changing directory to the extracted files, and doing "cp -i -r opt /". The "cp -i -r" command will notify of any file conflicts when installing the toolchain from the archives, but there shouldn't be any as all conflicting files between the archives were removed. Remember that the binaries aren't portable and use Windows absolute paths when they were compiled(even in MSYS), so you can't install them to a different Windows path.
Remember to modify the PATH variable at the bottom of /etc/profile to include the bin directories of the toolchains.
Code: Select all
PATH=$PATH:/opt/ps2dev/ee/bin:/opt/ps2dev/iop/bin:/opt/ps2dev/dvp/bin
PS2DEV=/opt/ps2dev
I made this tutorial because I had to compile the toolchain on Vista. I tried Cygwin 1.7.1, but it was slow (3x-5x slower than MinGW), and there seems to be an issue with the newlib headers or system headers in regards to building gcc with g++. The only bug report I found referenced a misconfiguration with kernel-headers on Linux. I think that's it, but if I missed a step or made a typo or there are problems, let me know :D.