How to install a patched toolchain for ia32

How should you install a patched toolchain for the ia32? Below we describe the installation instructions for binutils-2.16.1, gcc-4.0.2 and glibc-2.3.6.
If you are building this toolchain on a Linux box with a 2.6 kernel, you will need to download kernel headers for the installation of glibc. You can download these headers here.

  1. Download all necessary files to some directory (say:/tmp). [http://ftp.gnu.org/gnu/binutils/, http://gcc.gnu.org/mirrors.html, http://ftp.gnu.org/gnu/glibc/]
  2. Download the binutils patch from the Diablo website to the /tmp directory
  3. Extract the binutils:
    • cd /tmp
    • tar xzf binutils-2.16.1.tar.gz or tar xjf binutils-2.16.1.tar.bz2
  4. Patch the binutils using the patch file from the Diablo website: cd binutils-2.16.1 ; patch -p1 < 'patchfile'
  5. Create a new directory where you are going to build binutils, eg. 'binutils-build', but don't make this directory of subdirectory of binutils-2.16.1: mkdir binutils-build
  6. Change to the binutils-build directory and configure the binutils: cd binutils-build ; ../binutils-2.16.1/configure --host=i686-pc-linux-gnu --prefix=/the/path/to/install/the/toolchain/ --target=i686-pc-linux-gnu --disable-nls --disable-shared
    • --disable-nls means: no native language support. This results in smaller binaries, but all diagnostic messages will be in English
    • --disable-shared means: statically link the binutils programs. They will be a lot bigger, but you can move the programs around.
    • --prefix will make sure the new toolchain gets installed in /the/path/to/install/the/toolchain/. Note that in this directory subdirs are created such as bin and lib.
  7. Now type make and make install. This will start building and installing the binutils which can take a couple of minutes
  8. To be continued...