====== Cross-compilation of XBMC-RBP on Arch linux ARM ====== ===== What ? ===== This wiki will explain the steps I have followed to cross-compile the [[http://www.raspberrypi.org/|rasbperrypi]]-optimzed xbmc named [[https://github.com/xbmc/xbmc-rbp|xbmc-rbp]]. The compilation is done from an x86 computer and will generate arm binaries suitable for Raspberry Pi. All the process is oriented for the generation of a [[http://archlinuxarm.org/|Arch Linux ARM]] package. The Arch Linux ARM distribution for Raspberry Pi can be found on the [[http://www.raspberrypi.org/downloads|Raspberry Pi download page]] ===== Why ? ===== In fact, a PKGBUILD for xbmc-rbp is already available in [[http://aur.archlinux.org/packages.php?ID=60530|AUR]]. This package is, as far as I know, fully functionnal « but » it respects [[http://archlinuxarm.org/developers/distcc-cross-compiling|Arch Linux ARM official way of generating package]] that is compiling directly on the target device, eventually with the help of [[http://en.wikipedia.org/wiki/Distcc|distcc]] to distribute the work, even on x86 computer. The former method has the advantage that all the preprocessing is done on the target system, with target include/libraries/… which is much more simple, but the compilation of XBMC on the Rasperry Pi is long and painful. You need for example an extra swap space. The method explained here will do all the compilation on the x86 computer but will need to access the root system of the Rasbperry Pi for the libraries and include of extern libraries. This is accomplished by for example mounting the sd card of the Raspberry Pi on the computer. ===== How ? ===== ==== Cross-compilation toolchain ==== The first thing to do is to have a correct toolchain for cross-compiling. With [[http://crosstool-ng.org/|crosstool-ng]] it is no more pain. Just follow the instructions on the toolchain instructions on the [[http://archlinuxarm.org/developers/distcc-cross-compiling|Arch Linux ARMDistcc Cross-Compiling guide]]. For the Rasberry Pi, the armv5 are needed. The pre-built toolchains for x86_64 work like a charm. ==== Preparing target system ==== On your Arch Linux Rasperry Pi, install the following packages to have includes and libs for the compilation. pacman -S hicolor-icon-theme fribidi lzo2 smbclient libtiff libpng libcdio yajl libmysqlclient libjpeg-turbo \ libsamplerate libssh libmicrohttpd python2 libass libmpeg2 libmad libmodplug rtmpdump unzip xorg-xdpyinfo \ libbluray libnfs afpfs-ng libshairport avahi bluez jasper tinyxml raspberrypi-firmware boost ==== Mouting target system ==== As explained in the [[xbmc-rpb_arch#why_?|Why section]], the target system must be accesible. For the moment, I have only tested by mounting the root partition of the Raspberry Pi SD on the compiler. ==== Building ==== Here you can find my [[http://www.xouillet.info/arch/xbmc-rbp/PKGBUILD|PKGBUILD]]. As you can tell, it is heavily base on the [[http://aur.archlinux.org/packages.php?ID=60530|xbmc-rbp-git]] packet on AUR. I don't distribute it on AUR as it has no sense to be built and installed on the same platform. $ mkdir xbmc-rbp-git $ wget http://www.xouillet.info/arch/xbmc-rbp/PKGBUILD You need to modify the following variables : * **_target** : Point to the target filesystem * **_toolchain** : Point to the toolchain And then… $ makepkg -Ad … After approximately 20 min on a Intel i5 2500K … ==> Création finie : xbmc-rbp-git 20120714-1 (sam. juil. 14 14:11:57 CEST 2012) Then copy the **xbmc-rbp-git-20120714-1-x86_64.pkg.tar.xz** package on your Raspberry Pi, install it via pacman --arch=x86_64 -U xbmc-rbp-git-20120714-1-x86_64.pkg.tar.xz Start with xbmc And enjoy ! ==== Post scriptum ==== The architecture hack (makepkg -A and pacman --arch) is a bit dirty, but I can't find a way to build cross-compiled ArchLinux package in a nice way. If someone is aware of that, please mail me (my address is in the PKGBUILD). ===== Troubleshoots with XBMC ===== XBMC-RBP works fine, very fine once installed, video are read fluenty, menus are quite fluent. Some bugs still appears, I will list then and their workaround as I find them. * Screen flashes : when reading video, some blank screen appears. This can be removed with the workaround found [[http://archlinuxarm.org/forum/viewtopic.php?f=31&t=3004&start=60#p18411|here]]. It consists to add before running xbmc : /opt/vc/bin/tvservice -o /opt/vc/bin/tvservice -p xbmc Warning thought : It will blank your console, so the only access to your RPi will be via ssh.