Cross Compile Pandaboard PowerVR OpenGL ES2 Example

This post is about how to cross compile a very simple OpenGL ES2 example for the Pandaboard within a Debian Linux chroot environment.

<a id="more"></a><a id="more-594"></a>

What do we need? * Pandaboard running Ubuntu 11 (Natty) * x86 (i386) Workstation running Debian * <a href="http://ppa.launchpad.net/tiomap-dev/release/ubuntu/pool/main/p/pvr-omap4/">pvr-omap4 orig package</a> (e.g.: <a href="http://ppa.launchpad.net/tiomap-dev/release/ubuntu/pool/main/p/pvr-omap4/pvr-omap4_1.7.5.2+git20110610+9696932c.2.orig.tar.gz">pvr-omap4_1.7.5.2+git20110610+9696932c.2.orig.tar.gz</a>) * Archive with OpenGL ES2 example for the Pandaboard

1. Create a chroot environment

At first we need a chroot environment in which we can compile our code against arm architecture.

# use debootstrap to create a chroot environment
debootstrap --arch=i386 testing rootfs/
# Switch into the chroot environment
chroot rootfs
# Install some basic tools
apt-get install vim less pdebuild-cross

2. Update our apt sources

Add the emdebian repository.

echo "deb http://ftp.at.debian.org/debian/ testing main contrib non-free" > /etc/apt/sources.list
echo "deb http://www.emdebian.org/debian/ testing main" >> /etc/apt/sources.list
apt-get install emdebian-archive-keyring
apt-get update

3. Install the crosscompiler tools from emdebian repository

apt-get install g++-4.4-arm-linux-gnueabi
apt-get install gcc-4.4-arm-linux-gnueabi

4. PowerVR libraries and headers

Download the pvr-omap4 archive which contains a set of libraries for powervr. The files can be found at <a href="https://launchpad.net/~tiomap-dev">Launchpad TI Dev</a>. Those binaries are used to create the omap4 ubuntu packages. I used the pvr-omap4_1.7.5.2+git20110610+9696932c.2.orig.tar.gz archive.

# Extract pvr-omap4 archive
cd /opt/
wget http://ppa.launchpad.net/tiomap-dev/release/ubuntu/pool/main/p/pvr-omap4/pvr-omap4_1.7.5.2+git20110610+9696932c.2.orig.tar.gz
tar xvfz pvr-omap4_1.7.5.2+git20110610+9696932c.2.orig.tar.gz

5. Get cross compile dependencies

xapt -m -a armel libx11-dev
xapt -m -a armel libdrm-dev

6. Extract the example and compile

<a href="/downloads/PandaboardPowerVROGLES2Example.tgz[Download] the example

cd /opt/
wget http://www.jotschi.de/downloads/PandaboardPowerVROGLES2Example.tgz
tar xvfz PandaboardPowerVROGLES2Example.tgz

Store Settings

Contents of /opt/settings.inc

#!/bin/bash
export X11ROOT=/usr/arm-linux-gnueabi/
export PVR_OMAP_FILES=/opt/pvr-omap4-1.7.5.2+git20110610+9696932c.2

Load settings and compile:

cd /opt/OGLES2PowerVRPandaboardExample
# If . does not work use source to include the settings
. /opt/settings.inc
# Invoke the build
make

<h3>Optional for pandaboard cross platform development</h3> Now i have a build arm ready binary executable within my chroot environment. To execute it straight from eclipse we have to create another script. The script will transfer our executable (in this case OGLES2HelloTriangle) to the Pandaboard OMAP4 platform and execute it there.

run.sh:

#!/bin/bash
echo "Transfering"
scp ReleaseX11/OGLES2HelloTriangle  root@panda:/opt/

echo "Executing"
ssh root@panda DISPLAY=:0 /opt/OGLES2HelloTriangle

Just create a new C/C++ Application run configuration that uses the following settings:

  • C/C++ Application: /bin/bash

  • Program arguments: /home/myuser/workspace/MyProject/run.sh