Building a Kindle toolchain for OSX using crosstool-ng

That work is largely inspired by the great script by Michael Phillips, which I furpatched to compile a proper Kindle 2/3/DX/DXG toochain. You should first follow his instructions for the basic setup.

The Kindle Keyboard 3.4 is running Linux kernel 2.6.26-rt-lab126 using glibc version 2.5, compiled by gcc 4.1.2. This scripts builds a toolchain using Linaro gcc 4.7 2013.01 and glibc 2.9. Executables that don't use glibc features from versions more recent than 2.5 can be run on the Kindle if they are compiled with the additional cflags "-fno-stack-protector -U_FORTIFY_SOURCE" (reference).

You need a recent gcc, e.g. gcc 4.7, which can be installed through MacPorts:

sudo port install gcc47
sudo port select gcc mp-gcc47

Now, download the arm-kindle-linux-gnueabi.config file and the build.sh script (you can compare it with the original), and execute the following:

bash build.sh

If all went well, the script creates a disk image called CrossTool2NG.sparseimage in the current directory, and when it is mounted the the toolchain is available using:

PATH=/Volumes/CrossTool2NG/install/arm-kindle-linux-gnueabi/bin:$PATH

You can now revert to the default gcc compiler:

sudo port select gcc none

References

Valid XHTML 1.1! Valid CSS! Level Double-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0