“Imx-4.1.15 Yocto-2.1 系统使用”的版本间的差异

来自ARM Wiki
跳转至: 导航搜索
(创建页面,内容为“该yocto系统是基于x11显示协议的嵌入式系统。系统集成的qt支持x11显示插件。 ==基础信息== ===用户密码=== 系统默认使用root用...”)
 
 
(未显示同一用户的4个中间版本)
第3行: 第3行:
 
==基础信息==
 
==基础信息==
 
===用户密码===
 
===用户密码===
系统默认使用root用户登录,并支持root用户ssh远程登录,给目标系统root用户设置密码为root<br />
+
系统默认使用root用户登录,并支持root用户ssh远程登录,免密码。
<syntaxhighlight lang="bash">
 
$ passwd root
 
> root
 
> root
 
</syntaxhighlight>
 
  
 
==QT开发==
 
==QT开发==
第21行: 第16行:
 
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
 
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
 
</syntaxhighlight>
 
</syntaxhighlight>
主机PC端环境以Ubuntu16.04为例,目标板系统为buildroot嵌入式系统,默认使用root用户登录,并支持root用户ssh远程登录,给目标系统root用户配置密码为root<br />
+
主机PC端环境以Ubuntu16.04为例,目标板系统为yocto嵌入式系统。
 +
下载[http://norcord.com:8070/f/6827e50fef7d41cd8f04/?dl=1 qt开发SDK],SDK中包含交叉编译工具链、qmake、sysroot等,终端执行命令进行安装:
 +
<br />
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ passwd root
+
./fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0.sh
> root
 
> root
 
</syntaxhighlight>
 
SDK与系统镜像一同发布,从相应的烧录包中获取SDK。SDK中包含交叉编译工具链、qmake、与目标板系统的rootfs。解压SDK到任意目录$TOP_DIR(示例中以路径/home/lin/trash为例),并运行开发环境配置脚本<br />
 
<syntaxhighlight lang="bash">
 
$ tar host.tar.gz -C $TOP_DIR
 
$ cd $TOP_DIR/host
 
$ ./relocate-sdk.sh
 
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
默认安装在/opt/fsl-imx-x11/4.1.15-2.1.0,可自定义修改。<br />
 +
可下载qt示例程序[http://norcord.com:8070/f/6080a212fc55499f8ac8/?dl=1 examples],并解压到任意路径。
 
===使用终端命令行编译运行qt程序===
 
===使用终端命令行编译运行qt程序===
 
qt程序使用SDK中的qt5 examples例程,通过qmake、make命令进行编译
 
qt程序使用SDK中的qt5 examples例程,通过qmake、make命令进行编译
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ export PATH=$TOP_DIR/host/bin:$PATH
+
$ source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
$ cd $TOP_DIR/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/qt/examples/opengl/hellowindow
+
$ cd /opt/data/qt/examples/opengl/hellowindow
 
$ qmake
 
$ qmake
 
$ make
 
$ make
第43行: 第34行:
 
生成hellowindow程序,可通过scp拷贝到目标板中直接运行<br />
 
生成hellowindow程序,可通过scp拷贝到目标板中直接运行<br />
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ scp hellowindow root@10.168.1.247:
+
$ scp hellowindow root@10.168.1.151:
$ ssh root@10.168.1.247
+
$ ssh root@10.168.1.151
 +
$ export DISPLAY=:0.0
 
$ ./hellowindow
 
$ ./hellowindow
 
</syntaxhighlight>
 
</syntaxhighlight>
系统在/etc/init.d/S50launcher开机启动服务中,启动了wayland显示服务,并运行了QLauncher桌面,若使用eglfs或linuxfb显示插件,则需要移除S50launcher服务
+
[[文件:541562654.jpg|800px]]<br />
<syntaxhighlight lang="bash">
 
$ mv /etc/init.d/S50launcher ~
 
$ sync
 
$ reboot
 
</syntaxhighlight>
 
指定eglfs显示插件运行程序<br />
 
<syntaxhighlight lang="bash">
 
$ ./hellowindow -platform eglfs
 
</syntaxhighlight>
 
[[文件:Projects 0.jpg|800px]]<br />
 
 
<br />
 
<br />
指定linuxfb显示插件运行程序<br />
+
 
<syntaxhighlight lang="bash">
 
$ ./calculator -platform linuxfb
 
</syntaxhighlight>
 
 
===使用qtcreator开发调试qt程序===
 
===使用qtcreator开发调试qt程序===
 
qtcreator集成编辑、编译、运行、调试环境于一体,提升开发效率<br />
 
qtcreator集成编辑、编译、运行、调试环境于一体,提升开发效率<br />
第69行: 第48行:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ sudo apt-get install qtcreator
 
$ sudo apt-get install qtcreator
 +
</syntaxhighlight>
 +
<br />
 +
'''导入终端环境变量,启动qtcreator'''<br />
 +
<syntaxhighlight lang="bash">
 +
$ source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
 +
$ /usr/bin/qtcreator.sh
 
</syntaxhighlight>
 
</syntaxhighlight>
 
<br />
 
<br />
 
'''添加Qt Versions'''<br />
 
'''添加Qt Versions'''<br />
 
Tools --> Options --> Build & Run --> Qt Versions --> Add --> 选中qmake路径 --> Apply<br />
 
Tools --> Options --> Build & Run --> Qt Versions --> Add --> 选中qmake路径 --> Apply<br />
[[文件:Qtcreator1 Qt Versions.png]]<br />
+
qmake路径:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake<br />
 +
[[文件:Screenshot from 2022-01-19 09-19-10.png]]<br />
 
<br />
 
<br />
 
<br />
 
<br />
 
'''添加Compilers'''<br />
 
'''添加Compilers'''<br />
 
Tools --> Options --> Build & Run --> Compilers --> Add --> GCC -- 选中g++路径 --> Apply<br />
 
Tools --> Options --> Build & Run --> Compilers --> Add --> GCC -- 选中g++路径 --> Apply<br />
注意:选中g++路径,并修改ABI一栏明确指示平台架构为arm<br />
+
g++路径:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++<br />
[[文件:Qtcreator1 Compilers.png]]<br />
+
[[文件:Screenshot from 2022-01-19 09-21-31.png]]<br />
 
<br />
 
<br />
 
<br />
 
<br />
 
'''添加Devices(可选项)'''<br />
 
'''添加Devices(可选项)'''<br />
 
Tools --> Options --> Devices --> Add --> General Linux Device --> start Wizard<br />
 
Tools --> Options --> Devices --> Add --> General Linux Device --> start Wizard<br />
[[文件:Qtcreator1 Devices.png]]<br />
+
[[文件:Screenshot from 2022-01-19 09-24-23.png]]<br />
 
<br />
 
<br />
 
并点击"Test"测试设备联通'''<br />
 
并点击"Test"测试设备联通'''<br />
[[文件:Device Test.png]]<br />
+
[[文件:Screenshot from 2022-01-19 09-24-28.png]]<br />
 
<br />
 
<br />
 
<br />
 
<br />
 
'''添加Kits'''<br />
 
'''添加Kits'''<br />
 
Tools --> Options --> Build & Run --> Kits --> Add --> Apply<br />
 
Tools --> Options --> Build & Run --> Kits --> Add --> Apply<br />
[[文件:Qtcreator1 Kits.png]]<br />
+
sysroot路径:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi<br />
 +
[[文件:Screenshot from 2022-01-19 09-29-31.png]]<br />
 
<br />
 
<br />
 
<br />
 
<br />
 
'''打开 hellowindow 工程并选择Kits'''<br />
 
'''打开 hellowindow 工程并选择Kits'''<br />
Welcome --> Open Porject --> 选择工程路径 /home/lin/trash/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/qt/examples/opengl/hellowindow/hellowindow.pro --> Configure Project<br />
+
Welcome --> Open Porject --> 选择工程路径 --> Configure Project<br />
[[文件:Qtcreator1 Configure Project.png]]<br />
+
工程路径示例:/opt/data/qt/examples/opengl/hellowindow/hellowindow.pro<br />
 +
[[文件:Screenshot from 2022-01-19 09-39-34.png]]<br />
 +
<br />
 +
<br />
 +
'''配置编译参数'''<br />
 +
Projects --> Build --> Build Steps --> Additional arguments:<br />
 +
编译参数:-spec linux-oe-g++<br />
 +
[[文件:Screenshot from 2022-01-19 09-44-01.png]]<br />
 
<br />
 
<br />
 
<br />
 
<br />
 
'''编译运行 hellowindow'''<br />
 
'''编译运行 hellowindow'''<br />
Build --> Build Project "hellowindow" --> 重启qtcreator --> Build --> Run<br />
+
Build --> Build Project "hellowindow"<br />
[[文件:Projects 1.png|1560px]]<br />
+
Build --> Run<br />
 +
[[文件:Screenshot from 2022-01-19 09-47-00.png]]<br />
 
<br />
 
<br />
[[文件:Projects 2.jpg|1560px]]<br />
+
[[文件:541562654.jpg|800px]]<br />
 
<br />
 
<br />
 
<br />
 
<br />

2022年1月19日 (三) 10:53的最新版本

该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

541562654.jpg

使用qtcreator开发调试qt程序

qtcreator集成编辑、编译、运行、调试环境于一体,提升开发效率

安装qtcreator

$ sudo apt-get install qtcreator


导入终端环境变量,启动qtcreator

$ source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
$ /usr/bin/qtcreator.sh


添加Qt Versions
Tools --> Options --> Build & Run --> Qt Versions --> Add --> 选中qmake路径 --> Apply
qmake路径:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake
Screenshot from 2022-01-19 09-19-10.png


添加Compilers
Tools --> Options --> Build & Run --> Compilers --> Add --> GCC -- 选中g++路径 --> Apply
g++路径:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
Screenshot from 2022-01-19 09-21-31.png


添加Devices(可选项)
Tools --> Options --> Devices --> Add --> General Linux Device --> start Wizard
Screenshot from 2022-01-19 09-24-23.png

并点击"Test"测试设备联通
Screenshot from 2022-01-19 09-24-28.png


添加Kits
Tools --> Options --> Build & Run --> Kits --> Add --> Apply
sysroot路径:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi
Screenshot from 2022-01-19 09-29-31.png


打开 hellowindow 工程并选择Kits
Welcome --> Open Porject --> 选择工程路径 --> Configure Project
工程路径示例:/opt/data/qt/examples/opengl/hellowindow/hellowindow.pro
Screenshot from 2022-01-19 09-39-34.png


配置编译参数
Projects --> Build --> Build Steps --> Additional arguments:
编译参数:-spec linux-oe-g++
Screenshot from 2022-01-19 09-44-01.png


编译运行 hellowindow
Build --> Build Project "hellowindow"
Build --> Run
Screenshot from 2022-01-19 09-47-00.png

541562654.jpg