Version 16 (modified by 14 years ago) (diff) | ,
---|
Configuration
If you already have cross-compilers available, you may define yours in configuration files, see here.
Get the sources
For Mips (LE and BE) and PowerPC, you will need gnu binutils, gcc and gdb. They are available on ftp.gnu.org or any gnu mirror. http://ftp.gnu.org/gnu/binutils, http://ftp.gnu.org/gnu/gcc, http://ftp.gnu.org/gnu/gdb.
You'll probably also need http://ftp.gnu.org/gnu/gmp/ and http://ftp.gnu.org/gnu/mpfr/, depending on your distribution, it will be provided by a dev package or not.
Let's unpack sources:
$ mkdir src $ cd src $ tar xjf ..../binutils-2.xx.tar.bz2 $ tar xjf ..../gcc-x.x.x.tar.bz2 $ tar xjf ..../gdb-x.x.x.tar.bz2 $
Compilation
Now lets compile a Mips LE/BE toolchain. I assume we'll need to compile more toolchains later, so let's share the sources and compile in a separate directory:
$ cd .. $ mkdir build build/mipsel build/mipsel/binutils build/mipsel/gcc build/mipsel/gdb
First, binutils
$ cd build/mipsel/binutils $ ../../../src/binutils-2.x/configure --prefix=/where/to/put/it --target=mipsel-unknown-elf \ --program-prefix=mipsel-unknown-elf- --disable-nls --disable-werror $ make $ make install $
Export the bin
directory of your installation path, if not already in it.
You should make this permanent by setting the PATH variable in a shell's startup script.
$ export PATH=$PATH:/where/to/put/it/bin $
Now gcc
Important ! Use the same --prefix=
option for binutils and GCC or your GCC will be invalid.
$ cd ../gcc $ ../../../src/gcc-x.x.x/configure --prefix=/where/to/put/it --target=mipsel-unknown-elf \ --program-prefix=mipsel-unknown-elf- --disable-nls --disable-werror --enable-languages=c --disable-libssp \ --disable-threads --without-headers $ make $ make install $
Now gdb
$ cd ../gdb $ ../../../src/gdb-x.x.x/configure --prefix=/where/to/put/it --target=mipsel-unknown-elf \ --program-prefix=mipsel-unknown-elf- $ make $ make install $
We're done !
You may compile PowerPC, ARM, ... toolchains as well, with the same lines, replacing mipsel
by powerpc
, arm
, ....