Table of contents


This is probably the most complicated topic of all related to embedded development but we need to deal with it at the beginning. I read a lot about toolchains but still don’t know enough to explain details. I think that best answers are in crosstool-ng documentation.

What is toolchain ?

Toolchain as the name said is a set of tools chained together, so output of one tool is the input for different tool. This is well known concept in Linux (eg. pipes). In embedded environment toolchain is called cross-toolchain or cross-compiler, because usually it compiles on one architecture and generate code for another (eg. it compiles on x86 and generate code for arm)[1].

Why we need cross-toolchain ?

I suspect that your laptop/PC is not based on ARM processor, most probably it based on x86 architecture so you cannot simply compile code and run it in our virtual-arm-based environment. To prepare operating system and tools for it we need cross-toolchain.

How to create toolchain ?

Process of creating cross-toolchain from scratch is not easy and takes some time. There are few other ways to get toolchain, than creating it from scratch. First we can use prebuilt toolchain providers like: CodeSourcery, Linaro, DENX EDLK or Emdebian. Second we can create toolchain using special building system like: Buildroot, Crosstool-NG or Bitbake. I will not deal with preparing toolchain in this series because procedure for creating it takes pretty long. So we have two options:

Emdebian path

Add below lines to you /etc/apt/sources.list:

Install Emdebian keys, update and install cross-compiler with all related packages:

Dependency problems during installation

If above attempt to install cross-compiler ends with:

This means that Debian ustable cross-compiler is not available for you configuration. You can read more about that here. To fix that issue simply change emdebian toochain repository to testing in /etc/apt/source.list:

Emdebian toolchain configuration

Check where arm-linux-eabi-gcc-4.7 was installed:

It is not linked to arm-linux-gnueabi-gcc, so we cannot give its prefix as CROSS_COMPILE variable value, which is needed for bootloader and kernel compilation. We have to link it to arm-linux-gnueabi-gcc:

Toolchain is ready to use.

Note: I tried CodeSourcery toolchain arm-2012.09-64-arm-none-linux-gnueabi.bin, but it contain binutils defect that not allow correctly build kernel. If you see something like this in log:

That means you experience same thing, please use Emdebian or Crosstool-NG toolchain.

Note 2: If you’re Ubuntu user I have to suggest experiments with toolchain build by your own, because I get really hard times trying to go through this tutorial with Ubuntu/Linaro cross compiler provided in repository. Finally I used this to push things forward. U-boot compiled with Ubuntu/Linaro toolchain had problem with __udivsi3 instruction. This cause loop in initialization process.


If you take effort of creating toolchain using Crosstool-NG than congratulations. But for simplifying whole Virtual Development Board series I will use Emdebian toolchain in further posts. Of course you can use your brand new Crosstool-NG toolchain by simply remember that tools prefixes are different. Emdebian uses arm-linux-gnueabi- and Crosstool-NG was created with arm-unknown-linux-gnueabi-. Replace one with another every time when needed. In next post we will deal with bootloader.


[1] Toolchains