Ubuntu 12.04 ‘precise’ and cross compilation of ARM kernels

Over year ago I wrote How to cross compile ARM kernel under Ubuntu 10.10 and this became one of most popular posts on my website. It may work still but it is terribly outdated so I decided that it is a time for update.

Users of Ubuntu 12.04 ‘precise’ have much simpler situation when it comes to cross compilation of Linux kernels than ones who use older releases. Everything is now in distribution, we have a lot of packages converted to multiarch so instruction is much shorter.

There are few steps to cross compile Linux kernel under Ubuntu 12.04 ‘precise’ (for “armhf” which is officially supported now):

  • Install cross compiler:

apt-get install gcc-arm-linux-gnueabihf

  • Fetch kernel source:

apt-get source linux-source-3.2.0

  • Install packages required to build kernel:

apt-get build-dep linux-source-3.2.0

  • Build kernel:

cd linux-3.2.0; dpkg-buildpackage -b -aarmhf

And that’s all. Linaro kernels will be as easy to build as Ubuntu one on next days as we have to update packaging to recent Ubuntu version.

15 thoughts on “Ubuntu 12.04 ‘precise’ and cross compilation of ARM kernels”

  1. Thanks for the instructions. With a fresh Beta 1 installation, I had to install dpkg-dev as well, and as I’m logged in as a user, I had to use sudo with apt-get install and apt-get build-dep.

  2. Just a quick note.

    I ran the above and it appears to download linux-3.0.0 not linux-3.2.0 as indicated in the instructions?

    Not sure what the significance of this is?


    1. Then you are under Oneiric (11.10) which does not support armhf. This post is for Precise (12.04) users.

      Check ‘armel’ support with ‘arm-linux-gnueabi’ toolchain.

  3. Just ran the dpkg-buildpackage -b -aarmhf and received the following error:

    make[1]: *** No rule to make target arm-linux-gnueabihf-'. Stop. make[1]: Leaving directory/usr/src/linux-3.0.0/debian/build/tools/tools/perf’ make: *** [/usr/src/linux-3.0.0/debian/stamps/stamp-build-perarch] Error 2 dpkg-buildpackage: error: debian/rules binary gave error exit status 2


    I have installed the gcc-arm-linux-gnueabihf

  4. When you say I am under Oneric 11.10 – I take it that you mean the version of the host server I am using for the cross compilation and not the target device?

    If this is the case then am I correct in understanding that I cannot cross-compile a 12.04 armhf kernel for my Panda Board ES on my host running Ubuntu 11.10.. or am I missing something?


    1. Yes, I mean host machine.

      You can cross compile 12.04 armhf kernel under Ubuntu 11.10 but for this you need to use linux-3.2 package from precise not linux-3.0 one from oneiric.

  5. what is the difference between “gcc-arm-linux-gnueabihf” and “gcc-arm-linux-gnueabi”?

    1. gcc-arm-linux-gnueabihf is for hard-float (better floating point performance) and gcc-arm-linux-gnueabi for soft-float.

      Thinking about it, I’m not sure what’s the difference with using gcc-arm-linux-gnueabi -mhard-float and gcc-arm-linux-gnueabihf

  6. What is the problem when I get this?

    dpkg-architecture: warning: specified GNU system type arm-linux-gnueabihf does not match gcc system type x86_64-linux-gnu, try setting a correct CC

  7. Hi Sir i want to install arm cross compiler arm-linux-gnueabi in ubuntu 11.10 . please post a one post regarding this.

Comments are closed.