UnderFreescale iMX28,porting QT4.7.4 steps

 

Hardware platform:Freescale iMX28

Software platform:Linux 2.6.35.3,Ubuntu 10.04

QT version:embedded QT4.7.4, file name is qt-everywhere-opensource-src-4.7.4.tar.gz

Author: Wen Xiaoyong, wen_kernel@163.com

Date: 2011-12-20

Caution: All rightsreserved, Please indicate the source if reproduce.

 

Version history

Index

Version

Author

Date

Comment

1

V1.0.0

Wen Xiaoyong

2011-12-20

Draft

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


移植过程:

1. 编译QT4.7.4

1.1 通过setenv.sh shell脚本设置交叉编译工具链路径

#cd /home/wenxy/src/QT; . setenv.sh; cd qt-everywhere-opensource-src-4.7.4

 

1.2 配置QT

#./configure -embedded -help

#./configure -embedded arm -xplatformqws/linux-arm-g++ -depths 4,8,12,16,24,32-no-qt3support -qt-mouse-linuxtp

 

或者支持所有的颜色深度

#./configure -embedded arm -xplatformqws/linux-arm-g++ -depths all -no-qt3support-qt-mouse-linuxtp

 

如果没有安装g++,则在线安装

#apt-get install g++

否则会报错:

Creating qmake. Pleasewait...

g++ -c -o project.o-pipe -DQMAKE_OPENSOURCE_EDITION -I. -Igenerators -Igenerators/unix-Igenerators/win32 -Igenerators/mac -Igenerators/symbian-I/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/include-I/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/include/QtCore-I/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/src/corelib/global-I/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/src/corelib/xml-I/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/tools/shared-DQT_NO_PCRE -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT -DQT_NO_TEXTCODEC-DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL -DQT_NO_COMPRESS-I/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/mkspecs/qws/linux-x86-g++-DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT  project.cpp

make: g++: Command notfound

make: *** [project.o]Error 127

 

1.3 配置完成后,运行编译命令

#make

编译过程看计算机配置,几个小时。摘抄最后的编译信息如下:

 

arm-linux-g++ -c -pipe-fno-exceptions -O2 -Wall -W -D_REENTRANT -DLOG_SPECTRUMANALYSER -DLOG_ENGINE-DSUPERIMPOSE_PROGRESS_ON_WAVEFORM -DSPECTRUM_ANALYSER_SEPARATE_THREAD-D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_MULTIMEDIA_LIB-DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED-I../../../mkspecs/qws/linux-arm-g++ -I.-I../../../include/QtCore -I../../../include/QtNetwork -I../../../include/QtGui-I../../../include/QtMultimedia -I../../../include -I../3rdparty/fftreal-I.moc/release-shared-emb-arm -o .obj/release-shared-emb-arm/qrc_spectrum.o.rcc/release-shared-emb-arm/qrc_spectrum.cpp

arm-linux-g++-Wl,-rpath-link,/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/lib-fno-exceptions -Wl,-O1-Wl,-rpath,/usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib-Wl,-rpath,/usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib -o ../spectrum.obj/release-shared-emb-arm/main.o .obj/release-shared-emb-arm/engine.o.obj/release-shared-emb-arm/frequencyspectrum.o.obj/release-shared-emb-arm/levelmeter.o.obj/release-shared-emb-arm/mainwidget.o.obj/release-shared-emb-arm/progressbar.o.obj/release-shared-emb-arm/settingsdialog.o.obj/release-shared-emb-arm/spectrograph.o.obj/release-shared-emb-arm/spectrumanalyser.o.obj/release-shared-emb-arm/tonegenerator.o.obj/release-shared-emb-arm/tonegeneratordialog.o.obj/release-shared-emb-arm/utils.o .obj/release-shared-emb-arm/waveform.o.obj/release-shared-emb-arm/wavfile.o .obj/release-shared-emb-arm/moc_engine.o .obj/release-shared-emb-arm/moc_levelmeter.o.obj/release-shared-emb-arm/moc_mainwidget.o.obj/release-shared-emb-arm/moc_progressbar.o.obj/release-shared-emb-arm/moc_settingsdialog.o.obj/release-shared-emb-arm/moc_spectrograph.o .obj/release-shared-emb-arm/moc_spectrumanalyser.o.obj/release-shared-emb-arm/moc_tonegeneratordialog.o.obj/release-shared-emb-arm/moc_waveform.o.obj/release-shared-emb-arm/qrc_spectrum.o   -L/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/lib -L..-lfftreal -lQtMultimedia-L/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/lib -lQtGui -lQtNetwork-lQtCore -lpthread

make[3]: Leavingdirectory `/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/demos/spectrum/app'

make[2]: Leavingdirectory `/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/demos/spectrum'

make[1]: Leavingdirectory `/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/demos'

 

整个目录大小

root@wenxy-desktop:/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4#du -sh

1023M   .

源代码500MB左右。

 

2. 把编译好的QT4.7.4库和SDK中自带的例子程序copy到开发板上

2.1 Run demo in development board

建立以下目录:/usr/local/Trolltech/QtEmbedded-4.7.4-arm

 

Copy QT lib and demos to development board

#mount -t nfs -o nolock192.168.1.160:/home/wenxy/src/QT/qt-everywhere-opensource-src-4.7.4/mnt/nfs

#cp –Rf /mnt/nfs/lib /usr/local/Trolltech/QtEmbedded-4.7.4-arm

#cp –Rf /mnt/nfs/demos /usr/local/Trolltech/QtEmbedded-4.7.4-arm

 

 

设置环境变量

#exportPATH=$PATH:/usr/local/Trolltech/QtEmbedded-4.7.4-arm

#exportLD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib

 

运行例子程序

#cd /usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/anomaly

#./anomaly -qws &

出现错误:

#./anomaly -qws &

root@imx28evk/usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/anomaly$blit_setup(): Screen depth 32 not supported!

[1] + Aborted                    ./anomaly –qws

解决方法:重新配置QT(-depths参数设置成4,8,12,16,24,32),再次编译,使用这次生成的QT lib即可。

 

#cd /usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embeddeddialogs

#./embeddeddialogs -qws &

 

#cd /usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/mainwindow

#./mainwindow -qws &

运行后,LCD屏会显示QT的图形用户界面(GUI)。插上USB鼠标和USB键盘,就可以进行操作。如果要支持触摸屏,需要安装触摸屏驱动,TSLIB电阻屏校正程序。

 

全文完。

Logo

更多推荐