For the latest (unstable !) 2.6.x kernels
I'm currently using the pre-compiled toolchain from ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-mipsel-latest.i386.rpm .
WARNING: all information below this line is old, probably still ok for the 2.4.x kernels but no longer updated !
You can get a precompiled toolchain (BSP) from TimeSys, after (free) registration:
http://www.timesys.com/index.cfm?hdr=linux_header.cfm&bdy=linux_bdy_download.cfm&item_id=78
Trust me, registering is much faster and easier than building your own ;-)
Build your own
If you want to build your own, I strongly suggest to take a look at jal0's pages for detailed instructions.
Below are the outdated instructions to build you own on Linux, based on instructions from Bradley D. LaRonde (http://www.ltc.com/~brad/mips/mipsel-linux-cross-toolchain-building.txt)
If you want to use a Win32 host instead of a linux host, please take a look at
jal0's instructions
# get the files
wget ftp://ftp.kernel.org/pub/linux/devel/binutils/binutils-2.11.92.0.12.3.tar.gz
wget ftp://ftp.gnu.org/gnu/gcc/gcc-3.0.3/gcc-3.0.3.tar.gz
wget ftp://ftp.gnu.org/gnu/glibc/glibc-2.2.4.tar.gz
wget ftp://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.2.4.tar.gz
wget http://www.linux4.BE/download/toolchain/kernel-headers-mipsel-linux-2.4.0-test9-1lv.i386.rpm
# Build the cross-binutils
tar -xzf binutils-2.11.92.0.12.3.tar.gz
mkdir mipsel-binutils
cd mipsel-binutils
../binutils-2.11.92.0.12.3/configure --target=mipsel-linux \
--libdir='${exec_prefix}'/mipsel-linux/i386-linux/lib
make
make install
cd ..
# Build the C cross-compiler
tar -xzf gcc-3.0.3.tar.gz
mkdir mipsel-gcc
cd mipsel-gcc
#../gcc-3.0.3/configure --target=mipsel-linux --enable-languages=c \
# --disable-shared --with-headers=/usr/local/mipsel-linux/include
../gcc-3.0.3/configure --target=mipsel-linux --enable-languages=c \
--disable-shared --with-headers=/home/filip/vr/snow-gcc/mipsel-linux/include/
make
make install
cd ..
# Cross-build glibc
tar -xzf glibc-2.2.4.tar.gz
cd glibc-2.2.4
tar -xzf ../glibc-linuxthreads-2.2.4.tar.gz
cd ..
mkdir mipsel-glibc
cd mipsel-glibc
../glibc-2.2.4/configure --build=i686-linux --host=mipsel-linux \
--enable-add-ons --prefix=/usr --disable-sanity-checks
make
make install install_root=/usr/local/mipsel-linux/glibc
cd ..
cp -a /usr/local/mipsel-linux/glibc/lib/* /usr/local/mipsel-linux/lib/
cp -a /usr/local/mipsel-linux/glibc/usr/include/* /usr/local/mipsel-linux/include/
cp -a /usr/local/mipsel-linux/glibc/usr/lib/* /usr/local/mipsel-linux/lib/
# Copying the files isn't quite enough though. You also need to edit /usr/local/
# mipsel-linux/lib/libc.so (yes, it is a text file suprisingly enough) to point
# to the cross-built glibc files so that the cross-build tools know to use the
# mipsel libc and not the host's libc, something like:
#
# GROUP ( /usr/local/mipsel-linux/lib/libc.so.6
# /usr/local/mipsel-linux/lib/libc_nonshared.a )
# Build the final C and C++ cross-compilers
cd mipsel-gcc
../gcc-3.0.3/configure --target=mipsel-linux --enable-languages=c,c++
make
make install
and that's all ...