= Set up a cross-build machine for the Raspberry Pi = == Prerequisites == This document focuses on Debian hosts. Debian derivatives such as Ubuntu should work with minor changes. == Downloads == * Download the [https://github.com/raspberrypi/firmware/downloads firmware] (.tar.gz) * Download the [https://github.com/raspberrypi/tools/downloads build tools] (.tar.gz) Alternatively, these can be retrieved using Git. Unpack them in two directories called `firmware` and `tools`. == Environment variables == * Set `RASPI_SDK_ROOT` to the directory containing `firmware` and `tools`. * Add the following directory to `PATH`: {{{ #!sh $RASPI_SDK_ROOT/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin }}} == Building autoconf projects == For simple autoconf projects (using `./configure ; make`) the following command can now be used: {{{ #!sh RASPI_INCLUDES="$RASPI_SDK_ROOT/firmware/opt/vc/include" RASPI_LIBS="$RASPI_SDK_ROOT/firmware/opt/vc/lib" ./configure --host=arm-bcm2708hardfp-linux-gnueabi \ CPPFLAGS="-I$RASPI_INCLUDES -I$RASPI_INCLUDES/interface/vcos/pthreads" \ LDFLAGS="-L$RASPI_LIBS" make }}} == Using Debian / Raspbian libraries == Choose a directory to store Raspbian packages, for instance `$RASPI_SDK_ROOT/chroot`. You can then use `debootstrap` to install packages to it, but if you have a multiarch-enabled system you can use this poor man's shell script: {{{ #!sh raspi-install () { for pkg in "$@" do apt-get download "$pkg":armhf \ && dpkg-deb -x "$pkg"_*.deb $RASPI_SDK_ROOT/chroot \ && rm -f "$pkg"_*_armhf.deb done } }}} Then for ''eg.'' SDL: {{{ #!sh raspi-install libsdl1.2debian libsdl1.2-dev }}} Then add the following to `CPPFLAGS` in the configure line: {{{ #!sh -I$RASPI_SDK_ROOT/root/usr/include }}} And the following to `LDFLAGS`: {{{ #!sh -L$RASPI_SDK_ROOT/chroot/lib/arm-linux-gnueabihf -Wl,-rpath-link -Wl,$RASPI_SDK_ROOT/chroot/lib/arm-linux-gnueabihf -L$RASPI_SDK_ROOT/chroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link -Wl,$RASPI_SDK_ROOT/chroot/usr/lib/arm-linux-gnueabihf -Wl,--unresolved-symbols=ignore-in-shared-libs }}} == Bitten configuration == For Lol Engine autobuilders, add the following section to the bitten machine file: {{{ #!ini [raspi] version = 0 }}}