Building a crosscompiling toolchain with gcc3

This document is out of date. See for my latest attempt. (Some of the ppc405 stuff on this page may still be useful, though.)

We looked, but could find no fully debugged script to build a complete toolchain (binutils, gcc3, and glibc) for crosscompiling for SH4, PPC405, and PPC750 targets. So we wrote one, with lots of help from Bill Gatliff's documentation.

Here's roughly how works. (We have full kernel sources around, so we lazily use them rather than extracting just the kernel headers. Apologies.)

With minor differences (see the script) the above works for SH4. For PPC, there are a few additional hoops to jump through:


The script and associated files are available as the tarball xgcc3.tar.gz, or as individual files:


./ (sh4|ppc405|ppc750)
The script assumes that the source tarballs are in ~/cross_tars/ It installs the compiler into /opt/xgcc3; modify TOPPREFIX if desired.

It assumes that you have a complete kernel source tarball; see fetch*.sh for how to grab the kernel sources we have been using.

Example for ppc405:

# Unpack
tar -xzvf xgcc3.tar.gz
cd xgcc3

# Download source tarballs
mkdir ~/cross_tars
cd ~/cross_tars
sh ~/xgcc3/
sh ~/xgcc3/

# Make a place for the results
sudo mkdir /opt/xgcc3
sudo chown $USER.$USER /opt/xgcc3

# Build
cd ~/xgcc3
sh ppc405

# Enjoy
/opt/xgcc3/ppc405/bin/powerpc-linux-gcc hello.c

Known issues


See also My notes on remote testing of gcc

Some general discussion about the toolchain:



Dimi Shahbaz,,
Dan Kegel,,
Ixia Communications