This article illustrated how to install on a Ubuntu Linux PC a complete toolchain to cross compile for ARM9 the full Linux Kernel, Linux device drivers, Linux application or your own C and C++ applications.
Originally written by Lee McLoughlin
Although the Netus is completely capable of compiling applications and the kernel natively on the Netus itself cross compiling can be considerably faster. My Core 2 Duo 2 1 Gigabyte RAM PC can cross compile programs at least 10 times faster and for big programs over 20 times faster.
A few years back the people behind the ARM cpu range improved the way function calls were made. This new technique was called the “Embedded Abstract Binary Interface” or EABI for short. The ARM design also allowed for both big-endian and little-endian byte arrangements. The Netus is setup to use the new EABI as little-endian - ARM EABI little - or ARMEL for short.
Emdebian is short for the Embedded Debian Project an ongoing project to build Debian for small ARM based systems. In the long term I'm sure projects will be able to use all the space saving advances of Emdebian's Grip and Crush highly compact set ups. But here we are just going to use its ARM cross compiler capable of being run on Intel processors.
As root edit /etc/apt/sources.list and add the following to the end of the file:
# # -- Emdebian cross toolchains # # deb http://www.emdebian.org/debian/ unstable main # deb http://www.emdebian.org/debian/ testing main deb http://www.emdebian.org/debian/ lenny main
Now we need to tell apt to use this new repo':
sudo apt-get install emdebian-archive-keyring sudo apt-get update
Finally we can install the GCC, G++ cross compilers and support programs
sudo apt-get install libc6-armel-cross libc6-dev-armel-cross sudo apt-get install binutils-arm-linux-gnueabi sudo apt-get install gcc-4.3-arm-linux-gnueabi sudo apt-get install g++-4.3-arm-linux-gnueabi sudo apt-get install uboot-mkimage sudo apt-get install apt-cross dpkg-cross sudo apt-get install libncurses5-dev
sudo apt-get install gcc-4.3-arm-linux-gnueabi may fail to load with a dependancy mismatch. In which case use the 4.2 versions of gcc and g++.
Thanks to Geert Vancompernolle for reporting that the 4.3 versions install under Ubuntu 9.10.
If you plan on cross compiling non-kernel code also add the following:
sudo apt-get install linux-libc-dev-armel-cross
(Thanks to Doug Gilbert for this one.)