Cross-compiling for the OSWALD using Gentoo

Gentoo provides a nice setup for cross-compiling software for various target architectures including ARM, which the OSWALD uses. This page outlines the basic instructions necessary for an experienced Gentoo user to get a working cross-compiler that can build binaries for the OSWALD. For the official Gentoo embedded documentation see the Gentoo Embedded Handbook.

Install crossdev

First, install the crossdev package.

Building a cross-compiling toolchain

Next, use crossdev to build a cross-compile toolchain for the OSWALD. This can be using the following command:

sudo crossdev -t armv7a-softfloat-linux-gnueabi

By default, crossdev will use the latest stable versions of the toolchain packages. If this does not work, you should manually select which versions to use for the various toolchain packages -- use the help output from crossdev to figure out how to do this.

Cross-compiling with portage

If crossdev successfully built a cross-compile toolchain, it should be located in the /usr/armv7a-softfloat-linux-gnueabi directory. In order to use the cross-compiler it is easiest to use some wrapper scripts provided by the crossdev-wrappers package that setup the necessary environment variables. Therefore, install crossdev-wrappers and it should automatically initialize the armv7a-softfloat-linux-gnueabi cross-compile toolchain.

Now you should be able to use either of the following commands

emerge-wrapper --target armv7a-softfloat-linux-gnueabi <emerge options>

or

emerge-armv7a-softfloat-linux-gnueabi

to cross-compile packages using portage.

Also, the various compilers can be manually running using by prefixing the command with the CTARGET. For example,

armv7a-softfloat-linux-gnueabi-gcc

should invoke the selected gcc compiler for the armv7a-softfloat-linux-gnueabi cross-compile toolchain.