Cross-compiling the ARM Linux Kernel in Ubuntu 12.04 LTS

Yesterday I installed Ubuntu 12.04 ‘Precise’ Beta 1 in Virtual Box to give it a try (I could not manage to have HUD working btw), and today, I’ve noticed an article entitled “Ubuntu 12.04 ‘precise’ and cross compilation of ARM kernels” explaining how to build Linaro ARM kernel in Ubuntu 12.04. So I’ve decided to give it a try, especially it seems straightforward. I followed the instructions in the aforementioned link,  it basically worked except I had to install dpkg-dev package that also installed the build essentials (gcc, g++, etc…) and use sudo for some commands.

You’ll notice the name change for the ARM gcc toolchain as it now uses hard-float by default which seems to provide quite a boost in performance for the Pandaboard.

Here are the steps I followed:

  • Install the ARM GCC cross compiler and the development package of dpkg:

  • Retrieve the kernel source:

  • Install the packages required to build the Linux kernel:

  • Build the kernel:

That’s it. The build took an awful lot of time (5 to 6 hours) in my machine as many features and modules (2288) are enabled. The binary images (presumably for TI OMAP 4) are located in ./debian/build/build-omap/arch/arm/boot:

Support CNX Software - Donate via PayPal or become a Patron on Patreon
Advertisements
Subscribe
Notify of
guest
11 Comments
oldest
newest most voted
Sander
Sander
8 years ago

With the second command, on my Ubuntu 11.10, I get the error message below:

[email protected]:~$ apt-get source linux-source-3.2.0
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to find a source package for linux-source-3.2.0
[email protected]:~$

Is Ubuntu 11.10 the reason of this error message, or … ?

Sander
Sander
8 years ago

A plain “apt-get source linux-source” does something, but does not give the kernel source: just a few bytes. 🙁 [email protected]:~/arm-linux$ apt-get source linux-source Reading package lists… Done Building dependency tree Reading state information… Done Picking ‘linux-meta’ as source package instead of ‘linux-source’ NOTICE: ‘linux-meta’ packaging is maintained in the ‘Git’ version control system at: http://kernel.ubuntu.com/git-repos/ubuntu/ubuntu-karmic-meta.git Need to get 12.8 kB of source archives. Get:1 http://nl.archive.ubuntu.com/ubuntu/ oneiric-updates/main linux-meta 3.0.0.16.19 (dsc) [4,487 B] Get:2 http://nl.archive.ubuntu.com/ubuntu/ oneiric-updates/main linux-meta 3.0.0.16.19 (tar) [8,316 B] Fetched 12.8 kB in 0s (62.0 kB/s) gpgv: Signature made Wed 25 Jan 2012 06:58:06 PM CET using RSA key ID… Read more »

Sander
Sander
8 years ago

Ah, I think I found it: it looks like you can get the source version that’s running on your Ubuntu (which you can check with uname -a) . So on my Ubuntu 11.10 that’s 3.0.0: [email protected]:~/arm-linux$ apt-get source linux-source-3.0.0 Reading package lists… Done Building dependency tree Reading state information… Done Picking ‘linux’ as source package instead of ‘linux-source-3.0.0’ NOTICE: ‘linux’ packaging is maintained in the ‘Git’ version control system at: http://kernel.ubuntu.com/git-repos/ubuntu/ubuntu-oneiric.git Need to get 99.9 MB of source archives. Get:1 http://nl.archive.ubuntu.com/ubuntu/ oneiric-updates/main linux 3.0.0-16.29 (dsc) [10.6 kB] Get:2 http://nl.archive.ubuntu.com/ubuntu/ oneiric-updates/main linux 3.0.0-16.29 (tar) [96.7 MB] Get:3 http://nl.archive.ubuntu.com/ubuntu/ oneiric-updates/main linux 3.0.0-16.29… Read more »

Nikolay Nikolaev
Nikolay Nikolaev
8 years ago

What is your machine? 5-6 hours looks a lot!

What google says:
“Try tmpfs. It enables you to mount any folder in your file system in RAM, so theoretically speeding up the compilation. Try mounting your build folder with tmpfs like this $sudo mount -t tmpfs -o size=500M,mode=0777 tmpfs /usr/src/linux-build.”

Also you surely noticed that this is building a Hard Float ABI kernel. If you aim for a regular kernel just remove the ‘hf’ suffix in the related commands.
Here’s an explanation of what HF is:
http://wiki.debian.org/ArmHardFloatPort

Nikolay Nikolaev
Nikolay Nikolaev
8 years ago

@ cnxsoft You cross-compile in a virtual machine on a USB harddisk … wow 🙂 And you don’t have the virt extensions on your CPU. I can suggest you to try to partition the USB disk and install Linux (Ubuntu) on the second partition. Than you’ll have all your 3GB at the disposal of Linux. So you can do the tmpfs trick like that: mkdir /cross-compile sudo mount -t tmpfs -o size=1500M,mode=0777 tmpfs /cross-compile cd /cross-compile apt-get source linux-source-3.2.0 cd linux-3.2.0; dpkg-buildpackage -b -aarm And no – the HF has nothing to do with the speed of the compilation. I… Read more »

Demetris
Demetris
8 years ago

Am trying to build for Nook Tablet 7 inch TI4430.
I need some help to boot from sd card.
How i implement wifi,touch controller,and lcd panel?

trackback

[…] retrieve the source and build the chromium-browser for ARM.I’ve already used this method when building the Linux ARM kernel on Ubuntu 12.04. (function(){var […]

Advertisements