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.

Ubuntu 12.04 ‘precise’ and cross compilation of ARM kernels

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

  • 27th March 2012 at 13:42

    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.

  • 12th April 2012 at 03:12

    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?


    • 12th April 2012 at 06:40

      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.

  • 12th April 2012 at 05:10

    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

  • 12th April 2012 at 06:46

    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?


    • 12th April 2012 at 09:36

      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.

  • 2nd May 2012 at 11:51

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

    • 3rd May 2012 at 03:45

      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

  • 23rd May 2012 at 00:38

    Can you use this method to build a uImage for embedded platforms?

    • 23rd May 2012 at 10:23

      Yes, you can use this cross compiler to build kernel for embedded platforms. For uImage support you need to install “u-boot-tools” package.

  • 24th May 2012 at 15:15

    How can I use installed cross compiler for simple scaler?

  • 10th February 2013 at 20:14

    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

  • 19th February 2013 at 08:35

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

    • 19th February 2013 at 22:54

      I do not support Ubuntu older than 13.04. But 11.10 should have “gcc-arm-linux-gnueabi” in repository.

Comments are closed.