NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on The site is now set to read only.

Building Qt for OMAP35xx with OpenGL ES accelerated by SGX

From Texas Instruments Wiki
Jump to: navigation, search

Content is no longer maintained and is being kept for reference only!

Much of the information on this page was inspired by the "Building Qt" wiki page, but focuses specifically on OMAP35xx with OpenGL ES. It expands on software prerequisites and configuration, and provides updated information for building with the latest Qt 4.6 branch. The original "Building Qt" page also covers Qt without OpenGL, with WinCE, and other scenarios not covered here. I'm currently working with the author of that page to merge our efforts.

Software Prerequisites

The instructions in this article were verified on a fresh install of Ubuntu 9.10 Desktop and an OMAP35xx EVM with ES 2.1 silicon. If you have successfully verified this on other Linux host distributions or target architectures, please let us know on the "discussion" tab for this page!

Linux Host Development Tools

Your Ubuntu desktop may need some additional tools installed. Running the following command should install all needed host-side software for these instructions:

sudo apt-get install git-core g++

CodeSourcery 2008q1 Toolset

Download and install the CodeSourcery 2008q1 tools. The CodeSourcery web site seems to change quite frequently, but this link seems to be a fairly stable starting point:

At the time of writing, to download the tools you would start by going to the link above, and scroll down to the "Next Steps" section. Click the link for "Download the current release". Next, in the box that says "GNU/Linux" for the Target OS, click the "All versions..." link. On this page, under the "All Available Releases" section, click the link for "Sourcery G++ Lite 2008q1-126". Finally, under the "Packages" section on this page, click "IA32 GNU/Linux TAR" to download the toolset.

Once the package has been download, un-tar it to a good location. I installed it in my home directory as follows:

tar xjvf ./arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 -C $HOME

The toolset is now installed in $HOME/arm-2008q1

Remember the directory where you installed the toolset -- you will need to specify this location later on.


At the time of writing, the OMAP35x PSP could be downloaded from this page:

On this page, click on "OMAP35x-PSP-SDK-setuplinux-" to download the PSP package.

Install the PSP package as follows:

chmod u+x ./OMAP35x-PSP-SDK-setuplinux-

I installed the PSP to the default location, which is in my home directory ($HOME/OMAP35x-PSP-SDK-

Preparing the Kernel Source

For later steps, it is important that the kernel source has been extracted and prepared for compilation as follows:

Add the CodeSourcery 2008q1 toolset to your path

export PATH="${HOME}/arm-2008q1/bin:${PATH}"
hash -r

Extract the kernel source

tar xzvf linux-

Build the kernel modules

As we will be building kernel modules later on, we need to have built the kernel modules in our kernel source. A complete kernel build is not necessary.

make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm omap3_evm_defconfig
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm modules

OMAP35x Graphics SDK

At the time of writing, the OMAP35x Graphics SDK could be downloaded from this page:

On this page, click on "OMAP35x_Graphics_SDK_setuplinux_3_00_00_09.bin" to download the Graphics SDK package.

Install the Graphics SDK package as follows:

chmod u+x ./OMAP35x_Graphics_SDK_setuplinux_3_00_00_09.bin

I installed the Graphics SDK to the default location, which is in my home directory ($HOME/OMAP35x_Graphics_SDK_3_00_00_09).

Re-building and Installing the Graphics SDK Binaries

The pre-built binaries that come with the Graphics SDK were built with a different version of the PSP than what we are using, so we must re-build the Graphics SDK against PSP as follows.

Customize the Graphics SDK's Rules.make

Change to the Graphics SDK directory and edit the Rules.make file. You need to modify the settings of these variables:

CSTOOL_DIR : Installation directory of your CodeSourcery 2008q1 toolset.
KERNEL_INSTALL_DIR : Installation directory of your prepared kernel source tree.
TARGETFS_INSTALL_DIR : Directory of your target filesystem.

NOTE: If you installed the graphics SDK in a location other than the default you will also need to modify the GRAPHICS_INSTALL_DIR variable.

By default, your target filesystem is assumed to be located at $HOME/workdir/filesys. I did not change TARGETFS_INSTALL_DIR, as this is where my target filesystem is located.

As an alternative to editing Rules.make in a text editor, I was able to configure Rules.make for my system with the following commands:

cd $HOME/OMAP35x_Graphics_SDK_3_00_00_09
sed -i "s#^CSTOOL_DIR=.*\$#CSTOOL_DIR=\$\(HOME\)/arm-2008q1#" Rules.make

You may still prefer to edit Rules.make with a text editor -- either way, it's up to you.

Re-build and Install the Graphics SDK

It is assumed that the CodeSourcery tools are still in your PATH. If not, revisit the section on Preparing the Kernel Source to add them.

To re-build the Graphics SDK, you need to know if your OMAP35xx is silicon revision 2.x or 3.x. Below are the build steps for each case:

For ES 2.x:

make clean
make OMAPES=2.x
make install

For ES 3.x:

make clean
make install

After installing the binaries, make sure you run "/etc/init.d/omap-demo restart" on the target to finish the target installation. This script is usually run when the board boots up, but you will need to run it manually if you have disabled it during boot.

More information regarding installation and configuration of the Graphics SDK can be found in the OMAP35x Graphics SDK Getting Started Guide

Download the Qt 4.6 Branch

Use "git" to download the Qt 4.6 development branch as follows:

cd $HOME
git clone git://
cd qt
git branch 4.6 origin/4.6
git branch 4.6.omap3_build d16ba0a93d611689bce9a2732a1cc8c9a317f5bf
git checkout 4.6.omap3_build

The above commands check-out the Qt repository, and create two local branches:

4.6 : This branch tracks the latest upstream changes to 4.6
4.6.omap3_build : This branch marks the last point in time on the 4.6 branch that is known to work with this instructions in this article.

The "git checkout" command above checks-out the 4.6.omap3_build branch, which is what we will be building.

Add an OMAP35xx Build Configuration to Qt

Attached to this page is a patch file that will get you 90% of the way to being able to build Qt for OMAP35xx. Click here to download the patch before proceeding.

Apply the patch as follows:

cd $HOME/qt
zcat ./Omap3_qt46_config.patch.gz | git apply

Customize the Build Setings for your System

After applying the patch, there will be a configure_omap3 configuration script in the $HOME/qt directory. You must edit the variable settings at the top of this script to specify the location of your software components:

QT_TARGET_DIR : Target-relative location of Qt Installation (/ here is the target root)
CSTOOL_DIR : Location of the CodeSourcery 2008q1 Toolset
GFX_SDK_DIR : Location of your Graphics SDK directory
GFX_ES_DIR : Graphics SDK sub-directory that contains your OpenGL libraries. This should be "gfx_rel" if you have ES 3.x silicon, and "gfx_rel_es2.x" if you have ES 2.x silicon.

By default, the QT_TARGET_DIR is set to /opt/qt-embedded, and this is where Qt libraries will be installed on the target filesystem. If you want to place them in a different location (like /usr/lib), set QT_TARGET_DIR to the target directory where you would like them. All other variables default to the locations I've used in this article, and by default silicon revision 2.x is assumed.

Options for Qt's Configure Script

At the bottom of the configure_omap3 script, you'll see that it runs "./configure" with several options. You may adjust the configure options here if you wish, but the ones provided are known to work. Here sre some things to consider:

  • The configuration provided by this article does not enable the touch-screen on the OMAP3 EVM. This involves using tslib and configuring Qt to use it. The Qt configure option for this is "-qt-mouse-tslib".
  • For OpenGL ES 1.1, you need to use "-opengl es1" instead of "-opengl es2".

Run the Configuration Script

Now that your build parameters are set, run the script to configure Qt for OMAP35xx as follows:

cd $HOME/qt

You will be prompted if you want to use the Open Source or Commercial version, and if you accept the licensing. These instructions have been verified with the Open Source Edition only. Below is what the screen looks like if you select the Open Source Edition and accept the LGPL licensing.

Configuring linux-omap3-g++/qmake.conf for your system...
Running configure...
Which edition of Qt do you want to use ?

Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.


You have not explicitly asked to use pkg-config and are cross-compiling.
pkg-config will not be used to automatically query cflag/lib parameters for

This is the Qt for Embedded Linux Open Source Edition.

You are licensed to use this software under the terms of
the Lesser GNU General Public License (LGPL) versions 2.1.

Type 'L' to view the Lesser GNU General Public License version 2.1.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.

Do you accept the terms of the license? yes

The configure script will run for a little while after this.

Build and Install Qt

We're ready to build and install Qt! Note that the Qt build will take a while, even on a faster host PC.

cd $HOME/qt
make install INSTALL_ROOT=$HOME/workdir/filesys

In the install command above you should set INSTALL_ROOT to be the location of your target filesystem.

Run a Demo

Board Set-up

When setting up your board, you should first follow the OMAP35x Graphics SDK Getting Started Guide. Below are some verified boot arguments for the OMAP35xx EVM taken from the Building Qt page that work with the Qt demos:

LCD Display:

OMAP3_EVM # setenv bootargs 'console=ttyS0,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=$(nfshost):$(rootpath),nolock,rsize=1024,wsize=1024 mem=99M mpurate=600 omapfb.vram=8M'

DVI Display:

OMAP3_EVM # setenv bootargs 'console=ttyS0,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=$(nfshost):$(rootpath),nolock,rsize=1024,wsize=1024 mem=99M mpurate=600 omapfb.vram=8M omapfb.video_mode=1280x1024MR-24@60 omap-dss.def_disp=dvi'

When using the DVI display, you also need to execute the following command on the target before running any demos:

fbset -depth 32 -rgba 8/16,8/8,8/0,8/24

If you try to run a demo on DVI before running the fbset command above, it will not work. This command is not needed when using the LCD display.

OpenGL Set-up

Before running OpenGL-based Qt apps on OMAP35xx, you must create a powervr.ini file. To do this, execute the following commands on the running target:

cat > /etc/powervr.ini << _EOF

Running Qt Demo Applications

To verify that you have correctly built and installed Qt, try a simple demo or two! Boot your OMAP35xx target, and run the following commands:

cd /opt/qt-embedded/examples/opengl/hellogl_es2
./hellogl_es2 -qws -display powervr

Instead of using the -display option above, you could also set the following environment variable that will apply to all demo applications you run:

export QWS_DISPLAY="powervr"

Here is another cool demo:

cd /opt/qt-embedded/demos/deform/
./deform -qws