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

11
Leave a Reply

avatar
11 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
4 Comment authors
Getting Started with MultiArch (armel / armhf) in Ubuntu | CNXSoft – Embedded Software DevelopmentDemetriscnxsoftNikolay NikolaevSander Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Sander
Guest
Sander

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
Guest
Sander

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 ABB9E055
gpgv: Can’t check signature: public key not found
dpkg-source: warning: failed to verify signature on ./linux-meta_3.0.0.16.19.dsc
dpkg-source: info: extracting linux-meta in linux-meta-3.0.0.16.19
dpkg-source: info: unpacking linux-meta_3.0.0.16.19.tar.gz
[email protected]:~/arm-linux$ ll
total 44
drwxrwxr-x 3 sander sander 4096 2012-03-27 20:58 ./
drwxr-xr-x 136 sander sander 16384 2012-03-27 20:52 ../
drwxrwxr-x 3 sander sander 4096 2011-10-17 21:22 linux-meta-3.0.0.16.19/
-rw-rw-r– 1 sander sander 4487 2012-01-27 10:03 linux-meta_3.0.0.16.19.dsc
-rw-rw-r– 1 sander sander 8316 2012-01-27 10:03 linux-meta_3.0.0.16.19.tar.gz
[email protected]:~/arm-linux$ uname -a
Linux R540 3.0.0-16-generic #29-Ubuntu SMP Tue Feb 14 12:48:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[email protected]:~/arm-linux$

Sander
Guest
Sander

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 (diff) [3,197 kB]
Fetched 99.9 MB in 48s (2,068 kB/s)

Nikolay Nikolaev
Guest
Nikolay Nikolaev

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
Guest
Nikolay Nikolaev

@ 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 just pointed it out so the people know what they are compiling.

Good luck.

Demetris
Guest

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 […]