Building a cross-compiler (x86)

In order to compile Fudge for x86 we need to create a cross-compiler. Building a cross-compiler can be a tedious task but luckily there is tool called crosstool-ng that automates the entire process for us. Even if you happen to be using the same platform as we are targeting you should still build a cross-compiler because the tools that ships with your operating system might have been specifically configured for your system. When compiling Fudge, we must use a barebone compiler.

Installing

Download and install crosstool-ng. The recommended version is 1.23.0.

$ wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.23.0.tar.bz2
$ tar xjf crosstool-ng-1.23.0.tar.bz2
$ cd crosstool-ng-1.23.0
$ ./configure
$ make
# make install
        

The last command must probably be run as root.

Configuring

Create a folder in your home directory called temp and cd to it.

$ mkdir ~/temp
$ cd ~/temp
        

Configure the cross-compiler environment by running:

$ ct-ng menuconfig
        

This will start the configuration program. Set the target architecture to x86. Select:

Target options -> Target Architecture -> x86

By default the cross-compiler will be installed in ~/x-tools/x86-unknown-elf/. You can change this if you want. Please refer to the crosstool-ng website for more information on how to customize your setup.

Exit the configuration tool by pressing exit a few times. Before you leave the last screen you will be asked if you want to save these settings. Press yes.

Building

Start to build the cross-compiler:

$ ct-ng build
        

Depending on your system this may take some time, usually around 10-15 minutes. Grab a coffee.

Next step

Building Fudge (x86).