On this Page
To update the u-boot, Linux kernel and root file system images in NAND on your Overo COM, start with a bootable microSD card and follow the instructions in the Write Images to Flash section. If you need to create your own bootable microSD card, follow instructions to create a bootable microSD card step in the Getting Started Guide.
- You can also use these images to boot from NAND. When writing to NAND, keep in mind the size limitations of the NAND roofs partition. In particular you will need to use omap3-desktop-nand-image rather than omap3-desktop-image.
If you just want to add some more software to your current image, check out the Add Software Package on the opkg package manager section.
Introduction to Cross Compilation
The following information explains how to set up a basic cross-compilation environment. These instructions are given for a Debian-based host system; however, they are similar for other Linux OS distributions.
- If you need a customized root filesystem, or need to compile packages that have many dependencies, see the How To explaining the OpenEmbedded Build System.
- If you need to rapidly iterate in developing a small piece of C/C++ code, check out the guide to native compilation on a Gumstix COM.
Cross Compilation Steps
Cross-Compiling the Linux Kernel
First, we explain how to cross-compile just the Linux kernel and run it on your Gumstix device without using a full build system.
Getting the Cross-Compiler
First, we need to get the cross-compiler. From Debian, Ubuntu, or Mint, use the following command:
sudo apt-get install gcc-arm-linux-gnueabi uboot-mkimage
Getting the Kernel Source Code
Next, we need to download the kernel source code, follow the steps under Compile from Source Code on this page.
Building the Kernel
Next you will need to get a default configuration (defconfig) for your architecture. We recommend you use the same defconfig Gumstix uses in its Yocto Project builds. Currently you can find this at:
https://github.com/gumstix/meta-gumstix/tree/dylan/recipes-kernel/linux
From these files, select the kernel version you are using, then your platform, and finally download the file defconfig. (E.g., for DuoVero, you will need the file https://github.com/gumstix/meta-gumstix/blob/dylan/recipes-kernel/linux/linux-gumstix-3.6/duovero/defconfig).
Rename this file to _defconfig (i.e., for DuoVero, rename it duovero_defconfig) and move it to the arch/arm/configs subdirectory in your kernel working directory. Overwrite anything already there.
You can now run the configuration. Replace _defconfig with the name of the file you renamed in the last step:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- _defconfig
Then configure the kernel to your needs:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig
Compile it:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage -j4
Replace the -j4 option with however many threads you want GNU make to utilize. Usually using twice as many threads as CPU cores available is good practice. When finished, the uImage kernel file can be found in the arch/arm/boot directory.
Kernel modules can be similarly compiled:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j4
The following command would then install these modules to a preformatted microSD card where the root file system is mounted at /media/rootfs. Run depmod on the gumstix to make sure these new modules can be found.
sudo INSTALL_MOD_PATH=/media/rootfs make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install
Testing the Kernel on Physical Hardware
You can use your custom uImage with the guide here: Create a Bootable MicroSD Card under Getting Started Guide.
Grab any binary files that you don't build yourself from the downloads page section for Yocto Project.
You may want to write a script that copies over the kernel automatically each time you build. If your kernel doesn't load, try using an earlier version. If you can't login or the image freezes, try using a different rootfs.
Testing the Kernel on Emulated Hardware (Qemu)
If you want to test the kernel without access to physical hardware, you can emulate the system using Qemu. You can make images for Qemu using this script: http://wiki.gumstix.org/index.php?title=Overo_qemu_script. You use it like this:
# assemble-image.sh $OVEROTOP/overo.img $OEDONE/MLO-overo $OEDONE/u-boot-overo.bin $OEDONE/uImage-overo.bin $OEDONE/omap3-console-image-overo.tar.bz2
Again, use a combination of your custom files and prebuilt binaries from cumulus.
To run qemu, install it (see https://launchpad.net/qemu-linaro/ for details), and then run the following command:
qemu-system-arm -M overo -m 256 -sd ./overo.img -clock unix -serial stdio -device usb-mouse -device usb-kbd
If the qemu version you're using doesn't support the overo, try using qemu-linaro (https://launchpad.net/qemu-linaro/)
Note: this section of the page is not yet finished and requires additional content. Thanks for your patience and check back soon.
Useful Links
A common case is building the Linux Kernel. These blogs offer good information and can be a valuable resource:
- Elphel
- BEC (note that the cross-compiler path has changed in recent versions of OE from something like /oe/build/angstrom-2008.1/tmp/cross/armv7a/bin to something like oe/tmp/sysroots/i686-linux/usr/armv7a/bin)
- AO2
Compile Native Code
Developing directly on Gumstix hardware (i.e. native compiling) simplifies small coding projects and projects that require frequent changes.
Likewise, if codes you wish to run on the COM do not have a Bitbake recipe, and you would rather compile directly from the source, try compiling it natively on a COM. This article explains how to install native gcc/g++ on your COMs. Please note that the exact instructions depend on the operating system running on your COM.
For larger projects, you might consider cross-compilation or the OpenEmbedded Cross build system.
Many standard software packages are available using the package manager built-in to your OS; for instructions on the opkg package manager for Angstrom, see this page.
Yocto Project
On Yocto Project images, you can use the smart package manager to fetch a meta-package consisting of all the necessary components for a C/C++ SDK.
$ smart install packagegroup-core-sdk
Angstrom
On Angstrom, use the built-in
opkg package managment tool to fetch a meta-package consisting of all the necessary components for a C/C++ SDK. Users are advised not to manually install gcc, libgcc etc. as resolving the dependencies correctly can be challenging.
$ opkg install task-native-sdk
Ubuntu
For Ubuntu users, we recommend using the package manager to install the 'build-essential' meta-package consisting of all the necessary components for a C/C++ SDK.
$ sudo apt-get install build-essential
Android
Android ships with a stripped-down version of libc called bionic. While it is theoretically possible to natively compile on Android, the Android build system and the ADB tool make it easy to rapidly cross-compile, deploy and test your source code from your host machine. More information can be found at
source.android.com
Test with Hello World and Kernel Module Sample
Note: When doing native development, users may consider using a GNOME image produced by Steve Sakoman. It comes with an environment similar to a typical linux desktop distribution and the SDK is pre-installed.
With a compiler installed, we can write some test code.
C++ Hello World Sample
Try the familiar Hello World as a sample C++ program to test our new compiler.
Begin by creating a new file, hello.cpp, with the following content:
#include <iostream>
using namespace std;
int main() {
cout << "Gumstix can natively compile C++" << endl;
return 0;
}
Now, from the console, compile and test your code.
$ g++ -o hello hello.cpp
$ ./hello
Gumstix can natively compile C++
Kernel Module Sample
We can also download C code and directly compile a kernel module to insert into our running system; your COM needs to be connected to the internet and your kernel should support loadable modules (you would know if you changed from this default). Let's compile Dave Hylands's GPIO event driver so we can test it by toggling an LED.
Begin by downloading the code and installing the required linux-headers using your package manager.
$ wget http://svn.hylands.org/linux/gpio-event/module/gpio-event-drv.c
$ wget http://svn.hylands.org/linux/gpio-event/module/gpio-event-drv.h
Angstrom:
$ opkg install kernel-headers
Ubuntu:
$ sudo apt-get install linux-libc-dev
Now, we can compile this code and load it into our kernel:
$ make -C /usr/linux -M=`pwd` modules
$ insmod gpio-drv.ko
You have now installed a new kernel module. Test it by using the module to toggle the GPIO 12 line. With many expansion boards, this will flash the blue LED, but failing this, probe the line on the 40-pin header with a multimeter or an oscilloscope.
Notes
If you prefer using other languages such as Python this guide may be useful. It is possible to build substantial projects such as the Linux kernel natively, however it can be slow compared to cross-compilation. Another option is to use DistCC to distribute compile jobs across multiple computers. Using a stagecoach board, for example, offers a significant boost in speed.
Compile Code from Kernel and Boot Loader from Source Code
All software for Gumstix COMs is freely available and open source. Gumstix also makes available the complete build system used to generate our release images and package repository.
Linux Kernel
The most up-to-date kernel source for the Overo in this
tree:
$ git clone git://github.com/gumstix/linux.git
Currently, Overo users are recommended to use the omap-3.2 branch. Support for DuoVero COMs is under development in the omap-3.6 branch.
Build Kernel
This article explains how to build the Gumstix Linux kernel from source.
Ubuntu:
The tool chain is already in the Ubuntu repository.
$ sudo apt-get install gcc-arm-linux-gnueabi
Debian:
Emdebian provide the toolchain in their Debian repository. Add the following line to your sources.list file.
deb http://www.emdebian.org/debian/ squeeze main
Don't forget to update before the install.
$ apt-get update
$ apt-get install gcc-4.4-arm-linux-gnueabi
g++ is available as well.
$ apt-get install gobjc++-4.4-arm-linux-gnueabi
You will also need the U-boot 'mkimage' utility. Debian and Ubuntu users can install it from their respective repositories. It's also compiled when U-boot is built if you can't get it otherwise. On top of that you will need 'git' and 'make'.
$ sudo apt-get install uboot-mkimage git make
Next we need to get the patched kernel source that's available at www.sakoman.com. You can browse Sakoman's git repository here.
Decide where you want your kernel source to go an move to that directory. Then use git to download it.
$ git clone git://github.com/gumstix/linux.git -b omap-3.2
The above command pulls down the omap-3.2 branch. The omap-2.6.38 branch has proved stable for those who want to use Xenomai. Once the above process is complete move into the new directory. The first thing to do is to create a .config file.
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- omap2plus_defconfig (or maybe omap3_defconfig)
If you need to configure the kernel:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig
And now for the main Kernel build.
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage -j4
When the above completes, uImage can be found in arch/arm/boot/
Build the kernel modules.
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j4
To install your kernel modules into your root file system:
$ make ARCH=arm modules_install INSTALL_MOD_PATH=/path-to-your-rootfs/
u-boot
The u-boot repository is available at:
$ git clone git://github.com/gumstix/u-boot.git
Decide where you want your u-boot source to go an move to that directory. Then use git to download it.
$ git clone git://github.com/gumstix/u-boot.git -b omap-v2012.10
The omap-v2012.10 branch is known to be the most stable at the time of writing. Once the above process is complete move into the new directory. Then configure the u-boot:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- omap3_overo_config
Now we can build u-boot:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- all
If it was successful, you will see MLO, u-boot.bin and u-boot.img in your u-boot directory.
For Overo, use the omap3_overo configuration.
Support for DuoVero is under development here git://www.sakoman.com/git/u-boot.git in the upstream branch.
x-load
X-load has been superseded by the SPL bootloader built out of the u-boot code base.
Yocto Project
Gumstix uses the Yocto Project build system. While it is certainly possible to use other methods to build the boot loaders, kernel, and root file systems, we've found Yocto Project to be an attractive solution. Please see the Bitbake and Yocto Project section of this
page on the Yocto project for more information about the Gumstix meta layer.
Compile from Source Code
Linux Kernel
The most up-to-date kernel source for Gumstix hardware platforms is in this
repository. You have two options for this:
Cloning the Entire Linux Kernel git Repository
This option will download the entire source code for the Linux kernel's mainline branch, as well as branches specific to Gumstix processors. Make sure you have git installed and type the following lines:
git clone git://github.com/gumstix/linux.git
cd linux
Then, check out the branch for the kernel best suited to your hardware:
Platform |
Kernel Version |
Command |
DuoVero |
3.6 |
git checkout omap-3.6 |
Overo |
3.5 |
git checkout omap-3.5 |
Pepper |
3.2 |
git checkout am335x-3.2 |
Verdex Pro |
2.6 |
git checkout omap-2.6.37 |
Download an Archive for a Branch
This option is quicker because it does not download the entire history of the git tree. It is particularly useful when you just need the files to get up and running. To download an archive for a branch, visit one of the following URLs:
Platform |
Kernel Version |
URL |
DuoVero |
3.6 |
https://github.com/gumstix/linux/archive/omap-3.6.zip |
Overo |
3.5 |
https://github.com/gumstix/linux/archive/omap-3.5.zip |
Pepper |
3.2 |
https://github.com/gumstix/linux/archive/am335x-3.2.zip |
Verdex Pro |
2.6 |
https://github.com/gumstix/linux/archive/omap-2.6.37.zip |
Das U-Boot
The u-boot repository is available at:
$ git clone git://github.com/gumstix/u-boot.git
For Overo, use the omap3_overo configuration. Problem reports and patches should be submitted via the u-boot mailing list:
Support for DuoVero is under development here git://www.sakoman.com/git/u-boot.git in the upstream branch.
The upstream repository is git://git.denx.de/u-boot.git
Yocto Project
Gumstix uses the Yocto Project build system. While it is certainly possible to use other methods to build the boot loaders, kernel, and root file systems, we've found Yocto Project to be an attractive solution. Please see the Bitbake and Yocto Project section of this
page on the Yocto project for more information about the Gumstix meta layer.
x-load
Note: X-load has been superseded by the SPL bootloader, which is built alongside U-Boot from its code base. The following information is intended for users who specifically require X-load for use with an older version of U-Boot.
The x-load git repository is available at:
$ git clone http://gitorious.org/x-loader/x-loader.git