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:
1 |
sudo apt-get install gcc-arm-linux-gnueabihf dpkg-dev |
- Retrieve the kernel source:
1 |
apt-get source linux-source-3.2.0 |
- Install the packages required to build the Linux kernel:
1 |
sudo apt-get build-dep linux-source-3.2.0 |
- Build the kernel:
1 |
cd linux-3.2.0; dpkg-buildpackage -b -aarmhf |
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:
1 2 3 4 |
ls -l ./debian/build/build-omap/arch/arm/boot: drwxrwxr-x 2 jaufranc jaufranc 4096 Mar 27 22:15 compressed -rwxrwxr-x 1 jaufranc jaufranc 7668532 Mar 27 22:15 Image -rwxrwxr-x 1 jaufranc jaufranc 3728392 Mar 27 22:15 zImage |
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
With the second command, on my Ubuntu 11.10, I get the error message below:
sander@R540:~$ 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
sander@R540:~$
Is Ubuntu 11.10 the reason of this error message, or … ?
A plain “apt-get source linux-source” does something, but does not give the kernel source: just a few bytes. 🙁 sander@R540:~/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 »
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: sander@R540:~/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 »
@ Sander
Those are instructions for ubuntu 12.04, so I’m not sure this will work for Ubuntu 11.10 since there are other instructions for Ubuntu 11.10: http://marcin.juszkiewicz.com.pl/2010/10/19/how-to-cross-compile-arm-kernel-under-ubuntu-10-10/
Anyway, let me know if you can build it successfully on Ubuntu 11.10.
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
My machine is based on Intel Core 2 Duo 4300 with 3GB of memory. Since this processor does not support HW virtualization, only one core is used in VirtualBox. I have 1 GB Memory enabled in Virtual Box. The virtual machine is in an USB harddisk, so I wonder if this may also impact performance.
Do you think using an hard-float compiler would make the compilation last longer?
I have to say, it has never taken me so much time to build a kernel.
@ 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 »
@ Nikolay Nikolaev
Thanks for the advice. I already have Ubuntu installed on the main hard drive (dual boot), but for some reasons I have to use Windows XP most of the time.
I found the performance in VirtualBox is very similar to native performance. The main problem is that I lose one core, so it is probably the main reason it increases build times.
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?
@ Demetris
Some people already have made a basic Ubuntu boot from SD card on the nook – http://forum.xda-developers.com/showthread.php?t=1470910
For WiFi, Touch controller and LCD Panel, you would need to find the drivers either in source code or binary form, as well as installing a few packages to enable it.