cross-compiling for the SheevaPlug (kernel, distcc)

Compiling on the SheevaPlug can take long but is not neccessary if you have already your desktop pc running (which will be referred to as “workstation”). Unfortunately it will most probably not being run by an ARM processor, therefore you have cross-compile for the plug.
In this post I describe how to install a recent GCC version for cross-compiling, how to compile the latest kernel for the plug and how to enable distributed cross-compiling. By the latter you invoke compiling commands on the SheevaPlug and they will be executed by another machine transparently.
My workstation runs Gentoo Linux and listens on 192.168.1.6; the SheevaPlug runs Gentoo, too. By command emerge packages are installed, therefore if you used Debian you have to replace that call by apt-get and find out appropriate package names.
Install crossdev and setup a cross-compiling suite for the armv5tel-softfloat-linux-gnueabi architecture, which powers the SheevaPlug:
emerge portage-utils crossdev dev-embedded/u-boot-tools crossdev armv5tel-softfloat-linux-gnueabi
This will take long as the latest GCC, binutils and the such will be compiled from scratch for the SheevaPlug.
- After having done that fetch kernel sources and review the default configuration for the plug shipped with it:
emerge --oneshot >=sys-kernel/gentoo-sources-2.6.31 # or >=sys-kernel/vanilla-sources-2.6.31 cd /usr/src/linux make ARCH=arm kirkwood_defconfig menuconfig
Starting from Linux 2.6.31 all patches for the SheevaPlug are included in the main tree, therefore you can virtually use every kernel flavour since that.
- In a hurry? You can download my kernel configuration file here.
- After configuration you will have to compile the kernel into an uImage:
make -j4 ARCH=arm CROSS_COMPILE=armv5tel-softfloat-linux-gnueabi- uImage
- If you enabled dynamic module loading, you will have to compile modules as well. I did it, so here are the commands:
make -j4 ARCH=arm CROSS_COMPILE=armv5tel-softfloat-linux-gnueabi- modules make -j4 ARCH=arm CROSS_COMPILE=armv5tel-softfloat-linux-gnueabi- INSTALL_MOD_PATH=.. modules_install
It is very important to set
INSTALL_MOD_PATH, or modules will be installed at your workstation. We want them in a separate folder for they will be copied to where they belong – the SheevaPlug.
The kernel should be compiled by now. Therefore log into your SheevaPlug and copy kernel and modules to it:
scp 192.168.1.6://usr/src/linux-2.6.31-gentoo/arch/arm/boot/uImage /boot/uImage-2.6.31-gentoo-mark rsync -azuv -e ssh 192.168.1.6://usr/src/lib/modules /lib/ cat /boot/uImage-2.6.31-gentoo-mark > /dev/mtdblock1
The latter command will write the new kernel into the plug’s flash. You could leave that command out and have the kernel loaded from SD card or external USB drive, but it supports more USB devices (such as hubs) than your plug’s booting system. Consequently loading it from flash means less trouble in future.
Reboot your plug, smile. Cross-compiling has not been that hard. For your convenience, here’s my compiled kernel and modules for download. It includes iptables and samba support.
Setting up distributed cross-compiling is even easier. Do this on your workstation:
emerge distcc nano /etc/conf.d/distccd # add allow=192.168.1.0/24 nano /etc/distcc/hosts # add localhost, don't add the sheevaplug! no work shall be distributed to it /etc/init.d/distccd start rc-update add distccd default
That’s all for the workstation. We will make sure armv5tel-softfloat-linux-gnueabi-gcc and the such will be selected automatically.
- Repeat the above step on the SheevaPlug:
emerge distcc # last time we will compile something on the plug alone nano /etc/conf.d/distccd # same subnet, same allow string nano /etc/distcc/hosts # 192.168.1.6/4,lzo -- don't specify localhost here! everything shall be delegated /etc/init.d/distccd start rc-update add distccd default
But wait, that’s not all or calls of gcc will be executed by the wrong compiler on your workstation.
- We have redirect that calls by a wrapper script (copied from this manual):
cd /usr/lib/distcc/bin nano /usr/lib/distcc/bin/arch-wrapper #!/bin/bash exec /usr/lib/distcc/bin/armv5tel-softfloat-linux-gnueabi-g${0:$[-2]} "$@" - Now come the symlinks:
chmod a+x /usr/lib/distcc/bin/arch-wrapper ln -sf arch-wrapper c++ ln -sf arch-wrapper cc ln -sf arch-wrapper gcc ln -sf arch-wrapper g++
Voila! Compiling will happen at your workstation, even if you invoked emerge on the plug.
Just make sure workstation and SheevaPlug use the same GCC version.














That’s how you can do distributed cross-compiling for any other architectures.
Just crossdev something other replace
armv5tel-softfloat-linux-gnueabiappropriately on the target.The workstation can run many cross-compiling suites.
[...] Setup a cross-compiling suite for the SheevaPlug. You can compile the Linux kernel parallel to installing GNU/Gentoo. [...]
please add a note to apply this patch to the kernel:
http://computingplugs.com/index.php/Fixing_SDHC_access_in_the_Orion/Mainline_kernel
because there is a bug in the sdhc handling that make it brutally crash!
Thanks for the pointer! I have already had incorporated that patch in my kernel trees, amongst others for SDHC cards.
Hi I am a new owner of a Sheevaplug (debian 2.6.30.2) and I am trying to use a open source program called MediaInfo – It looks like there is no armv5tel version available so I was thinking of compiling my own… any pointers??
corncrake, if your question was more specific I could help you more.
Given you didn’t replace the Linux distribution on your plug and you only want this program, try to compile it. First, install prerequisities by:
By that you should have everything needed to compile dependencies and the application itself.
If it requires X11 (KDE, Gnome, Fluxbox… any window manager) you will either have to buy an USB attachable display or install VNC and connect from another computer to the SheevaPlug to see the ‘picture’. But then, due to the limited flash storage, better attach an external harddrive and install X11 (…) there.
Perhaps any of my readers knows something similar that runs on console and depends on libmediainfo?