Qt 4.8: Porting Qt for Embedded Linux to Another Operating System

Qt Reference Documentation

- Qt 4.8
- ALL VERSIONS

- A
- A
- A
- Print

# Porting Qt for Embedded Linux to Another Operating System

Qt for Embedded Linux is reasonably platform-independent, making use of the standard C library and some POSIX functions, but only a Linux implementation is publically available. If you are looking for a non-Linux commercial implementation, it is worth contacting qt-info@nokia.com to see if we can help.

There are several issues to be aware of if you plan to do your own port to another operating system. In particular you must resolve Qt for Embedded Linux's shared memory and semaphores (used to share window regions), and you must provide something similar to Unix-domain sockets for inter-application communication. You must also provide a screen driver, and if you want to implement sound you must provide your own sound server. Finally you must modify the event dispatcher used by Qt for Embedded Linux.

Contents:

## Shared Memory and Semaphores

Qt for Embedded Linux uses System V IPC (shared memory and semaphores) to share window regions between client and server. When porting, something similar must be provided; otherwise it will not be possible to run multiple applications.

System V semaphores are also used for synchronizing access to the framebuffer.

- Modify `qsharedmemory_p.cpp`
- Modify `qlock_qws.cpp`
- Modify `qwslock.cpp`

## Inter-Application Communication

To communicate between applications, Qt for Embedded Linux uses the Unix-domain sockets. When porting, something similar must be provided; otherwise it will not be possible to run multiple applications.

It should be possible to use message queues or similar mechanisms to achieve this. With the exception of QCOP messages, individual messages should be no more than a few bytes in length (QCOP messages are generated by the client applications and not Qt for Embedded Linux).

- Modify `qwssocket_qws.cpp`

## Screen Management

When rendering, the default behavior in Qt for Embedded Linux is for each client to render its widgets into memory while the server is responsible for putting the contents of the memory onto the screen using the screen driver.

When porting, a new screen driver must be implemented, providing a byte pointer to a memory-mapped framebuffer and information about width, height and bit depth (the latter information can most likely be hard-coded).

- Reimplement `qscreen_qws.cpp`

## Sound Management

To implement sound, Qt for Embedded Linux uses a Linux style device (`/dev/dsp`). If you want to use the Qt for Embedded Linux sound server on another platform you must reimplement it.

- Reimplement `qsoundqss_qws.cpp`

## Event Dispatching

Qt for Embedded Linux uses an event dispatcher to pass events to and from the Qt for Embedded Linux server application. Reimplement the `select()` function to enable Qt for Embedded Linux to dispatch events on your platform.

- Modify `qeventdispatcher_qws.cpp`