NUC972开发板qt移植

1、开发环境

编译器:官方提供的arm-linux-gcc 4.8.4

操作系统:ubuntu 14.04 32位

2、步骤

(1)运行BSP目录的install.sh,QT/ReadMe目录下的software.sh。

(2)编译uboot,之后会产生mkimage,把mkimage添加到环境变量。

(3)按照手册配置内核,编译内核。根文件系统在nfs服务器。

(4)编译busybox,制作根文件系统。

(5)从网上下载tslib。配置,编译,脚本如下:

#!/bin/bash
./autogen.sh
echo "ac_cv_func_malloc_0_nonnull=yes">arm-linux.cache
mkdir /opt/tslib
./configure --prefix=/opt/tslib --host=arm-linux --cache-file=arm-linux.cache

编译完毕,记得修改tslib/etc/ts.config,去掉module_raw_input前面的#。

之前用4.4.3的编译器编译的错误:selected device is not a touchscreen I understand

解决:来源于http://bbs.elecfans.com/jishu_1532650_1_1.html

1.将内核源代码里的include/linux/input.h中的
#define EV_VERSION0x010001
改为:
#define EV_VERSION0x010000

2.将arm交叉编译工具中的头文件库中的
linux/input.h中的
#define EV_VERSION0x010000
改为
#define EV_VERSION0x010001
然后再编译tslib库

复制tslib文件夹到开发板根文件系统的/opt/目录下。

(6)编译qt:

先要修改qmake.conf,

#
# qmake configuration for building with arm-linux-g++
#

include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = arm-linux-gcc -lts
QMAKE_CXX               = arm-linux-g++ -lts
QMAKE_LINK              = arm-linux-g++ -lts
QMAKE_LINK_SHLIB        = arm-linux-g++ -lts

# modifications to linux.conf
QMAKE_AR                = arm-linux-ar cqs
QMAKE_OBJCOPY           = arm-linux-objcopy
QMAKE_STRIP             = arm-linux-strip 

# Support static build.
#QMAKE_LFLAGS            = -static

# Reduce code size.
QMAKE_CFLAGS_RELEASE    = -Os
QMAKE_CXXFLAGS_RELEASE  = -Os

# Include/library path for tslib
QMAKE_INCDIR            = /opt/tslib/include
QMAKE_LIBDIR            = /opt/tslib/lib

load(qt_config)

配置脚本如下:

#!/bin/sh
rm -rf /opt/qt
mkdir -p /opt/qt
chmod 777 /opt/qt
./configure -force-pkg-config \
-prefix /opt/qt \
-release \
-opensource \
-shared \
-qconfig dist \
-no-exceptions \
-no-accessibility \
-no-stl \
-no-qt3support \
-no-xmlpatterns \
-no-multimedia \
-no-audio-backend \
-no-phonon \
-no-phonon-backend \
-no-svg \
-no-webkit \
-no-javascript-jit \
-no-script \
-no-scripttools \
-no-declarative \
-no-declarative-debug \
-qt-zlib \
-qt-freetype \
-no-gif \
-qt-libpng \
-no-libmng \
-no-libtiff \
-qt-libjpeg \
-no-openssl \
-nomake tools \
-nomake demos \
-nomake examples \
-nomake docs \
-nomake translations \
-no-nis \
-no-cups \
-no-iconv \
-no-pch \
-no-dbus \
-embedded arm \
-platform qws/linux-x86-g++ \
-xplatform qws/linux-nuc970-g++ \
-no-gtkstyle \
-no-nas-sound \
-no-opengl \
-no-openvg \
-no-sm \
-no-xshape \
-no-xvideo \
-no-xsync \
-no-xinerama \-no-xcursor \
-no-xfixes \
-no-xrandr \
-no-xrender \
-no-mitshm \
-no-fontconfig \
-no-xinput \
-no-xkb \
-no-glib \
-qt-gfx-linuxfb \
-qt-mouse-tslib \
-qt-kbd-linuxinput

然后make,make install。

执行完毕,复制qt文件夹到开发板根文件系统的/opt/目录下。

(7)设置环境变量。

export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/opt/tslib/etc/ts.conf
export TSLIB_PLUGINDIR=/opt/tslib/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/tslib/lib:/opt/qt/lib
export TSLIB_INFO_FILE=/sys/class/input/event0/uevent



export QWS_MOUSE_PROTO=Tslib:/dev/input/event0
export QWS_DISPLAY="LinuxFB:mmWidth=129:mmHight=80:offect=0"
export QT_QWS_FONTDIR=/opt/qt/lib/fonts
#这里存放qt的可执行程序
export PATH=$PATH:/apps

3、中文显示

参考:https://www.veryarm.com/6354.html

下载文泉驿正黑字体qpf字体库

把下载好的字体库解压后的qpf文件放入lib/fonts中

把lib/fonts中的其他字体全部删除,只保留泉驿正黑字体的qpf字体库。这样只需要运行./hello -qws 即可 不过这样以来就用不了其他字体了。

经过测试:中文显示正常。

字体文件下载地址:https://www.linuxidc.com/Linux/2012-03/56659.htm

 

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值