I built my cross compiler on a Compaq Presario laptop with a PIII processor (1.1 Ghz) with 256MB memory. It was
running RedHat Linux (9.0) with kernel version 2.4.24 and native gcc version 3.2.2. I was building gcc
for an embedded PowerPC 405GP processor without a floating point unit.
Acquire from mirrors.kernel.org the sources to the latest versions of
binutils, gcc, glibc, and glibc-linuxthreads (under the gnu sub-heading). I used binutils-2.14.tar.gz,
gcc-3.3.2.tar.gz, glibc-2.3.2.tar.gz, and glibc-linuxthreads-2.3.2.tar.gz.
Untar and unzip gcc, glibc, and binutils. Make a source directory and move the tar'd sources to that directory.
Acquire the
gcc-3.3.1-crossppc.diff patch from PenguinPPC and apply
it in the gcc directory (experimentally I found that this worked with gcc-3.3.1 and gcc-3.3.2 but nothing else).
Make three build directories build-gcc, build-glibc, and build-binutils (for doing the build process in
the "build directory"). My directory
structure has the following directories in the main cross-compiling directory: binutils-2.14, gcc-3.3.2, glibc-2.3.2,
build-binutils, build-glibc, build-gcc, and source. I reference this directory as the "build directory". I
reference "main directory" as wherever you want the cross compiling tools to go (I just used the "build directory" for
this).
Go into your kernel source directory (usually in /usr/src/linux-version). Go into the include directory and change
the asm sym-link to point to asm-ppc (to get the kernel/sys call headers for the ppc).
First, build bin utils. In the build-binutils directory run the following...
../binutils-2.14/configure --target=powerpc-linux --prefix="main directory"
make all install
Next, build a minimal gcc. In the build-gcc directory run...
../gcc-3.3.2/configure --target=powerpc-linux --prefix="main directory" --disable-shared --disable-threads --enable-languages=c --with-newlib
make all-gcc install-gcc
Next, build glibc. Unzip and untar glibc-linuxthreads in the glibc directory. In glibc-2.3.2/stdio-common/sscanf.c
change the parameter declaration for the sscanf function to "int sscanf (const char *s, const char *format, ...)",
delete the former declaration which should be "int sscanf(s, f) const char*s; const char* format;" (or something
similar to that). In the build-glibc directory run...
../glibc-2.3.2/configure --prefix="main directory" --target=powerpc-linux --host=powerpc-linux --enable-add-ons=linuxthreads --with-headers=/usr/src/linux-"version"/include/ --with-binutils="main directory"/powerpc-linux/bin
make all install
Next, build the full gcc. In the build-gcc directory run...
./configure --target=powerpc-linux --prefix="main directory" --enable-shared --enable-threads --enable-languages=c --with-cpu=405 --without-fp --with-libs="top of build directory"/lib
make all install
The compiler is in the "main directory"/bin directory. The basic errors I encountered were due to not having the asm
sym-link set correctly, not changing the sscanf function declaration, not patching gcc with the cross compile patch
from PenguinPPC, and not including the new ppc glibc libraries when I built gcc the second time.