基本命令
tar zxvf file..tar.gz
tar jxvf file.tar.bz2
方法一:
./configure
make
make install
方法二:
./configure --prefix=/路径
make ;
make install
方法三:
./configure --enable-static-link \
--prefix=$XXX/static --with-curses &&
make &&
make install
交叉编译环境
arm-linux-gcc-3.4.1.tar.bz2 解压得usr/local/ 文件夹,将arm文件夹考
到/usr/local/下
现在交叉编译程序集都位于/usr/local/arm/3.4.1/bin下面了
/etc/bash.bashrc文件的最后一行添加命令
export PATH=/usr/local/arm/3.4.1/bin:$PATH
保存重新登录测试echo $PATH arm-linux-gcc –v
QT环境的搭建
1. x11
qt-x11-opensource-src-4.5.3.tar.bz2 解压改名为qt
$ ./configure
$ make
cd tools/qvfb
make
2. embedded
qt-embedded-linux-opensource-src-4.5.3.tar.bz2
将 qt-embedded-linux-opensource-src-4.5.3.tar.bz2压缩包解压为2份,分别编译
嵌入式 x86 和 arm 二个版本。
1. 嵌入式x86版:
$ ./configure -embedded x86 -qvfb
$ make
# make install
将qt/bin下qvfb复制至/usr/local/Trolltech/QtEmbedded-4.5.3-x86/bin下
setenv.sh内容:
QTEDIR=/usr/local/Trolltech/QtEmbedded-4.5.3-x86
PATH=/usr/local/Trolltech/QtEmbedded-4.5.3-x86/bin:$PATH
LD_LIBRARY_PATH=/usr/local/Trolltech/QtEmbedded-4.5.3-
x86/lib:$LD_LIBRARY_PATH
移到/usr/local/Trolltech/QtEmbedded-4.5.3-x86中。
cd /usr/local/Trolltech/QtEmbedded-4.5.3-x86
source setenv.sh
cd /usr/local/Trolltech/QtEmbedded-4.5.3-x86/demos/books
qvfb -width 640 -height 480 & //运行一个绿色屏幕
./books –qws //qt程序运行
2.嵌入式arm版:
./configure -prefix /usr/local/Trolltech/QtEmbedded-4.5.3-arm -embedded arm
make
make install // make install-strip//压缩模式
编译tslib:需要autoconf, automake, libtool
下载,tslib1.4.tar.gz
$ ./configure --prefix=/usr/local/tslib/ --host=arm-linux
ac_cv_func_malloc_0_nonnull=yes
$ make
# make install
2410开发板的步骤
连好线,配置ip为192.168.1.180, 打开windows附件中的超级终端,打开开发板,超级终
端中出现了uboot信息,设置tftp的目录
tftp 30800000 ramdisk.gz
tftp 30008000 zImage
go 30008000
进入linux
远程Windows IP:192.168.1.180 (administrator/123456) 共享目录为c:\Download
mount -t cifs –o username=administrator,password=123456
192.168.1.180:Download /mnt/nfs
QT tslib复制到开发板上
将PC机上/usr/local/Trolltech/QtEmbedded-4.5.3-arm/lib 中复制到2410
的/usr/local/Trolltech/QtEmbedded-4.5.3-arm/lib
libQtGui.so.4 libts-0.0.so.0 libQtCore.so.4 libQtNetwork.so.4
libQtWebKit.so
将PC机上/usr/local/tslib中的库复制到2410的/usr/local
开机自动设置环境变量,在2410的 /etc/profile中追加:
export LD_LIBRARY_PATH=/usr/local/lib:$QTDIR/lib:$LD_LIBRARY_PATH
export TSLIB_ROOT=/usr/local/lib
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_PLUGINDIR=/usr/local/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_CONFFILE=/usr/local/etc/ts.conf
export POINTERCAL_FILE=/etc/pointercal
export TSLIB_CALIBFILE=/etc/pointercal
export QWS_MOUSE_PROTO=Tslib:/dev/input/event0
注:可用$ cat /dev/input/event0 测试触摸屏
取消/usr/local/etc/ts.conf中的第一个注释:
# module_raw input (去掉#,并且该行顶格)
运行 /usr/local/bin/ts_calibrate 校正触摸屏
cd /
cd tslib/bin
./ts_calibrate 校准触摸屏
./ts_test 测试触摸屏
#include <qapplication.h>
#include <qpushbutton.h>
int main( int argc, char **argv )
{ QApplication a( argc, argv );
QPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 );
a.setMainWidget( &hello );
hello.show();
return a.exec();
}
注意一点的是, 基于QVFB, Framebuffer的Qt使用的是默认字体, 所有在显示中文上有
些问题. 需要在程序中重新设置中文字体, 不然browser打开中文网页就是方块了 .
我使用了微软的雅黑字体.
在main.cpp中添加一句:
app.setFont( QFont( "Microsoft YaHei", 10, QFont::Normal ) );
记得将msyh.tty拷贝到字体目录下 :)
#include <qapplication.h>
#include <qpushbutton.h>
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 );
a.setMainWidget( &hello );
hello.show();
return a.exec();
}