PyQt4 on the Qtopia Greenphone

greenphone-python-small

Creating widgets interactively on the phone over a telnet connection.

Overview

Both Python and PyQt are viable choices for software development on Embedded Linux platforms that use Qt as their underlying GUI framework. In particular, devices such as the Greenphone are easily capable of running PyQt applications with streamlined user interfaces that have been adapted or specially written for small screen sizes.

This document describes the process used to compile all the necessary libraries needed by PyQt applications for the Greenphone. With some adjustment, the steps described here may work for other embedded environments.

The main problems with getting a PyQt development environment working on the Greenphone are due to difficulties with cross-compilation and the issue of matching the configuration of PyQt to the Qt build on the device.

Although SIP can be cross-compiled relatively easily, the Python build system doesn't support cross-compilation by default, and PyQt requires some patching in order to allow cross-compilation. In addition, PyQt needs to be modified to introduce configurable features that correspond to those in Qtopia Core.

Setting up a cross-compiler

The first thing we need to do is to obtain a cross-compiler that can generate appropriate libraries and executables for the Greenphone. We do this by building a crosstool toolchain for the same combination of gcc and glibc that were used to build the Qtopia Phone Edition software already on the device.

For Qtopia Phone Edition 4.3 builds, we need to build a toolchain based on GCC 4.1.1 and glibc 2.3.6. The files that are used to describe this configuration can be found in the Qtopia Phone Edition package (for example, the Open Source package found on the Qtopia Downloads page).

The trolltech-greenphone.sh script that is used to start the build process for the cross-compiler contains some environment variable definitions that need to be customised for your system.

If you're using tools to parallelize compilation, you may want to disable them now if you think they will interfere with the build process.

Hopefully, this should all work as expected.

Configuring the build

The Building_Qtopia_Core_and_PyQt4.txt file contains a recipe for configuring and building Python, SIP, Qtopia Core and PyQt4 for the Greenphone. Create a new directory and copy this file into it.

The file contains some paths that need to be updated specifically for your system. These are described in the following list:

You should also update any existing instances of /mnt/sd/Qtopia you find in the file if you change the values of TARGETDIR and ROMDIR from their defaults.

You may need to create the directories referred to by TARGETDIR and ROMDIR if they do not already exist. Be careful! The default value may refer to an existing file system on your desktop machine.

Building the native tools

If all went well, you should now be able to configure and build Python for the Greenphone.

PyQt4 on the Qtopia Greenphone (last edited 2008-01-22 01:55:28 by DavidBoddie)