Creating an uClibc armv4tl-softfloat-eabi Toolchain

Spent the last couple of days trying to build an uclibc toolchain for the Freerunner. This turned out to be quite a pain in the ass!

The easiest way would probably have been to just use the OpenWRT build system but I think for my specialized needs this is a bit overkill. After all my current goal is to build a small user space based boot menu and not a full blown distribution. Therefore I wanted to get Firmware Linux a set of relatively small, simple and therefore understandable shell scripts which among other things generate a relocatable cross compiler.

Unfortunately FWL doesn’t provide an armv4tl-softfloat-eabi configuration out of the box and my first attempts all resulted in an “Illegal instruction” error. The compiler for some reason generated code which doesn’t actually run on the hardware it should.

After a lot of head scratching and quite some frustration I finally found a solution. The problem seems to be that ARM EABI is only supported by armv4t+ (read: armv4 with thumb instruction support or anything newer like armv{5,6,..} etc). But gcc actually defaults to an armv5 instruction set when using EABI, this obviously doesn’t work on armv4t although the hardware is EABI capable.

A patch to gcc which is also used by the OpenWRT folks that changes the default cpu type solved the problem. I now have a working cross compiler. Yeah!