NUC977 linux和QT环境搭建

本文详细介绍了一种基于Ubuntu 14.04和arm-linux-gcc4.8.4的嵌入式Linux开发环境搭建流程,包括编译uboot、内核、busybox、tslib及qt等关键步骤,并提供了配置、编译和调试的具体脚本,同时解决了tslib中文显示和编译错误等问题。

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。配置,编译,脚本如下:

 
  1. #!/bin/bash

  2. ./autogen.sh

  3. echo "ac_cv_func_malloc_0_nonnull=yes">arm-linux.cache

  4. mkdir /opt/tslib

  5. ./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. 1.将内核源代码里的include/linux/input.h中的

  2. #define EV_VERSION0x010001

  3. 改为:

  4. #define EV_VERSION0x010000

  5.  
  6. 2.将arm交叉编译工具中的头文件库中的

  7. linux/input.h中的

  8. #define EV_VERSION0x010000

  9. 改为

  10. #define EV_VERSION0x010001

  11. 然后再编译tslib库

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

(6)编译qt:

先要修改qmake.conf,

 
  1. #

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

  3. #

  4.  
  5. include(../../common/linux.conf)

  6. include(../../common/gcc-base-unix.conf)

  7. include(../../common/g++-unix.conf)

  8. include(../../common/qws.conf)

  9.  
  10. # modifications to g++.conf

  11. QMAKE_CC = arm-linux-gcc -lts

  12. QMAKE_CXX = arm-linux-g++ -lts

  13. QMAKE_LINK = arm-linux-g++ -lts

  14. QMAKE_LINK_SHLIB = arm-linux-g++ -lts

  15.  
  16. # modifications to linux.conf

  17. QMAKE_AR = arm-linux-ar cqs

  18. QMAKE_OBJCOPY = arm-linux-objcopy

  19. QMAKE_STRIP = arm-linux-strip

  20.  
  21. # Support static build.

  22. #QMAKE_LFLAGS = -static

  23.  
  24. # Reduce code size.

  25. QMAKE_CFLAGS_RELEASE = -Os

  26. QMAKE_CXXFLAGS_RELEASE = -Os

  27.  
  28. # Include/library path for tslib

  29. QMAKE_INCDIR = /opt/tslib/include

  30. QMAKE_LIBDIR = /opt/tslib/lib

  31.  
  32. load(qt_config)

配置脚本如下:

 
  1. #!/bin/sh

  2. rm -rf /opt/qt

  3. mkdir -p /opt/qt

  4. chmod 777 /opt/qt

  5. ./configure -force-pkg-config \

  6. -prefix /opt/qt \

  7. -release \

  8. -opensource \

  9. -shared \

  10. -qconfig dist \

  11. -no-exceptions \

  12. -no-accessibility \

  13. -no-stl \

  14. -no-qt3support \

  15. -no-xmlpatterns \

  16. -no-multimedia \

  17. -no-audio-backend \

  18. -no-phonon \

  19. -no-phonon-backend \

  20. -no-svg \

  21. -no-webkit \

  22. -no-javascript-jit \

  23. -no-script \

  24. -no-scripttools \

  25. -no-declarative \

  26. -no-declarative-debug \

  27. -qt-zlib \

  28. -qt-freetype \

  29. -no-gif \

  30. -qt-libpng \

  31. -no-libmng \

  32. -no-libtiff \

  33. -qt-libjpeg \

  34. -no-openssl \

  35. -nomake tools \

  36. -nomake demos \

  37. -nomake examples \

  38. -nomake docs \

  39. -nomake translations \

  40. -no-nis \

  41. -no-cups \

  42. -no-iconv \

  43. -no-pch \

  44. -no-dbus \

  45. -embedded arm \

  46. -platform qws/linux-x86-g++ \

  47. -xplatform qws/linux-nuc970-g++ \

  48. -no-gtkstyle \

  49. -no-nas-sound \

  50. -no-opengl \

  51. -no-openvg \

  52. -no-sm \

  53. -no-xshape \

  54. -no-xvideo \

  55. -no-xsync \

  56. -no-xinerama \-no-xcursor \

  57. -no-xfixes \

  58. -no-xrandr \

  59. -no-xrender \

  60. -no-mitshm \

  61. -no-fontconfig \

  62. -no-xinput \

  63. -no-xkb \

  64. -no-glib \

  65. -qt-gfx-linuxfb \

  66. -qt-mouse-tslib \

  67. -qt-kbd-linuxinput

  68.  

然后make,make install。

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

(7)设置环境变量。

 
  1. export TSLIB_TSDEVICE=/dev/input/event0

  2. export TSLIB_CALIBFILE=/etc/pointercal

  3. export TSLIB_CONFFILE=/opt/tslib/etc/ts.conf

  4. export TSLIB_PLUGINDIR=/opt/tslib/lib/ts

  5. export TSLIB_CONSOLEDEVICE=none

  6. export TSLIB_FBDEVICE=/dev/fb0

  7. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/tslib/lib:/opt/qt/lib

  8. export TSLIB_INFO_FILE=/sys/class/input/event0/uevent

  9.  
  10.  
  11.  
  12. export QWS_MOUSE_PROTO=Tslib:/dev/input/event0

  13. export QWS_DISPLAY="LinuxFB:mmWidth=129:mmHight=80:offect=0"

  14. export QT_QWS_FONTDIR=/opt/qt/lib/fonts

  15. #这里存放qt的可执行程序

  16. 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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值