移植qt4.8.1到mini2440

來源:互聯網
上載者:User

http://hi.baidu.com/wxpool/item/9dd17846613991ab60d7b9c7

交叉編譯器:arm-linux-gcc 4.4.3(友善之臂提供)平台:
Ubuntu 10.04
硬體:mini2440,256M Flash,
T35 LCDTslib:Tslib-1.4
==============================================================================

1.slib為觸控螢幕驅動獲得的採樣提供諸如濾波、去抖、校準等功能。
安裝tslib

下載tslib(http://prdownload.berlios.de/tslib/tslib-1.0.tar.bz2):tslib-1.0.tar.bz2

將tslib-1.0.tar.bz2複製到/tmp目錄下,執行命令:

cd /opt

tar -xvjf /tmp/tslib-1.0.tar.bz2

cd tslib-1.0

./autogen.sh

./configure --prefix=/opt/tslib-1.0/install --host=arm-linux ac_cv_func_malloc_0_nonnull=yes

make

make install

若在 ./autogen.sh: 4: autoreconf: not found

  是在不同版本的 tslib 下執行 autogen.sh 產生。它們產生的原因一樣,是

因為沒有安裝

  automake 工具

  sudo apt-get install autoconf automake libtool

安裝成功後,會要/opt/tslib-1.0/install目錄下有相應的安裝檔案,然後要對其配置進行一點點的修改,執行如下命令:
cd  /opt/tslib-1.0/install/etc
vi ts.conf

去掉ts.conf中的module_raw input 前面的#號,我的最終ts.conf檔案內容為:

# Uncomment if you wish to use the linux input layer event interface

module_raw input

 

# Uncomment if you're using a Sharp Zaurus SL-5500/SL-5000d

# module_raw collie

 

# Uncomment if you're using a Sharp Zaurus SL-C700/C750/C760/C860

# module_raw corgi

 

# Uncomment if you're using a device with a UCB1200/1300/1400 TS interface

# module_raw ucb1x00

 

# Uncomment if you're using an HP iPaq h3600 or similar

# module_raw h3600

 

# Uncomment if you're using a Hitachi Webpad

# module_raw mk712

 

# Uncomment if you're using an IBM Arctic II

# module_raw arctic2

 

module pthres pmin=1

module variance delta=30

module dejitter delta=100

module linear

將tslib下載到開發板,我存放tslib的目錄是/usr/local,把編譯後產生的bin、lib、etc、include放到此目錄下。

在開發板設定環境變數

export TSLIB_FBDEVICE=/dev/fb0

export TSLIB_TSDEVICE=/dev/input/event0 

export TSLIB_CONFFILE=/usr/local/etc/ts.conf

export TSLIB_PLUGINDIR=/usr/local/lib/ts

export TSLIB_CALIBFILE=/etc/pointercal

export TSLIB_CONSOLEDEVICE=none

export LD_LIBRARY_PATH=$QTDIR/lib:/usr/local/lib:$LD_LIBRARY_PATH

./ts_calibrate 進行測試。如果一切正常,進入下一步移植qt。

 

 

2.、因為QT是跨平台的,同樣的程式,在ARM上和PC上都能跑起來,只要修改其編譯配置即可,所以為了以後開發效率,可以
在PC上先模擬其效果,所以也安裝個QT的Linux/X11版本。

安裝QT的Linux/X11版本(http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.8.1.tar.gz)

下載QT:qt-everywhere-opensource-src-4.8.1.tar.gz

將qt-everywhere-opensource-src-4.8.1.tar.gz複製到/tmp目錄下,執行命令:

cd /opt

tar -xvzf /tmp/qt-everywhere-opensource-src-4.8.1.tar.gz

cd qt-everywhere-opensource-src-4.8.1

./configure -prefix /opt/qt-4.8.1-x11

make

make install

為了怕其配置影響下一步的embedded Linux版本的安裝,刪除/opt/qt-everywhere-opensource-src-4.8.1目錄

 

3、安裝QT的embedded Linux版本(http://qt-project.org/doc/qt-4.8/installation.html)

將qt-everywhere-opensource-src-4.8.1.tar.gz複製到/tmp目錄下(與上一步是同一個檔案,若上一步已作了,就不用複製了),執行命令:

cd /opt

tar -xvzf /tmp/qt-everywhere-opensource-src-4.8.1.tar.gz

cd qt-everywhere-opensource-src-4.8.1

./configure -prefix /opt/qt-4.8.1-arm -embedded arm -xplatform qws/linux-arm-g++ -depths 16,18,24,32 -no-glib -no-cups -no-largefile -no-accessibility -no-openssl -no-gtkstyle -no-qt3support -no-phonon -no-webkit -no-libtiff -no-libmng -qt-zlib -qt-libpng -qt-libjpeg -no-nis -no-dbus -little-endian -host-little-endian -qt-freetype -qt-gfx-transformed -qt-gfx-vnc -qt-gfx-linuxfb -qt-gfx-multiscreen -qt-kbd-tty -qt-mouse-tslib -I/opt/tslib-1.0/install/include -L/opt/tslib-1.0/install/lib

make

make install

把 /opt/qt-4.8.1-arm目錄下的imports、lib、mkspecs 、plugin等目錄複寫到開發板上的opt/Qtopia目錄下

 

4、安裝QT Creator

下載qt-creator-linux-x86-opensource-2.4.1.bin   (http://get.qt.nokia.com/qtcreator/qt-creator-linux-x86-opensource-2.4.1.bin)

將qt-creator-linux-x86-opensource-2.4.1.bin複製到/tmp目錄下,執行命令:

chmod +x qt-creator-linux-x86-opensource-2.4.1.bin

./qt-creator-linux-x86-opensource-2.4.1.bin

運行QT Creator,點擊工具->選項:

進入構建和運行->工具鏈,點擊添加,設定編譯器路徑為/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-g++,點擊應用

進入構建和運行->QT版本,點擊添加,設定qmake路徑為/opt/qt-4.8.1-arm/bin/qmake,點擊應用
進入構建和運行->QT版本,點擊添加,設定qmake路徑為/opt/qt-4.8.1-x11/bin/qmake,點擊應用

程式測試
用QT Creator開啟一個qt的example或者demo,比如用analogclock這個demo,開啟工程中,因為剛才設定了兩工具連,所以構建中就可以選擇qt-4.8.1-x11或qt-4.8.1-arm平台,這兩平台下又有對應的Debug和release版本,先用PC版本平台構建並運行測試一下,沒問題後,兩構建arm平台的程式,在pc平台下,開啟工程後,其預設的配置不用修改就可以編譯並運行,但arm平台下,先刪除原來的qmake步驟,自己添加一個自訂進程步驟,命令:qmake
                                             工作目錄:%{buildDir}
                                              命令參數: %{sourceDir}
並啟用這個自訂處理步驟,然後進行編譯,編譯成功產生analogclock並下載到arm板上。

在程式運行之前,先設定其環境變數,設定的環境變數如下:
export TSLIB_FBDEVICE=/dev/fb0

export TSLIB_TSDEVICE=/dev/input/event0 

export TSLIB_CONFFILE=/usr/local/etc/ts.conf

export TSLIB_PLUGINDIR=/usr/local/lib/ts

export TSLIB_CALIBFILE=/etc/pointercal

export QTDIR=/opt/Qtopia

export QPEDIR=/opt/Qtopia

export PATH=$QTDIR/bin:$PATH

export LD_LIBRARY_PATH=$QTDIR/lib:/usr/local/lib:$LD_LIBRARY_PATH

export QT_QWS_FONTDIR=/opt/Qtopia/lib/fonts/

export QWS_SIZE=240x320

export set QWS_DISPLAY="LinuxFb:mmWidth80:mmHeight120:0"

export set QWS_DISPLAY="LinuxFB:/dev/fb0" 

export set QWS_MOUSE_PROTO=Tslib:/dev/input/event0

export TSLIB_CONSOLEDEVICE=none

./analogclock -qws  正常情況下,這程式就可以在arm板上運行起來了
若程式中,有字型顯示大小不可適,調整以下參數試試。
export set QWS_DISPLAY="LinuxFb:mmWidth80:mmHeight120:0"

一些參考網址

http://blog.chinaunix.net/uid-20788517-id-34707.html

http://blog.chinaunix.net/uid-20788517-id-1748232.html

http://blog.chinaunix.net/uid-20788517-id-34706.html

http://www.arm9home.net/read.php?tid-16101.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.