Last active
November 19, 2020 15:31
-
-
Save carlosedp/560d743dc183eda125deffa42629367b to your computer and use it in GitHub Desktop.
PS3 SPU Toolchain Build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euxo pipefail | |
CURRPATH=$(pwd) | |
DEST_PATH=${HOME}/x-toolchain/spu | |
BINUTILS_VER=2.33.1 | |
GCC_VER=9.3.0 | |
NEWLIB_VER=2.5.0.20170519 | |
GDB_VER=9.2 | |
# Download | |
if [ ! -f binutils-${BINUTILS_VER}.tar.gz ]; then | |
wget https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VER}.tar.gz | |
tar vxf binutils-${BINUTILS_VER}.tar.gz | |
fi | |
if [ ! -f gcc-${GCC_VER}.tar.gz ]; then | |
wget https://ftp.gnu.org/gnu/gcc/gcc-${GCC_VER}/gcc-${GCC_VER}.tar.gz | |
tar vxf gcc-${GCC_VER}.tar.gz | |
fi | |
if [ ! -f newlib-${NEWLIB_VER}.tar.gz ]; then | |
wget ftp://sourceware.org/pub/newlib/newlib-${NEWLIB_VER}.tar.gz | |
tar vxf newlib-${NEWLIB_VER}.tar.gz | |
fi | |
if [ ! -f gdb-${GDB_VER}.tar.gz ]; then | |
wget https://ftp.gnu.org/gnu/gdb/gdb-${GDB_VER}.tar.gz | |
tar vxf gdb-${GDB_VER}.tar.gz | |
fi | |
rm -rf build | |
mkdir -p build/{binutils,gdb,gcc,newlib} | |
# Binutils | |
pushd build/binutils | |
../../binutils-${BINUTILS_VER}/configure \ | |
--target=spu \ | |
--prefix=${DEST_PATH} \ | |
--program-prefix=spu- \ | |
--disable-werror | |
make -j`nproc` | |
make install-strip | |
install -c ../../binutils-${BINUTILS_VER}/binutils/embedspu.sh ${DEST_PATH}/bin/embedspu | |
patch -p1 < ../../embedspu.patch ${DEST_PATH}/bin/embedspu | |
popd | |
# GCC | |
pushd gcc-${GCC_VER} | |
./contrib/download_prerequisites | |
popd | |
export PATH=${DEST_PATH}/bin:$PATH | |
# Build GCC | |
pushd build/gcc | |
../../gcc-${GCC_VER}/configure \ | |
--prefix=${DEST_PATH} \ | |
--target=spu \ | |
--program-prefix=spu- \ | |
--disable-libssp \ | |
--disable-checking \ | |
--disable-werror \ | |
--disable-libquadmath \ | |
--enable-languages="c" \ | |
--enable-obsolete \ | |
--without-headers | |
make all-gcc -j`nproc` | |
make install-gcc | |
popd | |
# Newlib | |
pushd build/newlib | |
../../newlib-${NEWLIB_VER}/configure \ | |
--prefix=${DEST_PATH} \ | |
--target=spu \ | |
--program-prefix=spu- \ | |
--disable-werror | |
make -j`nproc` | |
make install | |
popd | |
# GCC Step 2 | |
pushd build/gcc | |
../../gcc-${GCC_VER}/configure \ | |
--prefix=${DEST_PATH} \ | |
--target=spu \ | |
--program-prefix=spu- \ | |
--disable-libssp \ | |
--disable-checking \ | |
--disable-werror \ | |
--disable-shared \ | |
--disable-libquadmath \ | |
--disable-libgloss \ | |
--enable-threads \ | |
--enable-languages=c,c++ \ | |
--enable-obsolete \ | |
--with-newlib | |
make -j`nproc` | |
make install-strip | |
popd | |
# GDB | |
pushd build/gdb | |
../../gdb-${GDB_VER}/configure \ | |
--prefix=${DEST_PATH} \ | |
--target=spu \ | |
--program-prefix=spu- \ | |
--disable-nls \ | |
--disable-sim \ | |
--disable-werror | |
make -j`nproc` | |
make install-strip | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment