“Debian Base 系统使用”的版本间的差异

来自ARM Wiki
跳转至: 导航搜索
(创建空白页面)
 
第1行: 第1行:
 +
==基础信息==
 +
*用户密码
 +
<syntaxhighlight lang="bash">
 +
user: root
 +
passwd: root
 +
</syntaxhighlight>
 +
==使用示例==
 +
===视频硬件编解码===
 +
*使用gstreamer播放视频
 +
<syntaxhighlight lang="bash">
 +
$ gst-play-1.0 /usr/local/test.mp4
 +
</syntaxhighlight>
 +
[[文件:277317066.jpg|frameless|650px]]<br />
 +
<br />
 +
*播放4K视频
 +
<syntaxhighlight lang="bash">
 +
$ gst-launch-1.0 playbin uri=file:///root/4k.mp4
 +
</syntaxhighlight>
 +
[[文件:531422585.jpg|frameless|650px]]<br />
 +
<br />
 +
*列出一些gstreamer命令
 +
<syntaxhighlight lang="bash">
 +
$ gst-launch-1.0 playbin uri=file:///usr/local/test.mp4
 +
$ gst-launch-1.0 uridecodebin uri=file:///usr/local/test.mp4 ! kmssink
 +
$ gst-launch-1.0 filesrc location=/usr/local/test.mp4 ! queue ! qtdemux  name=dmux dmux.video_0 ! queue ! h264parse ! mppvideodec ! kmssink dmux.audio_0 ! queue ! aacparse ! faad ! autoaudiosink
 +
$ gst-inspect-1.0 kmssink
 +
  # 查看插件信息
 +
$ gst-discoverer-1.0 /usr/local/test.mp4
 +
  # 查看视频信息
 +
</syntaxhighlight>
 +
===OpenCL===
 +
*安装并运行<code>clinfo</code>,查看OpenCL相关信息
 +
<syntaxhighlight lang="bash">
 +
$ sudo apt-get install -f -y clinfo
 +
$ clinfo
 +
Number of platforms                              1
 +
  Platform Name                                  ARM Platform
 +
  Platform Vendor                                ARM
 +
  Platform Version                                OpenCL 1.2 v1.r14p0-01rel0-git(a79caef).8ddfd7584149d9238dced4e406610de7
 +
  Platform Profile                                FULL_PROFILE
 +
  Platform Extensions                            cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addy
 +
  Platform Extensions function suffix            ARM
  
 +
  Platform Name                                  ARM Platform
 +
Number of devices                                1
 +
  Device Name                                    Mali-T860
 +
  Device Vendor                                  ARM
 +
  Device Vendor ID                                0x8602000
 +
  Device Version                                  OpenCL 1.2 v1.r14p0-01rel0-git(a79caef).8ddfd7584149d9238dced4e406610de7
 +
  Driver Version                                  1.2
 +
  Device OpenCL C Version                        OpenCL C 1.2 v1.r14p0-01rel0-git(a79caef).8ddfd7584149d9238dced4e406610de7
 +
  Device Type                                    GPU
 +
  Device Profile                                  FULL_PROFILE
 +
  Max compute units                              4
 +
  Max clock frequency                            800MHz
 +
  Device Partition                                (core)
 +
    Max number of sub-devices                    0
 +
    Supported partition types                    None
 +
  Max work item dimensions                        3
 +
  Max work item sizes                            256x256x256
 +
  Max work group size                            256
 +
...
 +
</syntaxhighlight>
 +
==QT开发==
 +
===qt程序测试脚本===
 +
系统中添加了qt_test.sh和qt_test_touchscreen.sh测试脚本,在系统终端下直接运行<br />
 +
<br />
 +
'''基于linuxfb或eglfs显示运行qt程序'''<br />
 +
<syntaxhighlight lang="bash">
 +
$ qt_test.sh linuxfb
 +
$ qt_test.sh eglfs
 +
</syntaxhighlight>
 +
[[文件:1365219484.jpg|frameless|650px]]<br />
 +
<br />
 +
'''基于libinput或tslib或evdev适配触摸屏运行qt程序'''<br />
 +
<syntaxhighlight lang="bash">
 +
$ qt_test_touchscreen.sh libinput
 +
$ qt_test_touchscreen.sh tslib
 +
$ qt_test_touchscreen.sh evdev
 +
</syntaxhighlight>
 +
[[文件:285324002.jpg|frameless|650px]]<br />
 +
<br />
 +
注意:在一次开机系统运行过程中,若使用了DRM,则不可再直接操作FB。在qt_test.sh脚本中启用了QT_QPA_FB_DRM=1,而qt_test_touchscreen.sh脚本为了可能会使用到tslib校准程序没有设置QT_QPA_FB_DRM,一次开机仅可选择其中一个脚本执行<br />
 +
===搭建qt开发环境===
 +
主机PC端环境为Ubuntu16.04,目标板系统为debian base系统,默认使用root用户自动登录,并支持root用户ssh远程登录,系统中移植了qt,支持eglfs、linuxfb显示插件。
 +
SDK与系统镜像一同发布,从相应的烧录包中获取SDK。SDK中包含交叉编译工具链、qmake、与目标板系统qt环境。解压SDK到任意目录$TOP_DIR(示例中以路径/opt/data为例),并运行开发环境配置脚本<br />
 +
<syntaxhighlight lang="bash">
 +
$ tar host.tar.gz -C $TOP_DIR
 +
$ cd $TOP_DIR/host
 +
$ ./relocate-sdk.sh
 +
</syntaxhighlight>
 +
===使用终端命令行编译运行qt程序===
 +
qt程序使用SDK中的qt5 examples例程,通过qmake、make命令进行编译
 +
<syntaxhighlight lang="bash">
 +
$ export PATH=$TOP_DIR/host/bin:$PATH
 +
$ cd $TOP_DIR/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/qt/examples/opengl/hellowindow
 +
$ qmake
 +
$ make
 +
</syntaxhighlight>
 +
生成hellowindow程序,可通过scp拷贝到目标板中,并配置qt运行环境变量后运行<br />
 +
<syntaxhighlight lang="bash">
 +
$ scp hellowindow root@10.168.1.157:
 +
$ ssh root@10.168.1.157
 +
$ export LD_LIBRARY_PATH=/opt/data/target/usr/lib
 +
$ export QT_QPA_PLATFORM_PLUGIN_PATH=/opt/data/target/usr/lib/qt/plugins
 +
</syntaxhighlight>
 +
指定eglfs显示插件运行程序<br />
 +
<syntaxhighlight lang="bash">
 +
$ ./hellowindow -platform eglfs
 +
</syntaxhighlight>
 +
[[文件:Projects 0.jpg|frameless|650px]]<br />
 +
<br />
 +
指定linuxfb显示插件运行程序<br />
 +
<syntaxhighlight lang="bash">
 +
$ ./calculator -platform linuxfb
 +
</syntaxhighlight>
 +
===使用qtcreator开发调试qt程序===
 +
qtcreator集成编辑、编译、运行、调试环境于一体,提升开发效率<br />
 +
<br />
 +
'''安装qtcreator'''<br />
 +
<syntaxhighlight lang="bash">
 +
$ sudo apt-get install qtcreator
 +
</syntaxhighlight>
 +
<br />
 +
'''添加Qt Versions'''<br />
 +
Tools --> Options --> Build & Run --> Qt Versions --> Add --> 选中qmake路径 --> Apply<br />
 +
[[文件:Screenshot from 2020-08-11 14-23-21.png|frameless|650px]]<br />
 +
<br />
 +
<br />
 +
'''添加Compilers'''<br />
 +
Tools --> Options --> Build & Run --> Compilers --> Add --> GCC -- 选中g++路径 --> Apply<br />
 +
注意:选中g++路径,并修改ABI一栏明确指示平台架构为arm<br />
 +
[[文件:Screenshot from 2020-08-11 14-21-33.png|frameless|650px]]<br />
 +
<br />
 +
<br />
 +
'''添加Debuggers(可选项)'''<br />
 +
Tools --> Options --> Build & Run --> Debuggers --> Add --> 选中gdb路径 --> Apply<br />
 +
[[文件:Screenshot from 2020-08-11 14-21-51.png|frameless|650px]]<br />
 +
<br />
 +
<br />
 +
'''添加Devices(可选项)'''<br />
 +
Tools --> Options --> Devices --> Add --> General Linux Device --> start Wizard<br />
 +
GDB Server executable路径为: /opt/data/target/usr/bin/gdbserver<br />
 +
[[文件:Screenshot from 2020-08-11 14-24-23.png|frameless|650px]]<br />
 +
<br />
 +
并点击"Test"测试设备联通'''<br />
 +
[[文件:Device Test.png]]<br />
 +
<br />
 +
<br />
 +
'''添加Kits'''<br />
 +
Tools --> Options --> Build & Run --> Kits --> Add --> Apply<br />
 +
[[文件:Screenshot from 2020-08-11 14-25-12.png|frameless|650px]]<br />
 +
<br />
 +
<br />
 +
'''打开 calculator 工程并选择Kits'''<br />
 +
Welcome --> Open Porject --> 选择工程路径 /opt/data/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/qt/examples/widgets/widgets/calculator/calculator.pro --> Configure Project<br />
 +
[[文件:Screenshot from 2020-08-11 17-04-50.png|frameless|650px]]<br />
 +
<br />
 +
<br />
 +
'''编译运行 calculator'''<br />
 +
Build --> Build Project "calculator" --> 重启qtcreator<br />
 +
Projects --> debian-kit --> Run<br />
 +
注意:找到 Run Environment --> Details --> Batch Edit 添加QT运行环境变量<br />
 +
[[文件:Screenshot from 2020-08-11 17-13-29.png|1560px|frameless|650px]]<br />
 +
<br />
 +
Build --> Run<br />
 +
[[文件:481762326.jpg|1560px|frameless|650px]]<br />
 +
<br />
 +
<br />
 +
'''配置debug模式'''<br />
 +
Projects --> debian-kit --> Build<br />
 +
注意:找到 Build Steps --> qmake --> Details --> Additional arguments --> 添加 QMAKE_CXXFLAGS+=-g<br />
 +
[[文件:Screenshot from 2020-08-11 17-36-06.png|1560px|frameless|650px]]<br />
 +
<br />
 +
<br />
 +
'''重新编译并调试运行'''<br />
 +
Build --> Clean Project "calculator"<br />
 +
Debug --> Start Debugging --> Start Debugging<br />
 +
[[文件:Screenshot from 2020-08-11 17-33-48.png|1560px|frameless|650px]]<br />
 +
<br />
 +
[[文件:378111369.jpg|1560px|frameless|650px]]<br />
 +
<br />
 +
<br />

2020年8月12日 (三) 17:15的版本

基础信息

  • 用户密码
user: root
passwd: root

使用示例

视频硬件编解码

  • 使用gstreamer播放视频
$ gst-play-1.0 /usr/local/test.mp4

277317066.jpg

  • 播放4K视频
$ gst-launch-1.0 playbin uri=file:///root/4k.mp4

531422585.jpg

  • 列出一些gstreamer命令
$ gst-launch-1.0 playbin uri=file:///usr/local/test.mp4
$ gst-launch-1.0 uridecodebin uri=file:///usr/local/test.mp4 ! kmssink
$ gst-launch-1.0 filesrc location=/usr/local/test.mp4 ! queue ! qtdemux  name=dmux dmux.video_0 ! queue ! h264parse ! mppvideodec ! kmssink dmux.audio_0 ! queue ! aacparse ! faad ! autoaudiosink
$ gst-inspect-1.0 kmssink
  # 查看插件信息
$ gst-discoverer-1.0 /usr/local/test.mp4
  # 查看视频信息

OpenCL

  • 安装并运行clinfo,查看OpenCL相关信息
$ sudo apt-get install -f -y clinfo
$ clinfo
Number of platforms                               1
  Platform Name                                   ARM Platform
  Platform Vendor                                 ARM
  Platform Version                                OpenCL 1.2 v1.r14p0-01rel0-git(a79caef).8ddfd7584149d9238dced4e406610de7
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addy
  Platform Extensions function suffix             ARM

  Platform Name                                   ARM Platform
Number of devices                                 1
  Device Name                                     Mali-T860
  Device Vendor                                   ARM
  Device Vendor ID                                0x8602000
  Device Version                                  OpenCL 1.2 v1.r14p0-01rel0-git(a79caef).8ddfd7584149d9238dced4e406610de7
  Driver Version                                  1.2
  Device OpenCL C Version                         OpenCL C 1.2 v1.r14p0-01rel0-git(a79caef).8ddfd7584149d9238dced4e406610de7
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Max compute units                               4
  Max clock frequency                             800MHz
  Device Partition                                (core)
    Max number of sub-devices                     0
    Supported partition types                     None
  Max work item dimensions                        3
  Max work item sizes                             256x256x256
  Max work group size                             256
...

QT开发

qt程序测试脚本

系统中添加了qt_test.sh和qt_test_touchscreen.sh测试脚本,在系统终端下直接运行

基于linuxfb或eglfs显示运行qt程序

$ qt_test.sh linuxfb
$ qt_test.sh eglfs

1365219484.jpg

基于libinput或tslib或evdev适配触摸屏运行qt程序

$ qt_test_touchscreen.sh libinput
$ qt_test_touchscreen.sh tslib
$ qt_test_touchscreen.sh evdev

285324002.jpg

注意:在一次开机系统运行过程中,若使用了DRM,则不可再直接操作FB。在qt_test.sh脚本中启用了QT_QPA_FB_DRM=1,而qt_test_touchscreen.sh脚本为了可能会使用到tslib校准程序没有设置QT_QPA_FB_DRM,一次开机仅可选择其中一个脚本执行

搭建qt开发环境

主机PC端环境为Ubuntu16.04,目标板系统为debian base系统,默认使用root用户自动登录,并支持root用户ssh远程登录,系统中移植了qt,支持eglfs、linuxfb显示插件。 SDK与系统镜像一同发布,从相应的烧录包中获取SDK。SDK中包含交叉编译工具链、qmake、与目标板系统qt环境。解压SDK到任意目录$TOP_DIR(示例中以路径/opt/data为例),并运行开发环境配置脚本

$ tar host.tar.gz -C $TOP_DIR
$ cd $TOP_DIR/host
$ ./relocate-sdk.sh

使用终端命令行编译运行qt程序

qt程序使用SDK中的qt5 examples例程,通过qmake、make命令进行编译

$ export PATH=$TOP_DIR/host/bin:$PATH
$ cd $TOP_DIR/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/qt/examples/opengl/hellowindow
$ qmake
$ make

生成hellowindow程序,可通过scp拷贝到目标板中,并配置qt运行环境变量后运行

$ scp hellowindow root@10.168.1.157:
$ ssh root@10.168.1.157
$ export LD_LIBRARY_PATH=/opt/data/target/usr/lib
$ export QT_QPA_PLATFORM_PLUGIN_PATH=/opt/data/target/usr/lib/qt/plugins

指定eglfs显示插件运行程序

$ ./hellowindow -platform eglfs

Projects 0.jpg

指定linuxfb显示插件运行程序

$ ./calculator -platform linuxfb

使用qtcreator开发调试qt程序

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

安装qtcreator

$ sudo apt-get install qtcreator


添加Qt Versions
Tools --> Options --> Build & Run --> Qt Versions --> Add --> 选中qmake路径 --> Apply
Screenshot from 2020-08-11 14-23-21.png


添加Compilers
Tools --> Options --> Build & Run --> Compilers --> Add --> GCC -- 选中g++路径 --> Apply
注意:选中g++路径,并修改ABI一栏明确指示平台架构为arm
Screenshot from 2020-08-11 14-21-33.png


添加Debuggers(可选项)
Tools --> Options --> Build & Run --> Debuggers --> Add --> 选中gdb路径 --> Apply
Screenshot from 2020-08-11 14-21-51.png


添加Devices(可选项)
Tools --> Options --> Devices --> Add --> General Linux Device --> start Wizard
GDB Server executable路径为: /opt/data/target/usr/bin/gdbserver
Screenshot from 2020-08-11 14-24-23.png

并点击"Test"测试设备联通
Device Test.png


添加Kits
Tools --> Options --> Build & Run --> Kits --> Add --> Apply
Screenshot from 2020-08-11 14-25-12.png


打开 calculator 工程并选择Kits
Welcome --> Open Porject --> 选择工程路径 /opt/data/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/qt/examples/widgets/widgets/calculator/calculator.pro --> Configure Project
Screenshot from 2020-08-11 17-04-50.png


编译运行 calculator
Build --> Build Project "calculator" --> 重启qtcreator
Projects --> debian-kit --> Run
注意:找到 Run Environment --> Details --> Batch Edit 添加QT运行环境变量
Screenshot from 2020-08-11 17-13-29.png

Build --> Run
481762326.jpg


配置debug模式
Projects --> debian-kit --> Build
注意:找到 Build Steps --> qmake --> Details --> Additional arguments --> 添加 QMAKE_CXXFLAGS+=-g
Screenshot from 2020-08-11 17-36-06.png


重新编译并调试运行
Build --> Clean Project "calculator"
Debug --> Start Debugging --> Start Debugging
Screenshot from 2020-08-11 17-33-48.png

378111369.jpg