Next Previous Contents

4. Building a cross-toolchain

If you have access to a build cross-toolchain, it might be easier to use/install that one. However, you might run into problems with it - the headers might have wrong information, you can't change the linkers text location , its built for big-endian instead of little-endian. But on the other hand, most (if not all) work without problems. Here is a list of websites with cross-toolchains:

But if on the other hand you want to be a geek and have a desire to build a cross-toolchain from scratch, go ahead and read this section.

This is naturally not the only cross-tool chain build guide in the world. If you have trouble comprehending this section, you might consider visiting these great sites:

Keep in mind that most of the documentation regarding building the cross-compiler came from the HOWTO Build a Cross Toolchain in Brief.

4.1 Getting the right sources

We are going to build an ARM cross tool chain (cross-platform compiler, cross-platform binutils) for a arm-coff file format (you could pick arm-elf, or arm-aout format as well). This COFF format produces flat, or standalone binaries, not tied in to any operating system.

The sources will reside in /ipaq/src, the /ipaq/build as the build directory, and /ipaq/local as the installation prefix.

Neccessary steps:

Uncompress all the files in the /ipaq/src source directory. You should have three directories binutils-2.9.5.0.22,gcc-2.95.2, and linux. Apply the two patches:
cd /ipaq/src/gcc-2.95.2
patch -p0 < ../gcc-2.95.2-diff-991022
cd gcc
patch -p0 < ../../gcc-fold-const.patch

Create the build directories. These are the directories where the programs will be build. In this document, /ipaq/build is the build directory.


mkdir /ipaq/build
mkdir /ipaq/build/binutils-2.9.5.0.22
mkdir /ipaq/build/gcc-2.95.2

4.2 Installing binutils

BinUtils are your friends. They are essentialy the basic tools needed by the cross-compiler to function. They include utilties such as objcopy, objdump, as, ar, strip, ld and bunch other.

4.3 Setting up headers for the cross-compiler

For the cross-compiler to compile correctly, its neccesary to have the include files from the Linux. Even though you are going to compile programs using your own include headers, this step is still neccesary. If you don't follow this step, you wont be able to compile the GNU gcc cross-compiler. There only reason why you want to this is that GCC will compile. You can remove the include files later on.

Dirty secret: It uses the include files to make its libgcc.a file. If you are going to link source files using gcc, then you need this file. If you aren't and you are going to use your own libraries, you won't use this file.

4.4 Building GCC.

4.5 Thoughts

Instead of arm-coff you can use arm-aout if you want too.


Next Previous Contents