Imx-4.1.15 Yocto-2.1 系统使用
该yocto系统是基于x11显示协议的嵌入式系统。系统集成的qt支持x11显示插件。
基础信息
用户密码
系统默认使用root用户登录,并支持root用户ssh远程登录,免密码。
QT开发
搭建qt开发环境
x86主机或虚拟机的系统用Ubuntu16.0或Ubuntu18.04进行交叉编译开发,开发环境配置参考如下:
Ubuntu16.04系统主机编译环境建议安装
sudo apt-get install repo git-core gitk git-gui gcc-arm-linux-gnueabihf u-boot-tools device-tree-compiler gcc-aarch64-linux-gnu mtools parted libudev-dev libusb-1.0-0-dev python-linaro-image-tools linaro-image-tools autoconf autotools-dev libsigsegv2 m4 intltool libdrm-dev curl sed make binutils build-essential gcc g++ bash patch gzip bzip2 perl tar cpio python unzip rsync file bc wget libncurses5 libqt4-dev libglib2.0-dev libgtk2.0-dev libglade2-dev cvs git mercurial rsync openssh-client subversion asciidoc w3m dblatex graphviz python-matplotlib libc6:i386 libssl-dev texinfo liblz4-tool genext2fs expect patchelf gawk
Ubuntu18.04系统主机编译环境建议安装
sudo apt-get install asciidoc autoconf autotools-dev bash bc binfmt-support binutils bison build-essential bzip2 chrpath cmake cpio curl cvs dblatex device-tree-compiler diffstat expect fakeroot file flex g++ gawk gcc genext2fs git git-gui gitk g++-multilib graphviz gzip intltool libdrm-dev libglade2-dev libglib2.0-dev libgtk2.0-dev liblz4-tool libncurses5 libqt4-dev libsigsegv2 libssl-dev libudev-dev libusb-1.0-0-dev linaro-image-tools live-build m4 make mercurial mtools ncurses-dev openssh-client parted patch patchelf perl python python-linaro-image-tools python-matplotlib python-pip qemu-user-static repo rsync sed ssh subversion tar texinfo u-boot-tools unzip w3m wget libdb1-compat python3-pyelftools
主机PC端环境以Ubuntu16.04为例,目标板系统为yocto嵌入式系统。
下载qt开发SDK,SDK中包含交叉编译工具链、qmake、sysroot等,终端执行命令进行安装:
./fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0.sh
默认安装在/opt/fsl-imx-x11/4.1.15-2.1.0,可自定义修改。 可下载qt示例程序examples,并解压到任意路径。
使用终端命令行编译运行qt程序
qt程序使用SDK中的qt5 examples例程,通过qmake、make命令进行编译
$ source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
$ cd /opt/data/qt/examples/opengl/hellowindow
$ qmake
$ make
生成hellowindow程序,可通过scp拷贝到目标板中直接运行
$ scp hellowindow root@10.168.1.151:
$ ssh root@10.168.1.151
$ export DISPLAY=:0.0
$ ./hellowindow
使用qtcreator开发调试qt程序
qtcreator集成编辑、编译、运行、调试环境于一体,提升开发效率
安装qtcreator
$ sudo apt-get install qtcreator
添加Qt Versions
Tools --> Options --> Build & Run --> Qt Versions --> Add --> 选中qmake路径 --> Apply
添加Compilers
Tools --> Options --> Build & Run --> Compilers --> Add --> GCC -- 选中g++路径 --> Apply
注意:选中g++路径,并修改ABI一栏明确指示平台架构为arm
添加Devices(可选项)
Tools --> Options --> Devices --> Add --> General Linux Device --> start Wizard
并点击"Test"测试设备联通
添加Kits
Tools --> Options --> Build & Run --> Kits --> Add --> Apply
打开 hellowindow 工程并选择Kits
Welcome --> Open Porject --> 选择工程路径 /home/lin/trash/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/qt/examples/opengl/hellowindow/hellowindow.pro --> Configure Project
编译运行 hellowindow
Build --> Build Project "hellowindow" --> 重启qtcreator --> Build --> Run