Skip to content

Instantly share code, notes, and snippets.

@WillSams
Last active December 11, 2022 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WillSams/d93b1098079b1e0b00a24388865b3b4e to your computer and use it in GitHub Desktop.
Save WillSams/d93b1098079b1e0b00a24388865b3b4e to your computer and use it in GitHub Desktop.
Playstation 1 Dev Setup
#!/bin/bash
TEMPBUILDDIR=/tmp/psxbuild
GCCBUILDIR=$TEMPBUILDDIR/pkgs/gcc-build
BINUTILS_VERSION=2.39
GCC_VERSION=7.1.0
PSXDEV=/opt/toolchains/psx
sudo bash -c "mkdir -p $PSXDEV/tools && chown -R $USER:$USER $PSXDEV"
mkdir -p $TEMPBUILDDIR/tools $TEMPBUILDDIR/pkgs
# BINUTILS - If you just want to write assembly code, you can just install this, really.
cd $TEMPBUILDDIR/pkgs
wget http://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VERSION.tar.bz2
tar xvjf binutils-$BINUTILS_VERSION.tar.bz2
cd $TEMPBUILDDIR/pkgs/binutils-$BINUTILS_VERSION
./configure --target=mipsel-unknown-elf --prefix=$PSXDEV --with-float=soft
make && make install
export PATH=$PATH:$PSXDEV
# GCC - this will take awhile
cd $TEMPBUILDDIR/pkgs
wget http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2
tar xvjf gcc-$GCC_VERSION.tar.bz2
mkdir $GCCBUILDIR
cd $TEMPBUILDDIR/pkgs/gcc-$GCC_VERSION
./contrib/download_prerequisites # i.e., gmp, mpfr, mpc
cd $GCCBUILDIR
../gcc-$GCC_VERSION/configure --disable-libada --disable-libssp --target=mipsel-unknown-elf --prefix=$PSXDEV --without-headers -with-float=soft
make && make install
# ePSxe (Windows vers)
sudo bash -c "mkdir -p $PSXDEV/tools/epsxe" && cd $PSXDEV/tools/epsxe
sudo bash -c "wget http://www.epsxe.com/files/ePSXe205.zip"
sudo bash -c "unzip ePSXe205.zip"
sudo bash -c "rm ePSXe205.zip"
# For sanity check, :
# 1 - Run `git clone https://github.com/XaviDCR92/psxsdk.git`
# 2 - Within the Makefile.cfg file, change the value of the TOOLCHAIN_PREFIX variable to match
# the value of the PSXDEV near the beginning of this script (i.e., /opt/toolchains/psx).
# 3 - In the root of the psxsdk repository, execute `make && make install`.
# 4 - Next, let's change our current path by running `PATH=$PATH:/opt/toolchains/psx/bin:/opt/toolchains/psx/tools`
# 6 - In ./examples/puzzle, execute `make`. Should run with no errors.
# 7 - To check with an emulator, execute `exec wine "/opt/toolchains/psx/tools/epsxe/ePSXe.exe" "-loadbin" "puzzle.iso" "-nogui"`.
# Remove the temp build directory
rm -rf $TEMPBUILDDIR
#*****************************************************************************
echo "$SCRIPTFULLNAME ($SCRIPTVERSION) complete."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment