XBMC for Linux on AllWinner A10 Devices? It Works! (Sort of)

Following the lack of support by AllWinner for the video engine libraries (CedarX), I had more or less given up on hope XBMC for Linux would ever run properly on AllWinner A10/A13 hardware. But recently, I found out some progress had been made using existing libs, and saw the Pengpod Tablet video showing XBMC running in Linux fairly smoothly.

So I decided to cross-compile XBMC by following the instructions available at http://linux-sunxi.org/XBMC and trying to run it in Linaro ALIP 12.04 rootfs in my Mele A1000. Finally, I managed to cross-compile XBMC, but the performance was very poor in the GUI (6 to 12 fps) and I was unable to play videos and my serial console was flooded with messages like:

[DISP] not supported image0 pixel sequence:216 in img_sw_para_to_reg

But Jasbir managed to get XBMC armhf running the the Hackberry using an Ubuntu 12.10 armhf image by “Guillaume” and natively compiling XBMC in the Hackberry board. Alternatively, if you’ve got an armel rootfs, you could try xbmca10.deb by Neal Peacock (the person behing the Pengpod Linux tablets).

In this post, I’ll still describe the steps I followed to build and run XBMC in Linaro ALIP rootfs (and hopefully I’ll eventually find the reason behind the performance issue),  ans show Jasbir results with XBMC armhf on the Hackberry.

XBMC ARMHF Build Instructions

Since we want to run XBMC armhf, we’ll first need a Linux image with an armhf rootfs. I’ll use Lianro ALIP 12.10 rootfs, following the hardware packs instructions. Insert an SD card in the build machine, and make it bootable:

wget https://raw.github.com/cnxsoft/a10-tools/master/a1x-media-create.sh
wget http://dl.linux-sunxi.org/nightly/latest/mele-a1000-vga_hwpack_2012.11.06.7z
wget http://releases.linaro.org/12.10/ubuntu/precise-images/alip/linaro-precise-alip-20121021-453.tar.gz
sudo ./a1x-media-create.sh /dev/sdb mele-a1000-vga_hwpack_2012.11.06.7z linaro-precise-alip-20121021-453.tar.gz

Now remove the SD card from the build build, and insert it in the Mele A100 (or another A10 devices) to install dependencies to build XBMC:

sudo apt-get build-dep xbmc
sudo apt-get install swig default-jre cmake libgtk2.0-bin libssh-dev
sudo apt-get remove libegl1-mesa libegl1-mesa-dev libegl1-mesa-drivers libgles2-mesa libgles2-mesa-dev
sync

Now back to the build machine. Checkout XBMC source code:

mkdir xbmc-linux
cd xbmc-linux
git clone git://github.com/empatzero/xbmca10.git

and extract the image from the SD card and mount the rootfs:

sudo dd if=/dev/sdb2 of=rootfs_xbmc.img
mkdir rootfs
sudo mount -o loop rootfs_xbmc.img rootfs

Create symlinks to the mounted libraries (requires full path):

sudo ln -s /home/jaufranc/edev/mele_a1000/xbmc-linux/rootfs/lib/arm-linux-gnueabihf /lib/arm-linux-gnueabihf
sudo ln -s /home/jaufranc/edev/mele_a1000/xbmc-linux/rootfs/usr/lib/arm-linux-gnueabihf /usr/lib/arm-linux-gnueabihf
sudo ln -s /home/jaufranc/edev/mele_a1000/xbmc-linux/rootfs/usr/include/arm-linux-gnueabihf /usr/include/arm-linux-gnueabihf

Enable hard-float in in xbmca10/tools/a10/depends/depends.mk:

USEARMHF=1

and Update the following keys around line 50 in the same file:

#where is your arm rootfs
SDKSTAGE=/home/jaufranc/edev/mele_a1000/xbmc-linux/rootfs
#where is your xbmc install root
XBMCPREFIX=/allwinner/xbmc-pvr-bin$(HF)
#where is your toolchain
TOOLCHAIN=/usr/arm-linux-gnueabi$(HF)

Install some tools required to build XBMC, and create a symlink for the ARM g++ compiler:

sudo apt-get install cmake shtool swig autoconf autotools-dev automake libtool default-jre gawk gperf zip g++-arm-linux-gnueabihf autopoint
sudo ln -s /usr/bin/arm-linux-gnueabihf-g++-4.6 /usr/bin/arm-linux-gnueabihf-g++

Create the tarballs directory in the user’s root directory as well as XBMC install directory:

mkdir ~/tarballs
sudo mkdir -p /allwinner/xbmc-pvr-binhf
sudo chown [user].[user] /allwinner/xbmc-pvr-binhf -R

Replace [user] with your username.

You can now cross-compile XBMC for ARM:

cd xbmca10/tools/a10/depends
make
make -C xbmc
cd ../../..
make install

This will take a little while, and once the build completes, copy XBMC binaries to your SD card:

cp -r /allwinner/xbmc-pvr-binhf /allwinner/xbmc-pvr-binhf

All good! Time to give XBMC a try. Insert the SD card in your A10 device, change some permissions, and run XBMC:

chmod 666 /dev/mali /dev/ump /dev/cedar_dev /dev/disp
chmod -R 666 /dev/input/*
chmod -R 666 /dev/snd/*
export A10HWR=1
cd /allwinner/xbmc-pvr-binhf/lib/xbmc
./xbmc.bin

After a few seconds, you should now be able to access XBMC user interface. In case you have issues, you can have a look at the log in ~/.xbmc/temp/xbmc.log.

XBMC A10 ARMHF Build on the HackBerry

First of all, this is a development version, so you should not expect a perfect user experience. There should be bugs, crashes, missing features and performance might not be optimal yet.

If you want to have a quick look, watch Jasbir video of XBMC armhf on the HackBerry board.

I did try to use Jasbir image on the Mele A1000 (After updating U-Boot and U-Boot SPL) to evaluate the current status of XBMC on A10, but I could only see XBMC boot logo before the system reboot, as XBMC actually terminates, after apparently thinking I pressed some key….

At the current stage of development, XBMC for Linux appears to work pretty well on AllWinner A10 devices, but there is still more work to do before users can enjoy it on their devices.

If you want to give it a try on your hardware, check out Hackberry A10 – XBMC blog post.