Qt Embedded を DirectFB で動かす
仕事の都合上、Qt の移植作業が中途半端な状態でストップしてしまう。途中経過をメモ。
ARM Omap3 のボードに DirectFB を移植し、Qt をその上で動かす、というもの。
1. ソースをダウンロード
http://qt.nokia.com/downloads/embedded-linux-cpp
http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.3.tar.gz
(*) インストールのドキュメントがあるが、ほとんど役に立たない
http://doc.qt.nokia.com/4.7/qt-embedded-install.html
2. ライセンス
商用ライセンスは使わないので無視
3. configure
DirectFB 向けに configure したい。とりあえず以下で configure した:
ARM_INSTALL_DIR=$HOME/xxx/install \ PKG_CONFIG_PATH=$HOME/xxx/install/lib/pkgconfig \ PKG_CONFIG_LIBDIR=$HOME/xxx/install/lib/pkgconfig \ CFG_IPV6=no \ ../qt-everywhere-opensource-src-4.7.3/configure \ -prefix /home/hal/xxx/install \ -embedded arm \ -xplatform qws/linux-arm-gnueabi-g++ \ -little-endian \ -host-little-endian \ -force-pkg-config \ -qt-gfx-directfb \ -system-zlib \ -system-libpng \ -system-libjpeg \ -no-multimedia \ -no-qt3support \ -no-svg \ -no-webkit \ -no-script \ -no-scripttools \ -no-xmlpatterns \ -no-sql-db2 \ -no-sql-ibase \ -no-sql-mysql \ -no-sql-oci \ -no-sql-odbc \ -no-sql-psql \ -no-sql-sqlite \ -no-sql-sqlite2 \ -no-sql-sqlite_symbian \ -no-sql-tds \ -no-audio-backend \ -no-phonon \ -no-javascript-jit \ -no-declarative \ -no-declarative-debug \ -debug
configure な主要なポイント:
-embedded arm \ -xplatform qws/linux-arm-gnueabi-g++ \
-embedded を指定しないとそもそも DirectFB を使えない。
-xplatform は、コンパイルオプションなどを記載する qt-everywhere-opensource-src-4.7.3/mkspecs/ 以下のパスを指すようにする。qmake.conf は以下:
# # qmake configuration for building with arm-none-linux-gnueabi-g++ # include(../../common/g++.conf) include(../../common/linux.conf) include(../../common/qws.conf) # modifications to g++.conf QMAKE_CC = arm-none-linux-gnueabi-gcc QMAKE_CXX = arm-none-linux-gnueabi-g++ QMAKE_LINK = arm-none-linux-gnueabi-g++ QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++ # modifications to linux.conf QMAKE_AR = arm-none-linux-gnueabi-ar cqs QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy QMAKE_STRIP = arm-none-linux-gnueabi-strip QMAKE_CFLAGS="-mcpu=cortex-a8 -mfpu=neon -I$(ARM_INSTALL_DIR)/include" QMAKE_CXXFLAGS="-mcpu=cortex-a8 -mfpu=neon -I$(ARM_INSTALL_DIR)/include" QMAKE_LFLAGS="-L$(ARM_INSTALL_DIR)/lib" load(qt_config)
QMAKE_CFLAGS で与えているコンパイルオプションは正しく無いので参考にしないこと。ちゃんとした調査が必要だが、以下のような感じになると思われる:
"-march=armv7-a -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp"
configure の続きで、
-qt-gfx-directfb \
これで DirectFB が有効になるはず。
また、-no-xxx で機能を大量に抑制しているが、これは単にコンパイル速度を早くしたいためである。まだ configure のオプションや、後述するコンパイルオプションなど、見直したい箇所が多い。
configure を実行してみて、期待通りの設定が受理されたか確認するにはログを見る必要があるが、qt の configure は、どうもログを残さない。もしかしたら残しているのかもしれないが、お決まりの configure.log という名前では残さない。とりあえずコンソールに表示される以下のメッセージで、 configure がうまくいっているか目で確認する:
Building on: qws/linux-x86-g++ Building for: qws/linux-arm-gnueabi-g++ Architecture: arm Host architecture: i386 Build .................. libs examples demos docs translations Configuration .......... cross_compile debug shared dll embedded largefile stl precompile_header exceptions_off minimal-config small-config medium-config larg e-config full-config accessibility embedded reduce_exports ipv6 clock-gettime cl ock-monotonic mremap getaddrinfo ipv6ifname getifaddrs inotify system-jpeg syste m-png png freetype system-zlib nis debug Debug .................. no Qt 3 compatibility ..... no QtDBus module .......... no QtConcurrent code ...... yes QtGui module ........... yes QtScript module ........ no QtScriptTools module ... no QtXmlPatterns module ... no Phonon module .......... no Multimedia module ...... no SVG module ............. no WebKit module .......... no Declarative module ..... no Declarative debugging ...no Support for S60 ........ no Symbian DEF files ...... no STL support ............ yes PCH support ............ yes MMX/3DNOW/SSE/SSE2/SSE3. no/no/no/no/no SSSE3/SSE4.1/SSE4.2..... no/no/no AVX..................... no iWMMXt support ......... no NEON support ........... no IPv6 support ........... yes IPv6 ifname support .... yes getaddrinfo support .... yes getifaddrs support ..... yes Accessibility .......... yes NIS support ............ yes CUPS support ........... no Iconv support .......... no Glib support ........... no GStreamer support ...... no PulseAudio support ..... no Large File support ..... yes GIF support ............ plugin TIFF support ........... plugin (qt) JPEG support ........... plugin (system) PNG support ............ yes (system) MNG support ............ plugin (qt) zlib support ........... system Session management ..... no Embedded support ....... arm Freetype2 support ...... auto (yes) Graphics (qt) .......... linuxfb multiscreen directfb Graphics (plugin) ...... Decorations (qt) ....... styled windows default Decorations (plugin) ... Keyboard driver (qt) ... tty Keyboard driver (plugin) .. Mouse driver (qt) ...... pc linuxtp Mouse driver (plugin) .. OpenGL support ......... no OpenVG support ......... no OpenSSL support ........ no Alsa support ........... no ICD support ............ no
Graphics (qt) .......... linuxfb multiscreen directfb
に directfb が含まれているかがポイント。
4. 動作確認
ドキュメントをまともに読まなかったのでかなりハマったが、以下のようにしないと directfb が使われない:
$ ./linghtmap -qws -display directfb
5. その他のオプション
Qt directfb では、QT_NO_DIRECTFB_WM などのコンパイルオプションを与えることで、機能やふるまいを変えることが出来る。
これについては全然調査していないので調査が必要。
http://doc.qt.nokia.com/latest/qt-embeddedlinux-directfb.html
6. ドキュメントなど
directfb 向けにコンパイルするためのドキュメント
http://doc.qt.nokia.com/latest/qt-embeddedlinux-directfb.html
-display のオプションについてのドキュメント
http://doc.qt.nokia.com/latest/qt-embedded-displaymanagement.html