Gentoo ARM Cross Compile Overlay

This is an effort to create an overlay to support cross compiling Gentoo for the ARM target (beagleboard/overo/openmoko etc ) and also provide a binary repo of the packages that have already been cross compiled for ARMv7a architecture. I have also started tracking the Openembedded Kernel i.e linux-omap-2.6 Kernel + OE patches in a git repository.

Repositories

There are three GIT repositories currently.

git://gitorious.org/gentoo-arm-overlay/gentoo-arm-overlay.git

gentoo-arm-overlay contains the Gentoo Portage Overlay. This is the required repository (that layman will setup for you below).

git://gitorious.org/gentoo-arm-overlay/gentoo-omap-sources.git

gentoo-omap-sources tracks the Kernel.org linux-omap-2.6.git kernel and has branches that track the OpenEmbedded patchset. You dont need to directly use this repository. Just emerge omap-sources once you get the overlay setup with layman and you will get the sources from here.

git://gitorious.org/gentoo-arm-overlay/gentoo-armv7a-binaries.git

This is a convenience repository that contains all the armv7a binaries in tbz2 format.

Just add

PORTAGE_BINHOST="/path/to/checkedout/gentoo-armv7a-binaries.git"

to your make.conf and you will be able to emerge all the prebuilt packages with the -K flag to emerge.

Setting up you Environment

emerge -av git layman crossdev crossdev-wrappers

layman -L   

should show you a “gentoo-arm” overlay.

layman -a gentoo-arm

Now you should be able to use the overlay. Setup your crossdev environment with:

crossdev -t armv7a-softfloat-linux-gnueabi

The above example is for an OMAP3xxx processor (ARM Cortex A8). Replace with your ARM architecture or just arm- for generic ARM. Check here for other architectures link. Once the above command completes (it sets up your cross compile toolchain etc).

emerge-wrapper --init

This sets up your /usr/armv7a-softfloat-linux-gnueabi/ . All the packages you emerge will now go here, and this will be your root filesystem. Remember there will be some files copied in by default. This requires you to set FEATURES=“-collision-protect” in your make.conf file. These files are technically not needed if you emerge the virtual/os-headers and glibc as the first packages along with baselayout. (YMMV).

Link your /usr/armv7a-softfloat-linux-gnueabi/etc/make.profile to /usr/local/portage/layman/gentoo-arm/profiles/default/linux/arm/10.0/beagle/minimal. This step is optional. You may be able to use the default/linux/arm/10.0/ profile too, however it may pull in a lot more packages. Edit the /usr/armv7a-softfloat-linux-gnueabi/etc/make.conf file to include MARCH_TUNE=“-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp” and add -ftree-vectorize to your CFLAGS for maximum benefit.

USE="build" emerge-armv7a-softloat-linux-gnueabi -1v baselayout

There is a patch in the overlay to create the required dev nodes. By default baselayout2 doesnt seem to create it.

emerge-armv7a-softloat-linux-gnueabi system

emerge-armv7a-softloat-linux-gnueabi baselayout

Now you should have a cross compiled root filesystem by now.

Kernel

emerge-armv7a-softloat-linux-gnueabi omap-sources

This should emerge the latest Openembedded Kernel into your /usr/armv7a-softfloat-linux-gnueabi/usr/src directory.

You should be able to build the kernel with

make distclean
make omap3_beagle_defconfig  
make menuconfig   
make uImage

If you want to use a particular compiler you can specify ARCH=arm and CROSS_COMPILE=armv7a-softloat-linux-gnueabi- to the above commands. You should now have your Gentoo kernel and root filesystem ready to go

Install

Look here for how to load it onto Beagleboard link

Contribute

If you find any packages that dont cross-compile or other issues you have fixed feel free to clone the repository on Gitorious. Commit/Push your changes up and request a Merge. Also open a bug with Gentoo bugzilla to make sure your patch is tracked. Hopefully someday soon we will be able to cross compile all our packages.

Have fun with Gentoo on your ARM board

Prior Work

This is based on work done by others such as the openmoko overlay link link and other efforts at IRC #gentoo-embedded and gentoo-pandora link. The kernel is currently leveraged from OE link which has the best OMAP support (kernel.org + patches).

IRC

IRC #gentoo-embedded and #gentoo-pandora