1. Download binutils & gcc & newlib
URL:http://sourceware.org/projects.html
[root@localhost mips]# ll
total 114768
-rwxr--r-- 1 root root 19973532 Oct 16 09:56 binutils-2.22.tar.bz2
-rwxr--r-- 1 root root 82884636 Oct 16 10:06 gcc-4.7.2.tar.bz2
-rwxr--r-- 1 root root 14571004 Oct 16 09:53 newlib-1.20.0.tar.gz
2. Unpack
[root@localhost mips]# ll
total 114768
drwxr-xr-x 17 root root 4096 Oct 17 11:06 binutils-2.22
-rwxr--r-- 1 root root 19973532 Oct 16 09:56 binutils-2.22.tar.bz2
drwxr-xr-x 33 1000 1000 4096 Oct 17 11:47 gcc-4.7.2
-rwxr--r-- 1 root root 82884636 Oct 16 10:06 gcc-4.7.2.tar.bz2
drwxrwxr-x 7 2608 2613 4096 Dec 20 2011 newlib-1.20.0
-rwxr--r-- 1 root root 14571004 Oct 16 09:53 newlib-1.20.0.tar.gz
3. Execute the following command
[root@localhost mips]# mv newlib-1.20.0 gcc-4.7.2
[root@localhost mips]# cd gcc-4.7.2
[root@localhost gcc-4.7.2]# ln -s newlib-1.20.0/newlib .
[root@localhost gcc-4.7.2]# ./contrib/download_prerequisites
[root@localhost gcc-4.7.2]# cd -
4. Compile binutils
[root@localhost mips]# mkdir build_binutils/
[root@localhost mips]# cd build_binutils/
[root@localhost build_binutils]# ../binutils-2.22/configure --target=mips-elf --with-arch-32=xcpu --with-arch-64= --with-abi=eabi --disable-shared --enable-lto --enable-gold --disable-libmudflap --disable-libssp --disable-libgomp --disable-nls --disable-libstdcxx-pch --disable-sgxx-sde-multilibs --with-gnu-as --with-gnu-ld --with-pkgversion="bintutils 2.22 Coolsand 2012.09-01" --prefix=$HOME/usr/gnu-tools/mips-elf
[root@localhost build_binutils]# make -j4
[root@localhost build_binutils]# make install
[root@localhost build_binutils]# cd -
5. Compile gcc
[root@localhost mips]# mkdir build_gcc/
[root@localhost mips]# cd build_gcc/
[root@localhost build_gcc]# ../gcc-4.7.2/configure --target=mips-elf --with-arch-32=xcpu --with-arch-64= --with-abi=eabi --with-float=soft --enable-languages=c,c++ --disable-shared --enable-lto --with-newlib --disable-multilib --enable-plugin --enable-gold --disable-threads --disable-libmudflap --disable-libssp --disable-libgomp --disable-nls --disable-libstdcxx-pch --disable-sgxx-sde-multilibs --with-gnu-as --with-gnu-ld --with-pkgversion="GCC 4.7.2 Coolsand 2012.09-01" --prefix=$HOME/usr/gnu-tools/mips-elf
[root@localhost build_gcc]# make -j4
[root@localhost build_gcc]# make install
[root@localhost build_gcc]# cd -