搭建NUC977的linux和QT开发环境

0 评论
/
9 阅读
/
4813 字
18 2025-02

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、中文显示

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

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

把lib/fonts中的其他字体全部删除,只保留泉驿正黑字体的qpf字体库。

这样只需要运行./hello -qws 即可 不过这样以来就用不了其他字体了。

经过测试:中文显示正常。 字体名称: 文泉驿正黑字体qpf字体库 文泉驿正黑字体qpf字体库,可用于qt4的中文字体

  font_wenquanyi\wenquanyi_160_50.qpf
  ..............\wenquanyi_150_50.qpf
  ..............\wenquanyi_130_75.qpf
  ..............\wenquanyi_150_75.qpf
  ..............\wenquanyi_160_75.qpf
  ..............\wenquanyi_130_50.qpf
  ..............\wenquanyi_120_75.qpf
  ..............\wenquanyi_120_50.qpf
  font_wenquanyi

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

    暂无数据