Cross Compiling (linux cross powerpc)

Cross Compiling

In brief the most important steps and utilities for cross compilation.
Our host system, the system on which the tools will run, is GNU linux, whereas the target system, the system for which the tools are generating code, is powerpc-eabi.

Ressources for cross compiling

1. module: binutils

In a first step you have to build the host libraries (binutils).
We have used binutils-2.17 downloaded from (ftp.gnu.org/gnu/binutils/binutils-2.17.tar.gz) .
Normally you should build it in its own folder using the following options.
The variable

$VERZ
denotes the directory the cross compilation tools are installed. The variable
$TARGET
denotes the target system for which code is generated, for this case:
TARGET=powerpc-elf

$ ./configure --prefix=$VERZ --disable-nls --target=$TARGET --libdir=$VERZ/lib 

$ PATH=$VERZ/bin:$PATH make all install

2. module: compiler

The next step includes building the host program (gcc).
In order to do so, you have to use the following patch provided in (Makefile) , saved in the same directory as the gcc.
We have used gcc-4.1.0 downloaded from (http://mirrors.kernel.org/gnu/gcc/gcc-4.1.0/gcc-4.1.0.tar.bz2) .


$ patch -p0 < $VERZ/patch-Makefile.in 

$ PATH=$VERZ/bin:$PATH ./configure --prefix=$VERZ --disable-nls --with-system-zlib --target=$TARGET \
--libdir=$VERZ/lib --enable-languages=c --with-dwarf2  --with-newlib \ 
--disable-shared --with-as=$VERZ/bin/$TARGET-as  --with-ld=$VERZ/bin/$TARGET-ld

$ PATH=$VERZ/bin:$PATH MACHINE_ARCH=powerpc make all install 

3. module: newlib

For the creation of the target libraries newlib, the module makeinfo has to be installed ( http://ftp.gnu.org/gnu/texinfo/texinfo-4.8.tar.gz).
Now we can use the currently built target compiler and thus configure and compile the target libraries, normally again in its own build folder.
Therefore, we have used newlib-1.15.0 downloaded from (ftp://sources.redhat.com/pub/newlib/newlib-1.15.0.tar.gz) .

$ PATH=$VERZ/bin:$PATH ./configure --prefix=$VERZ \ 
--target=$TARGET --libdir=$VERZ/lib

$ PATH=$VERZ/bin:$PATH make all install