cross-compilation redux

It has been a while since my last blog post about developing for ARM platforms. We last looked at how to cross-compile the kernel. It is time to revisit that recipe.

Linaro

I've been working with Linaro for the last few months to improve the toolchain, kernel and other components of Linux plumbing on ARM. There is also work to refactor the partner BSPs so that they can co-exist peacefully i.e. single kernel source tree, single u-boot tree, etc. We're just getting started but you can see the status for the first Linaro release in November.

Cross-compile toolchains


One of the first things that an embedded project has had to do is roll their own toolchain. This is obviously wasted time and effort. Linaro is attempting to fix this problem by pushing fixes into gcc upstream and by providing a standard toolchain for ARM development. This toolchain will take advantages of features of the ARMv7 architecture (NEON acceleration, various performance optimisations, SMP support, etc.). Some of this work in already available in the next release of Ubuntu (10.10 aka Maverick). Tarballs are available for other distributions.

If you're compiling your software for ARM, you should consider switching to this toolchain.

Cross-compile toolchain for Ubuntu 10.10 aka Maverick

The Toolchain working group at Linaro has made available a gcc-4.4 and gcc-4.5-based cross toolchains. For Maverick, just type the following in your terminal:
  • echo "deb http://people.canonical.com/~hrw/ubuntu-maverick-armel-cross-compilers/ ./" | sudo tee -a /etc/apt/sources.list.d/cross-compile.list
  • sudo apt-get update
  • sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
Cross-compile toolchain for Ubuntu 10.04 LTS aka Lucid
If you're not brave enough to run Maverick beta, the same toolchain can be made to work on Ubuntu 10.04 LTS with some additional steps.
  • Install the maverick versions of two libraries: libmpfr4, libcloog-ppl0
  • Follow the steps for Maverick above
Cross-compiling the Ubuntu Kernel

Time to take the shiny cross-toolchain for a testdrive:
  • git clone git://kernel.ubuntu.com/ubuntu/ubuntu-maverick.git
  • debuild -eCROSS_COMPILE=arm-linux-gnueabi- -b -aarmel
    Unfortunately this command breaks because of perf, I believe. It complains about libelf/libdw missing. I'll try to update with a dpkg-cross command when i get a chance.

Cross-compiling other stuff

And here is how you could use it to compile non-debian packages:
  • make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-


Enjoy!

Comments

Popular posts from this blog

Prolonging the battery life on your laptop/netbook running Ubuntu

Ubuntu on ARM

Speeding up boot on an upgraded system