$ chmod a+x i.MX6QSABRELite-development-environment.sh
$ ./i.MX6QSABRELite-development-environment.sh
$ gedit .bashrc export PATH=/home/wps/timesys/i_MX6QSABRELite/toolchain/ccache:/home/wps/timesys/i_MX6QSABRELite/toolchain/bin:$PATH
$ source ~/.bashrc
$./configure --host=arm-linux --prefix=/usr/local/dbus-1.8.20_sabrelite CC=/home/wps/timesys/i_MX6QSABRELite/toolchain/bin/armv7l-timesys-linux-gnueabi-gcc --without-x
$make
$sudo make install
#!/bin/sh
make clean && make distclean
echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
CC=/home/wps/timesys/i_MX6QSABRELite/toolchain/bin/armv7l-timesys-linux-gnueabi-gcc ./configure --host=arm-linux --prefix=/usr/local/tslib-1.4_sabrelite --cache-file=arm-linux.cache
sudo make && sudo make install
$./configure -v -opensource -confirm-license -no-pch -no-xcb -no-openssl -no-opengl -opengl es2 -dbus -qt-zlib -no-sse2 -no-iconv -tslib -make libs -device imx6 -device-option CROSS_COMPILE=/home/wps/timesys/i_MX6QSABRELite/toolchain/bin/armv7l-timesys-linux-gnueabi- -sysroot /home/wps/timesys/i_MX6QSABRELite/rfs/rootfs/ -no-gcc-sysroot -prefix /home/wps/programs/qt/Qt5.4.2/qt-5.4.2_sabrelite -make examples -nomake tools -nomake tests -fontconfig -qt-libpng -qt-libjpeg -plugin-sql-sqlite -widgets -qt-sql-sqlite -no-cups -no-nis -no-openssl -no-accessibility -silent -qt-freetype -no-glib -strip -linuxfb -plugindir /usr/local/qt-5.4.2_sabrelite/plugins -I/usr/local/tslib-1.4_sabrelite/include -L/usr/local/tslib-1.4_sabrelite/lib
$make -j4
$sudo make install
/usr/local/qt-5.4.2_sabrelite
/usr/local/tslib-1.4_sabrelite
/usr/local/dbus-1.8.20_sabrelite
当然打开QtCreater,配置Kits。
首先配置编译器目录。在交叉工具链中。
配置Qt版本
最后配置开发套件。
至此完成配置工作,新建QWidget项目。将/home/wps/nfs目录挂载到开发板/mnt目录下。详情参见他人教程。
将以下命令写入/etc/init.d/rcS文件中实现开机自动配置IP,挂载。
ifconfig eth0 192.168.0.199 netmask 255.255.255.0
route add default gw 192.168.0.253
mount -t nfs 192.168.0.190:/home/wps/nfs /mnt -o nolock
新建项目存放在/home/wps/nfs/qtdemo中,编译arm版本程序,使用minicom进入开发板/mnt/*知道执行文件目录,执行。
四、OpenCV2.4.9编译。
上文中已经完成Qt的编译,接下来需要进行OpenCV的编译。
(1)、首先编译PC端OpenCV。
参见这篇文章,PC端编译比较简单,出错较少,安装目录在/home/wps/programs/opencv/opencv2.4.9/x86
http://blog.csdn.net/romeolikejuliet/article/details/53223285
(2)、然后ARM端编译。
这里的编译需要使用CMAKE工具,同时出错较多。
配置信息
General configuration for OpenCV 2.4.9 =====================================
Version control: unknown
Platform:
Host: Linux 4.2.0-27-generic x86_64
Target: Linux
CMake: 2.8.12.2
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: Release
C/C++:
Built as dynamic libs?: YES
C++ Compiler: /home/wps/timesys/i_MX6QSABRELite/toolchain/bin/armv7l-timesys-linux-gnueabi-g++ (ver 4.7.3)
C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -g -O0 -DDEBUG -D_DEBUG
C Compiler: /home/wps/timesys/i_MX6QSABRELite/toolchain/bin/armv7l-timesys-linux-gnueabi-gcc
C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release):
Linker flags (Debug):
Precompiled headers: YES
OpenCV modules:
To be built: core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib stitching superres ts videostab
Disabled: world
Disabled by dependency: -
Unavailable: androidcamera dynamicuda java python viz
GUI:
QT: NO
GTK+ 2.x: NO
GThread : NO
GtkGlExt: NO
OpenGL support: NO
VTK support: NO
Media I/O:
ZLib: build (ver 1.2.7)
JPEG: build (ver 62)
PNG: build (ver 1.5.12)
TIFF: build (ver 42 - 4.0.2)
JPEG 2000: NO
OpenEXR: build (ver 1.7.1)
Video I/O:
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: NO
codec: NO
format: NO
util: NO
swscale: NO
gentoo-style: NO
GStreamer: NO
OpenNI: NO
OpenNI PrimeSensor Modules: NO
PvAPI: NO
GigEVisionSDK: NO
UniCap: NO
UniCap ucil: NO
V4L/V4L2: NO/YES
XIMEA: NO
Xine: NO
Other third-party libraries:
Use IPP: NO
Use Eigen: NO
Use TBB: NO
Use OpenMP: NO
Use GCD NO
Use Concurrency NO
Use C=: NO
Use Cuda: NO
Use OpenCL: YES
OpenCL:
Version: dynamic
Include path: /home/wps/programs/opencv/source/opencv-2.4.9/3rdparty/include/opencl/1.2
Use AMD FFT: NO
Use AMD BLAS: NO
Python:
Interpreter: /usr/bin/python2 (ver 2.7.6)
Java:
ant: NO
JNI: NO
Java tests: NO
Documentation:
Build Documentation: NO
Sphinx: NO
PdfLaTeX compiler: NO
Tests and samples:
Tests: YES
Performance tests: YES
C/C++ Examples: YES
Install path: /home/wps/programs/opencv/opencv2.4.9/opencv-2.4.9_sabrelite
cvconfig.h is in: /home/wps/programs/opencv/source/opencv2.4.9/bulid
-----------------------------------------------------------------
Configuring done
Generating done
安装至/home目录下解决问题。
libQtGui.so.5,needed by libopencv_higui.so no find.
libQtWidgets.so.5,needed by libopencv_higui.so no find.
libQtTest.so.5,needed by libopencv_higui.so no find.
libQtConcurrent.so.5,needed by libopencv_higui.so no find.
其他配置,可以自行尝试。
多次Configue,最后Generate。
之后进入/home/wps/programs/opencv/source/opencv2.4.9/build就可以make -j4 && make install了。
!!!等等!!!!
别慌,这是要犯错误的。
由于本文采用的是64位系统,
`a local symbol' can not be used when making a shared object; recompile with -fPIC
会出现这样的-PIC错误,
参见http://ask.csdn.net/questions/70191;
进入opencv目录下的3rdparty的对应目录CMakeFiles/ *.dir下,
打开flags.make,在C_FLAGS = 后添加-O3 -fPIC用来支持在64位机上编译
如../3rdparty/zlib/CMakeFiles/zlib.dir/flags.make
修改C_FLAGS = -W -Wall 为 C_FLAGS = -O3 -fPIC -W -Wall 和
修改CXX_FLAGS = -W -Wall 为 C_FLAGS = -O3 -fPIC -W -Wall
如红笔所示
之后进入/build目录
$make -j4
$make install
收先使用英蓓特公司提供的配置代码,在.config文件中查找USB_Video_Class = y保存后,编译。
接下来。。。
正常移植就好。
开机之后相关配置。
系统配置:
1、在uboot中输入命令如下:
setenv bootargs console=ttymxc1,115200 video=mxcfb0:dev=ldb,LDB-XGA,if=RGB666
最后记得 saveenv 再 bootm 启动kernel
2、删除/etc/init.d/S99-fluidlauncher,关闭开机自启动,或者复制到/home/sysbackup
3、触摸屏校正:第一次使用开发板开机后要使用 ts_calibrate 命令对触摸屏进行校正后再使用
4、设置开机启动项,自动挂载至主机
#---------------------------------------
#/etc/init.d/rcS 开机启动
ifconfig eth0 192.168.0.199 netmask 255.255.255.0
route add default gw 192.168.0.253
mount -t nfs 192.168.0.190:/home/wps/nfs /mnt -o nolock
5、复制相关包进入开发板,包括Qt5.4.2,OpenCV2.4.9, dbus-1.8.20,tslib-1.4
在/usr下建立local文件夹,
在local下分别建立,qt-5.4.2_sabrelite ,opencv-2.4.9_sabrelite,dbus-1.8.20_sabrelite,tslib-1.4_sabrelite,
将编译好的文件复制进去。
6、通过dbus-1.8.20获取machine-id
添加到/etc/machine-id中
7、配置
#/etc/profile
#Qt-5.4.2
export QTDIR=/usr/local/qt-5.4.2_sabrelite
export LD_LIBRARY_PATH=/lib:$QTDIR/lib:$LD_LIBRARY_PATH
export QT_QWS_FONTDIR=/lib/fonts:$QTDIR/lib/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_QPA_GENERIC_PLUGINS=evdevtouch:/dev/input/event1
export QML2_IMPORT_PATH=$QTDIR/qml
#OpenCV-2.4.
export OPENCVDIR=/usr/local/opencv-2.4.9_sabrelite
export LD_LIBRARY_PATH=/lib:$OPENCVDIR/lib:$LD_LIBRARY_PATH
#Dbus-1.8.20
export DBUSDIR=/usr/local/dbus-1.8.20 _sabrelite
export LD_LIBRARY_PATH=/lib:$DBUSDIR/lib:$LD_LIBRARY_PATH
#Tslib-1.4
export TSLIBDIR=/usr/local/tslib-1.4_sabrelite
export LD_LIBRARY_PATH=/lib:$TSLIBDIR/lib:$LD_LIBRARY_PATH
至此系统搭建完成,在开始使用时出现字体无法显示情况,折腾半天,出了一些错,现将软件安装至系统目录下,将qt中的fonts文件夹复制进/lib目录中,并更新/etc/profile文件,目前来看成功了。。。。
如果还是出错,重新编过,注意总结就好。。。。
看我,今天下雨,天气不错,请忽视IP。。。。