Sunday, November 13, 2011

Running Qt4 Examples on Embedded Linux using ARM emulator

In this article I will show how to run Qt4-Embedded Examples on Angstrom Linux using QEMU. The procedure doesn't require any compilation or cross compilation. It uses Angstrom Linux precompiled packages, online image builder, and works both on Windows and Linux.
Qt4 Embedded allows to run Qt applications directly in Linux Framebuffer, bypassing X Windows completely. This is especially important during embedded development, because it allows to save a lot of memory and start up time.

Qt4 has a rich set of examples directly embedded into Qt sources. Below is a few samples of how it looks like:
I will show how to run them.

First, you need to install QEMU. For Windows, the easiest way is to download zipped executables, which I shared here: Qemu-windows-0151. For Linux it's usually apt-get install qemu-system.
Then, we need to build Angstrom image. For those unpatient, I shared a prebuilt image here: angstrom-qt4-embedded. Angstrom has online image builder available here: Angstrom Image Builder. You need to pick console image and download it. The small trick is that you need to download kernel image yourself (from here: kernel-image-2.6.37.2_2.6.37-r4.6_qemuarm.ipk) and unpack it using ar -x kernel-image.ipk command. This is because online image builder doesn't include kernel image for some reason. However this step is not required if you download the image I shared.

Next, you need to start QEMU using kernel image and prebuilt angstrom image. The command looks like this:
qemu-system-arm -M versatilepb -usb -usbdevice wacom-tablet -show-cursor -m 64 -kernel zImage-2.6.37.2 -hda disk.img -append "root=/dev/sda2 rw"
For convenience, I prepared run script, which does that.

Next, you need to login as root and install qt4-embedded using command: opkg install qt4-embedded. This can be again skipped if you use the image I prepared.

In order to run demos, you need to use this command:
qtdemoE -qws
It looks like this:
You can run the other examples from Qt, in standalone mode from /usr/bin/qtopia directory. You need to use similar command app -qws. The command is required to initialize Qt framebuffer. It is possible to run a few executables on the same display. In order to do this, you need to run the first one only with qws parameter. The other apps will connect to it.

Have fun!

4 comments:

  1. Nice article. I've recently discovered programming under Qt. I knew about it but never touched SDK. And lately I did some bug fixing in open source program written under Qt and it was very nice dev environment.
    Thanks.

    ReplyDelete
  2. I think the hottest topic about Qt is that they support Javascript through Webkit (so called QtScript), which is JIT compiled (as far as I know). That makes it blazingly fast.

    ReplyDelete
  3. your prebuilt image is not there. it says invalid link.
    and please can you provide steps for windows and linux seperatly.
    thanks in advance

    ReplyDelete
  4. Very nice post here and thanks for it .I always like and such a super contents of these post. Excellent and very cool idea and great content of different kinds of the valuable information's.
    Good discussion. Thank you.

    online idea lab

    ReplyDelete