Qtopia2.2.0 移植
第一步:编译 jpeg-6b 得到 jpeg 库
先使用命令进行配置: ./configure –enable-shared –enable-static –prefix=/install_software –build=i386 –host=arm
然后修改生成的 Makefile , 如下:
CC= gcc 修改为: CC= arm-linux-gcc
AR= ar rc 修改为: AR= arm-linux-ar rc
AR2= ranlib 修改为: AR2=arm-linux-ranlib
最后是编译和安装
make
安装之前要在安装的路径下面建几个目录: /man/man1 , /lib , /include , /bin, 否则提示:
No such file or directory
make install-lib
第二步:编译 e2fsprogs-1.41.4 得到 uuid 库
在源文件目录下建立一个目录放 mke2fs 工具: mkdir build
# cd build
#../configure –with-cc=arm-linux-gcc –with-linker=arm-linux-ld --enable-elf-shlibs --host=arm -prefix=/install_software/e2fsprogs
编译
#make
错误: In file included from ../../../lib/ext2fs/getsize.c:30:
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/fd.h:342: error: variable or field `__user'' declared void
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/fd.h:342: error: parse error before ''*'' token
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/fd.h:360: error: parse error before ''}'' token
make[2]: *** [getsize.o] Error 1
解决: 在引用 #include 的文档前面加上 #include
(原文没有写清具体是加什么东西,后来参考了一篇blog,解决了。特此感谢!)
在这个过程中关于e2fsprogs-1.39.tar.gz的交叉编译还会出现错误,这个问题挺难解觉,后来搜到一篇文章,我终于解觉了,方法是
修改/usr/local/arm/3.4.1/arm-linux/sys-include/linux
中fd.h
添加#include
安装
make install-libs
第三步: 编译触摸屏共享库 tslib-1.0(tslib-1.4 版本 )
( 1 ) # cd tslib-1.0/ 进入 tslib 的目录
( 2 ) # ./autogen.sh 生成 config 文件
( 3 ) # echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache // 为了防止出现 undefined reference to `rpl_malloc'' 错误
( 4 ) # ./configure –host=arm-linux –cache-file=arm-linux.cache -enable-inputapi=no --prefix=/opt/tslib1.4 //--prefix 增加安装路径
( 5 ) make
( 6 ) make install
( 7 )库文件在 /tslib-1.0/src/.lib
( 8 )拷贝各种文件
# cp ts_calibrate ts_harvest ts_print ts_print_raw ts_test /long_nfs/myfs-1/qtopia/bin/tests/ // 为根文件系统
# cp libts-0.0.so.0* /long_nfs/myfs-1/qtopia/lib
# cp libts.so /long_nfs/myfs-1/qtopia/lib
# cp tslib-1.0/plugins/.libs/*.so /long_nfs/myfs-1/qtopia/lib/ts
第四步:实现 qtopia-free-2.2.0 的移植
(1) 拷贝库文件
拷贝 uuid 库
cp –rfv build/lib/uuid qtopia/include
cp –fvr build/lib/libuuid.so* /usr/local/arm/3.4.1/arm-linux/lib
拷贝 jpeg 库
cp -rfv libjpeg.so* /Qtopia-repot/qtopia-free-2.2.0/qt2/lib
cp -fvr jpeglib.h /Qtopia-repot/qtopia-free-2.2.0/qt2/include // 解压出来没有 include 这个文件
cp -rfv libjpeg.so* /Qtopia-repot/qtopia-free-2.2.0/qtopia/lib
cp -fvr jpeglib.h /Qtopia-repot/qtopia-free-2.2.0/qtopia/include //include 是自己建立的,以后连接的时候注意一下路径
(2) 配置命令如下:
./configure -qte ''embedded -no-xft -xplatform linux-arm-g++ -qc
onfig qpe -depths 16,32 -no-qvfb -system-jpeg -gif -tslib'' -qpe ''-xplatform linux-arm-g++ -edition
pda -displaysize 240x320'' -qt2 ''-no-xft'' -dqt ''-no-xft''
(3) 修改文件
vi/home/arm/qtopia-free-2.2.0/qtopia/mkspecs/qws/linux-arm-g++/qmake.conf
将此行 QMAKE_LIBS_QT = -lqte
修改为
QMAKE_LIBS_QT = -lqte -lpng -lts -lz -luuid –ljpeg //(-lpng 需要 png 库, -lts 是连接 ts 库的 )
(4) export QTDIR=/home/arm/qtopia-free-2.2.0/qt2
export QPEDIR=/home/arm/qtopia-free-2.2.0/qtopia
export LD_LIBRARY_PATH=$QTDIR/lib:$QPEDIR/lib:$LD_LIBRARY_PATH
export TMAKEDIR=/home/arm/qtopia-free-2.2.0/tmake
export TMAKEPATH=$TMAKEDIR/lib/qws/linux-arm-g++
cd $QPEDIR/src/libraries/qtopia
cp custom-linux-ipaq-g++.cpp custom-linux-arm-g++.cpp
cp custom-linux-ipaq-g++.h custom-linux-arm-g++.h
(5) 另外一种 configure 方式,建议使用这种
#./configure -qte "-embedded -xplatform linux-arm-g++ -qconfig qpe-no-qvfb -depths 16,24 -system-jpeg -system-libpng -system-zlib -tslib -gif -thread -no-xft -release -I/home/arm/include -L//home/arm/lib -lpng -lts -lz-luuid -ljpeg" -qpe ''-xplatform linux-arm-g++ -edition pda -displaysize 320x240 -I/home/arm/include -L/home/arm/lib -prefix=/home/arm/qtopia''
解释: -I/ 是需要的头文件 –L/ 是需要连接的库文件,要增加触摸屏而且用到 tslib 的一定要加 -lts ,-prefix=/ 是设置安装路径的
(6) make 编译通过以后 make install 然后把相应的库文件拷贝到 qtopia ,然后将 qtopia 整个文件一起拷贝到根文件系统中,利用 NFS 挂载测试。 记着设置环境变量
export QTDIR=/qtopia
export QPEDIR=/qtopia
export QWS_MOUSE_PROTO=TPanel:/dev/ts0 ( 这个根据自己的情况设定 )
export LD_LIBRARY_PATH=/qtopia/lib
export TSLIB_TSEVENTTYPE=H3600 对 tslib 中的设备结构体定义
export TSLIB_CONSOLEDEVICE=none tslib 运行需要的控制台,这里就是 LCD 屏幕 , 设定控制台设备为 none ,否则默认为 /dev/tty
export TSLIB_FBDEVICE=/dev/fb0 指定帧缓冲设备
export TSLIB_TSDEVICE=/dev/ts0 ( 这个根据自己的情况设定 )
export TSLIB_CALIBFILE=/etc/pointercal 指定触摸屏校准文件 pintercal 的存放位置
export TSLIB_CONFFILE=/etc/ts.conf 指定 TSLIB 设置文件的位置
export TSLIB_PLUGINDIR=$QTDIR/lib/ts 指定触摸屏插件所在路径
(7) 校准
#cd /qtopia/bin/tests
#./ts_calibrate
再运行测试
#./ts_test
运行 PDA
#cd ..
#./qpe
出现“ Tap anywhere to continue ” , 然后进行 qpe5 点校准,进入 qpe
(8) 建立一个脚本用来运行 qtopia ,在开发板的根目录 /bin 下建立 qpe.sh 文件,它用来设置环境变量,启动 qtopia ,内容如下:
#!/bin/sh
export HOME=/root
export QTDIR=/qtopia
export QPEDIR=/qtopia
export QWS_DISPLAY=LinuxFb:/dev/fb0
export QWS_KEYBOARD="TTY:/dev/tty1"
#export QWS_MOUSE_PROTO="USB:/dev/mouse0"
export QWS_MOUSE_PROTO="TPanel:/dev/ts0"
export PATH=$QPEDIR/bin:$PATH
export LD_LIBRARY_PATH=$QPEDIR/lib:$LD_LIBRARY_PATH
export TSLIB_PLUGINDIR=$QTDIR/lib/ts
$QPEDIR/bin/qpe &
(9) 编译的时候出现的错误
kernel/qwsmouse_qws.cpp:63:19: tslib.h: No such file or directory
kernel/qwsmouse_qws.cpp: In member function `void QTSLibHandlerPrivate::openTs()'':
kernel/qwsmouse_qws.cpp:1773: error: `ts_open'' undeclared (first use this function)
kernel/qwsmouse_qws.cpp:1773: error: (Each undeclared identifier is reported only once for each function it appears in.)
kernel/qwsmouse_qws.cpp:1780: error: `ts_config'' undeclared (first use this function)
kernel/qwsmouse_qws.cpp:1784: error: `ts_fd'' undeclared (first use this function)
kernel/qwsmouse_qws.cpp: In member function `void QTSLibHandlerPrivate::closeTs()'':
kernel/qwsmouse_qws.cpp:1793: error: `ts_close'' undeclared (first use this function)
kernel/qwsmouse_qws.cpp: In member function `void QTSLibHandlerPrivate::readMouseData()'':
kernel/qwsmouse_qws.cpp:1855: error: aggregate `ts_sample sample'' has incomplete type and cannot be defined
kernel/qwsmouse_qws.cpp:1863: error: `ts_read'' undeclared (first use this function)
kernel/qwsmouse_qws.cpp: In member function `void QTSLibHandlerPrivate::interpolateSample()'':
kernel/qwsmouse_qws.cpp:1882: error: elements of array `ts_sample samples[25]'' have incomplete type
kernel/qwsmouse_qws.cpp:1882: error: storage size of `samples'' isn''t known
kernel/qwsmouse_qws.cpp:1893: error: `ts_read_raw'' undeclared (first use this function)
kernel/qwsmouse_qws.cpp:1916: error: invalid application of `sizeof'' to incomplete type `ts_sample''
kernel/qwsmouse_qws.cpp:1920: error: invalid application of `sizeof'' to incomplete type `ts_sample''
kernel/qwsmouse_qws.cpp: In static member function `static int QTSLibHandlerPrivate::sortByX(const void*, const void*)'':
kernel/qwsmouse_qws.cpp:1931: error: invalid use of undefined type `const struct ts_sample''
kernel/qwsmouse_qws.cpp:1931: error: forward declaration of `const struct ts_sample''
kernel/qwsmouse_qws.cpp:1932: error: invalid use of undefined type `const struct ts_sample''
kernel/qwsmouse_qws.cpp:1931: error: forward declaration of `const struct ts_sample''
kernel/qwsmouse_qws.cpp: In static member function `static int QTSLibHandlerPrivate::sortByY(const void*, const void*)'':
kernel/qwsmouse_qws.cpp:1942: error: invalid use of undefined type `const struct ts_sample''
kernel/qwsmouse_qws.cpp:1942: error: forward declaration of `const struct ts_sample''
kernel/qwsmouse_qws.cpp:1943: error: invalid use of undefined type `const struct ts_sample''
kernel/qwsmouse_qws.cpp:1942: error: forward declaration of `const struct ts_sample''
kernel/qwsmouse_qws.cpp: At global scope:
kernel/qwsmouse_qws.cpp:1624: warning: unused parameter ''mouseDev''
kernel/qwsmouse_qws.cpp:1624: warning: unused parameter ''mouseDev''
kernel/qwsmouse_qws.cpp: In member function `void QTSLibHandlerPrivate::interpolateSample()'':
kernel/qwsmouse_qws.cpp:1882: error: storage size of `samples'' isn''t known
kernel/qwsmouse_qws.cpp: At global scope:
kernel/qwsmouse_qws.cpp:160: warning: ''void limitToScreen(QPoint&)'' defined but not used
make[1]: *** [tmp/release-shared-linux-arm-g++-no-keypad/kernel/qwsmouse_qws.o] Error 1
make[1]: Leaving directory `/root/2410s/qtopia-free-2.2.0/qt2/src''
解决: 将 tslib/src 目录下的 tslib.h tslib-filter.h tslib-private.h 拷贝到如下目录:
/root/2410s/qtopia-free-2.2.0/qtopia/include.
1:tsdev (compaq touchscreen emulation) is scheduled for removal.
See Documentation/feature-removal-schedule.txt for details.
这句是内核发出的,在 drivers/input/Tsdev.c tsdev_open()
2: option `module_raw'' not recognized
3: Cannot configure touchscreen /dev/ts0 (No such file or directory)
qt2/src/kernel/qwsmouse_qws.pp openTs() 发出的
解决:将 plugins 拷贝到根文件系统,正确指定 export TSLIB_PLUGINDIR 。
4: Couldnt load module input
No raw modules loaded.
ts_config: Success
解决:正确设置 TSLIB_PLUGINDIR ,而且要在 /etc/profile 中设置