Getting Started with the Trolltech Greenphone SDK
The gph utility is a useful awk script that provides convenience functions for doing things like building, packaging, installing and running applications in the Qtopia environment, either emulated or actually on the phone. It can be invoked instead of make, and it is powerful enough that we can use it to convert from raw source code to running applications installed from a package onto a real or emulated device.
For example, to rebuild the code, package it and install and run on qvfb, we would try the following command:
gph -C x86 -debug -c -all
If that were to go well, and we were happy with enough to want to run it on an actual phone, we could build ourselves a package to install with the following:
gph -C greenphone -p
This would give us a file in our pkg directory with a name like qpe-application_1.0.0-1_arm.qpk.
To have a more complete idea of the gph capabilities, we can look at its help message:
$gph --help FORMAT: /opt/Qtopia/SDK/scripts/gph <options> Options: -h display command help -q quiet mode -c clean -C <opt> reconfig <x86> or <greenphone>, default greenphone -b make -p make package -i install package to greenphone -r run application on greenphone -all reconfig, make, make package, install, run -debug force configure for debug build, override default -release force configure for release build, override default -options "<opts>" pass extra options to build system eg. /opt/Qtopia/SDK/scripts/gph -C x86 -all -options "CONFIG+=debug" -net bring up network to greenphone -console console on greenphone -qpk <file> install qpk to SDK http server for installation -rescan Tell Qtopia to rescan for new documents and applications
When applications are packaged for distribution to Qtopia devices, they reside in .qpk files that are specially made gzip'd tar files. In addition to the executable file itself, there also are the help files, multilingual translation files and the desktop entry. This desktop entry file contains elements to describe the name of the executable, the icon, what type of application it is and, finally, the MIME type to indicate what sort of data it can process.
Debugging our application on the Greenphone itself is fairly easy to set up.
First, we need to configure our build environment to cross-compile for the ARM architecture on the Greenphone:
Next, we need to rebuild our Makefile and executables, package them up and install them onto the phone:
qtopiamake -debug && make clean && make && gph -p -i -r -debug
At this point, we can click the arm-linux debugger icon on the desktop, open the example program on the phone and click run to execute it in the remote debugger.
A number of application deployment methodologies are available when developing with the Greenphone SDK.
First, we can build and run our applications so that they execute within the virtual machine's ersatz phone-like environment complete with a JPEG skin that looks like a phone sitting on your desktop. It is great for working out the GUI parts of an application, and it saves us the step of having to compile, flash on to the unit and debug remotely.
Second, applications can be compiled and packaged for the Greenphone, then run and tested on the device itself. As mentioned previously, the VM installs with a gdb debugger that can run inside the virtual machine and debug applications remotely on the phone.
Finally, we have “Phone bounce” mode, using the phone as a standard GSM/GPRS modem connected to the development machine via a USB cable. Our applications would run inside the emulator on the local machine, but would be joined logically to the real phone by whatever network link you have to it, such as a USB connection.
We do not have to customize the Greenphone in a piecemeal fashion. The Flash image representing the whole Greenphone Linux distribution on the phone can be updated using either the mini-SD Flash reader or the USB cable to re-install a complete new Linux distribution along with all the applications and configuration files. This makes it easier for enterprise use where items such as standard configuration options are set to enable things like corporate branding with visual themes, VPN settings, default address-book entries and localization settings, among others.
Webinar: 8 Signs You’re Beyond Cron
11am CDT, April 29th
Join Linux Journal and Pat Cameron, Director of Automation Technology at HelpSystems, as they discuss the eight primary advantages of moving beyond cron job scheduling. In this webinar, you’ll learn about integrating cron with an enterprise scheduler.Join us!
- March 2015 Issue of Linux Journal: High-Performance Computing
- Not So Dynamic Updates
- April 2015 Video Preview
- Users, Permissions and Multitenant Sites
- New Products
- Flexible Access Control with Squid Proxy
- Security in Three Ds: Detect, Decide and Deny
- DevOps: Everything You Need to Know
- Non-Linux FOSS: MenuMeters
- Tighten Up SSH