零、配置Arm-gcc
在http://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/arm-linux-gnueabihf/ 下 gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf.tar.xz
解压后 在/home/sfe1012/.bashrc文件的最后面添加
export PATH=/home/sfe1012/MrcMoveProject/tools/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/bin:$PATH
命令:source .bashrc
一、移植tslib
下载:https://github.com/kergoth/tslib
1、./autogen.sh2、./configure CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ --host=arm-linux-gnueabihf --prefix=/home/sfe1012/MrcMoveProject/QtMove/tslib-master/tslib/ ac_cv_func_malloc_0_nonnull=yes
3、 make
4、sudo make install
二、移植QT
到QT官网 下载 qt-everywhere-opensource-src-5.8.0
1、更改文件 /qt-everywhere-opensource-src-5.8.0/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf 如下:
#
# qmake configuration for building with arm-linux-gnueabi-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
QT_QPA_DEFAULT_PLATFORM = linux #eglfs
QMAKE_CFLAGS_RELEASE += -O2 -march=armv7-a
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# modifications to g++.conf
QMAKE_CC = arm-linux-gnueabihf-gcc
QMAKE_CXX = arm-linux-gnueabihf-g++
QMAKE_LINK = arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = arm-linux-gnueabihf-g++
# modifications to linux.conf
QMAKE_AR = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy
QMAKE_NM = arm-linux-gnueabihf-nm -P
QMAKE_STRIP = arm-linux-gnueabihf-strip
load(qt_config)
2、创建configure 自动配置文件 /qt-everywhere-opensource-src-5.8.0/autoConfigure.sh 如下:
#!/bin/sh
./configure \
-v \
-prefix /home/sfe1012/MrcMoveProject/QtMove/qt-everywhere-opensource-src-5.8.0/Arm-Qt \
-release \
-c++std c++1z \
-c++std c++14 \
-c++std c++11 \
-opensource \
-make libs \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-pch \
-no-sql-psql \
-qt-libjpeg \
-qt-zlib \
-no-opengl \
-skip qt3d \
-skip qtcanvas3d \
-skip qtpurchasing \
-no-sse2 \
-no-openssl \
-no-cups \
-no-glib \
-no-iconv \
-nomake examples \
-nomake tools \
-skip qtvirtualkeyboard \
-I/home/sfe1012/MrcMoveProject/QtMove/tslib-master/tslib/include \
-L/home/sfe1012/MrcMoveProject/QtMove/tslib-master/tslib/lib
exit
命令:chmod 777 qt.configure.sh
./autoConfigure.sh
3、编译 安装
make -j4 && make install
4、下载中英文字库
http://font.ubuntu.com/ 下载字体库 ubuntu-font-family-0.83.zip
https://sourceforge.net/projects/wqy/files/wqy-zenhei-snapshot/ 下载 wqy-zenhei-0.9.46-May.tar.bz2
5、配置arm开发板
将/home/sfe1012/MrcMoveProject/QtMove/qt-everywhere-opensource-src-5.8.0/Arm-Qt和/home/sfe1012/MrcMoveProject/QtMove/tslib-master/tslib拷贝到开发板的 /opt/Qt5.8和 /opt/tslib 的目录下。将字体库解压后的文件拷贝到/opt/Qt5.8/lib/fonts 目录下
配置/etc/profile文件 如下:
export TSLIB_ROOT=/opt/tslib
export QT_ROOT=/opt/Qt5.8
export TSLIB_TSDEVICE=/dev/input/ts0
export TSLIB_TSEVENTTYPE=input
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export QWS_MOUSE_PROTO=tslib:/dev/input/ts0
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:$QT_ROOT/lib:$TSLIB_ROOT/lib:$LD_LIBRARY_PATH
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_QPA_FONTDIR=$QT_ROOT/lib/fonts
#export QT_QPA_GENERIC_PLUGINS=tslib
三、配置主机的QtCreator开发环境
安装qtcreator
进入qtcreator开发环境
在菜单中选择Tools——Options,在弹出的对话框中,选择Build & Run,选择标签Compilers,按下图设置,选择C++交叉编译器,如下图所示:
切换到Qt Versions标签,点击“Add”按钮,选择qmake,如图所示:
选择完成,按“OK”按钮,设置如图所示:
切换到Kits标签,点击“Add”按钮,然后设置如下图所示:
用法 在Qt-creator 的projects 的功能下可以选择添加的 编译器
四、微雪屏幕配置
直接修改config.txt文件
在树莓派网站下载RASPBIAN镜像,并在config.txt文件的最后加上以下代码即可
- max_usb_current=1
- hdmi_group=2
- hdmi_mode=87
- hdmi_cvt 1024 600 60 6 0 0 0