Quick build of arm-unknown-linux-gnueabi with crosstool-ng

You might be surprised at how much you have to make to correctly build arm-unknown-linux-gnueabi config based toolchain with crosstool-ng. As you can see examples of many open source projects, the man’s work is a rare resource. The result of this economic fact is that the attempt to build configuration arm-unknown-linux-gnueabi is not a simple task and during an operation you can come across many problems. Although I am not afraid of problems and effectively try to fight them and of course sharing the results of my work. My build system parameters: Debian GNU/Linux wheezy/sid 3.2.0-2-amd64

  • Clone crosstools-ng (you need mercurial)
  • Create temporary directory and run
  • We probably want to change directory to which all stuff will be build (default is $HOME/x-tools):

And go to:

Paths and misc options ---> (${HOME}/x-tools/${CT_TARGET}) Prefix directory

Change it according to your needs. Exit end save configuration.

  • Build (number after dot depend on how many command we want to run simultaneously): ct-ng build.4 It can take a lot of time. On my machine with 5k BogoMips it takes over 1h.

Problems that you can encounter:

  • gcj - latest changeset 2916:6f758ed4c0b9 have trouble finding gcj binary, which it show using following message:

    [ERROR] Missing: ‘x86_64-unknown-linux-gnu-gcj’ or ‘x86_64-unknown-linux-gnu-gcj’ or ‘gcj’ : either needed! To workaround this install

gcj and link binary like this:

sudo ln -s /usr/bin/gcj-4.6 /usr/bin/gcj
  • duma - mentioned changeset also has problem with url to D.U.M.A library, apply below changes to workaround problems:
  • mawk - if mawk return syntax error like this:

    mawk: scripts/gen-sorted.awk: line 19: regular expression compile failed (bad class – [], [^] or [)

It could be fixed in two ways. First is to change line 19 in /path/to/tmp/dir/.build/src/glibc-2.9/scripts/gen-sorted.awk Is:

sub(//[^/]+$/, "", subdir);
 Should be:

sub(//[^/]+$/, "", subdir);

Or simply by installing gawk, reconfigure and recompile crosstools-ng. This was my first post related to linux embedded enviroment. Hope it will be more. Enjoy!

Piotr Król
Founder and Embedded Systems Consultant at 3mdeb as well as freelance CTO of Vitro Technology and CEO of LPN Plant. Passionate about building firmware that enables advanced hardware features in modern products. Dedicated to customers that treat embedded software security and upgradeability as forethought. Open source firmware evangelist interested in platform security and trusted computing. In favor of fixed price projects with a clear definition of success.