How to build a cross compiler for Linux/MIPS

Here's a rough draft of how to build the cross compiler tools for Linux. Please send feedback to

imp@village.org

The Village links are not yet active, and links to ftp.fnet.fr are also needed.

The configuration name for Linux MIPS is currently mipsel-unknown-linuxelf. Some of the developers prefer the shorthand of mipsel-linuxelf. The former follows the FSF conventions to the letter, while the latter follows the traditional linux conventions. The port currently is dominated by little endian machine developers. There is also support for big endian by replacing mipsel- with mips- in the above strings. I have followed the traditional linux conventions in this document.

Worst case this process requires about 120M of disk space. This will settle down to a mere 20M if you delete most of the sources once you have built them. This space requirement is exclusive of the kernel itself and the other programs that you may wish to build.

Step 1: Get the right sources.

Currently, you will need to grab binutils 2.5.2 and gcc 2.7.2. Binutils is now in rev 2.6, so finding an old copy might be hard. You can find a copy of 2.5.2, and the patches to it, from the Village. Unfortunately, this does not work out of the box, and you need the following patches to make it work. A copy can be found in the Village.

gcc 2.7.2 can current be obtained from MIT. This too has some problems building Linux/MIPS out of the box, so additional patches are needed. You can find these patches in the Village. These patches may be applied to 2.7.1 or 2.7.2.

You also need to grab the current libc (at this point in time, it is libc-951212). It too is available from the Village.

You will need about 12.5M of disk space for the raw .gz files alone. A 28.8 modem can grab about 6M/hr. A 14.4 about 3M/hr. A 56k line about 12M/hr. A T1 can grab about 275M/hr.

Step 2: Building binutils

This will require about 35-40M of disk space. Plus an additional 10.5M of space to install the binaries. On a 486DX2-66 it took about 10-15 minutes to build.

Step 3: Installing the libraries

This will take 2.2M of disk space on a permanant basis. You will need to do this in order for the cross compiler to finish compiling correctly!

Step 4: Build gcc

This step will require 43 M in disk. 6 M of disk is required to do an installation. It takes about 30 minutes to build on a 486DX2-66.

Congratulations. You now have a cross compiler!