diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..6d8a7a75 --- /dev/null +++ b/404.html @@ -0,0 +1,1326 @@ + + + +
+ + + + + + + + + + + + + +施工中
+ + + + + + +施工中
+ + + + + + +LicheePi4A支持从 SD card 启动和从 eMMC 启动。以下分别介绍这两种启动方式下该如何刷写RevyOS镜像。
+演示环境:Ubuntu22.04
+注意!从sd卡启动不需要改变拨码开关!按照eMMC拨码开关进行设置!
+准备MicroSD 读卡器和一张MicroSD 卡
+安装zstd用于解压镜像文件
+apt install zstd
+
+从以下链接下载 LicheePi4A 以 sdcard-
为前缀的 SD card 启动系统镜像:RevyOS0720。
解压镜像压缩包得到sdcard-lpi4a-20240720_171951.img文件
+unzstd sdcard-lpi4a-20240720_171951.img.zst
+
+从官网获取烧录工具 BalenaEtcher https://etcher.balena.io/
+把 SD 卡插入读卡器,并将其插入电脑。
+运行 BalenaEtcher用于写入镜像到SD 卡。 +在 BalenaEtcher 窗口中, 首先点击 "Flash from file" 来选择镜像文件。 + +选择完镜像文件后在第二栏选择需要写入的设备。 + +两项都选择完以后点击"Flash"写入镜像。 + +在等待一段时间后会显示烧录已完成。 +
+在刷写前请保证您在 of=
设置了正确的设备
# sudo dd if=./sdcard-lpi4a-20240720_171951.img of=<Target Device> status=progress
+# sync
+
+等待完成即可使用
+在写入镜像完成后将SD 卡插入如图所示卡槽中。 + +连接hdmi线与电源线后可直接启动。
+从eMMC启动镜像时,刷写镜像的途径分为连接串口与不连接串口两种情况,其中进行的操作有些许区别,在此将两种方式一起进行介绍。 +从eMMC启动应当先取出 SD Card
+从eMMC启动需要将u-boot文件、boot文件以及root文件通过fastboot刷入eMMC中,所以需要保证已安装fastboot。
+Ubuntu可直接通过apt安装
+apt install fastboot
+
+通过串口连接时需要串口控制台进行监控,在Ubuntu下选择使用minicom。
+apt install minicom
+
+从以下链接下载 LicheePi4A 的系统镜像:RevyOS0720。
+其中u-boot文件需要根据自己的板卡规格进行选择,请注意提前了解自己的板卡规格后进行下载。
+下载后使用 unzstd
解压 root 和 boot 镜像
unzstd boot-lpi4a-20240720_171951.ext4.zst
+unzstd root-lpi4a-20240720_171951.ext4.zst
+
+按住板卡上的BOOT键后,接入电脑。板卡会进入刷写模式
+首先从终端打开minicom,进入串口控制台。
+sudo minicom
+
+如图所示将串口与板卡进行连接,usb端接入电脑。板卡上的Type-C接口通过USB-Type-C线连接到电脑。
+连接串口,红色圈内(从左往右第一排第二个)为 GND,黄色圈内(第一排第五个)为 TX,绿色圈内(第二排第五个)为 RX。与主机应遵循TX到RX,RX到TX,GND到GND的接线。
+ +在接入后在串口控制台中按任意按键打断,在串口控制台窗口中输入
+fastboot usb 0
+
+随后另起一个窗口进行镜像刷写。
+以下命令均为在镜像文件下载文件夹路径内,注意文件路径和文件名。
+如果 lsusb
结果不是 ID 1234:8888 Brain Actuated Technologies USB download gadget
,运行下面的命令
fastboot flash ram u-boot-with-spl-lpi4a-16g.bin # 替换为您的型号对应的 uboot 镜像
+fastboot reboot
+sleep 1
+
+fastboot flash uboot u-boot-with-spl-lpi4a-16g.bin
+fastboot flash boot boot-lpi4a-20240720_171951.ext4
+fastboot flash root root-lpi4a-20240720_171951.ext4
+
+fastboot 会显示刷写进度,如果连接了串口,在串口控制台中可以看到具体进度(下图以刷写
+boot,大小为 92886476 Bytes为例,可在 cmd_parameter: boot, imagesize: 92886476
处查看刷入的内容)。
刷写完成后拔掉电脑与板卡连接的USB-Type-C线,接入电源线便可直接启动进入系统。
+如果 lsusb
中存在 download 设备,但fastboot
命令仍然卡在 < waiting for any device >
,可以尝试使用 sudo
运行 fastboot
命令。
RevyOS 镜像目录:镜像下载
+目前最新镜像版本为:20240819
+以下以20240819镜像目录为例:
+ +RevyOS 镜像刷写遵循固件文件+系统文件的方式,因此会用到以下文件
+固件文件:
+系统文件:
+根据镜像下载中的说明,固件文件可以存放于 SPI Flash 或 SD卡中,因此下面将会进行分类说明。
+操作环境:Ubuntu 22.04
+1、选择文件 firmware_single_sg2042-v6.6-lts-v0p7.img +2、选择目标SD卡 +3、点击烧录
+将SD卡插入读卡器并连接至电脑,确认是否正确连接以及设备路径
+在存放firmware_single_sg2042-v6.6-lts-v0p7.img文件的目录下时,使用dd命令将文件刷写到SD卡中
+sudo dd if=firmware_single_sg2042-v6.6-lts-v0p7.img of=/dev/sda bs=4M status=progress
of=/dev/sda
此项请根据设备路径进行更改
刷写完成后请使用sync
命令,确保数据写入到 SD 卡中。
操作环境:RevyOS0819
+注意事项:首次使用时推荐使用SD卡存放固件
+此方法是将.bin文件写入到mtd中,所以需要安装相关软件包以及加载相关模块
+sudo apt install mtd-utils
+sudo modprobe mtdblock
+
+然后下载文件
+wget https://mirror.iscas.ac.cn/revyos/extra/images/sg2042/20240819/firmware_single_sg2042-v6.6-lts-v0p7.bin
+
+下载完成后切换到 firmware_single_sg2042-v6.6-lts-v0p7.bin 的下载目录下,执行以下命令
+sudo flashcp -v firmware_single_sg2042-v6.6-lts-v0p7.bin /dev/mtd1
+
+至此刷写完成
+操作环境:Ubuntu 22.04
+首先需要解压revyos-pioneer-20240819-154656.img.zst
文件
unzstd revyos-pioneer-20240819-154656.img.zst
+
+得到revyos-pioneer-20240819-154656.img
文件
将NVMe SSD插入读卡器并连接至电脑,确认是否正确连接以及设备路径
+在存放revyos-pioneer-20240819-154656.img文件的目录下时,使用dd命令将文件刷写到NVMe SSD中
+sudo dd if=revyos-pioneer-20240819-154656.img of=/dev/nvme0n1 bs=4M status=progress
of=/dev/nvme0n1
此项请根据设备路径进行更改
刷写完成后请使用sync
命令,确保数据写入到NVMe SSD中。
brew
或其他方式安装 android-platform-tools开始下载 uboot 以及镜像:
+访问该网站,并且确保您进入的是最新日期的文件夹,这里以 20240720 为例:
+下载以下文件:
+++确保您下载的文件与您的硬件相符,荔枝派 4a 分为 8G 以及 16G 版本,对应的 uboot 也不相同。
+
接着,使用 brew
安装 android-platform-tools:
brew intsall android-platform-tools
确定 fastboot
指令能够正常使用:
yuiyuuhayashi@MacBook-Air ~ % fastboot usb 0
+< waiting for any device >
+
+首先, 让你的荔枝派在启动阶段进入 xx 模式。
+输入 fastboot usb 0
,并且确定您已经通过 type C 接口正确连接到您的 Mac 以及接入 12V 供电
+在 Mac 上输入如下指令:
fastboot flash uboot <filename>
+
+正确刷写后,使用 fastboot reboot
进行重启
++若没有开发版没有正确重启,请手动断电重启
+
同样的进入 xx 模式,在 macOS 上执行如下指令:
+fastboot flash root <filename>
+
+同样的,使用 fastboot reboot
进行重启
在进入系统后,请输入如下账号密码:
+debian
+debian
+
+成功进入系统后,可使用 neofetch
等方式查看系统版本等信息。
Some GStreamer pipeline command-line examples with omxil library on TH1520, RevyOS
+In this section, the grammer of the gstreamer command-line pipeline and some usefule debug tips are introduced. They have been moved to the end of the article.
+Basically, you neet to install gstreamer1.0-plugins-base
, gstreamer1.0-plugins-good
, gstreamer1.0-plugins-bad
, gstreamer1.0-omx-generic
, gstreamer1.0-omx-bellagio-config
,gstreamer1.0-tools
.
# videotestsrc
+gst-launch-1.0 videotestsrc ! autovideosink
+
+# specify the video stream format
+gst-launch-1.0 videotestsrc ! video/x-raw, format=NV12, width=960, height=540, framerate=60/1 ! autovideosink
+
+# display framerate
+gst-launch-1.0 videotestsrc ! fpsdisplaysink
+
+# no need to sync on the clock - used to test the performance of the pipeline
+gst-launch-1.0 videotestsrc ! fpsdisplaysink sync=false
+
+# stop display on the screen, but redirect the output to stdout
+gst-launch-1.0 videotestsrc ! fpsdisplaysink text-overlay=false -v 2>&1
+
+# specify which sink to use
+gst-launch-1.0 videotestsrc ! fpsdisplaysink sink=glimagesink
+
+# combine the previous examples
+gst-launch-1.0 videotestsrc ! fpsdisplaysink sink=glimagesink sync=false text-overlay=false -v 2>&1
+
+# audiotestsrc
+gst-launch-1.0 audiotestsrc ! autoaudiosink
+
+# change volume (0 to 1)
+gst-launch-1.0 audiotestsrc volume=0.1 ! autoaudiosink
+
+# change waveform
+# could be selected among square, silence, pink-noise, etc.
+gst-launch-1.0 audiotestsrc wave=pink-noise ! autoaudiosink
+
+# set fix frequency, such as "do" (262 Hz)
+gst-launch-1.0 audiotestsrc freq=262 ! autoaudiosink
+
+# a dummy sink that swallows everything
+gst-launch-1.0 videotestsrc ! fakesink
+
+# let decodebin choose which decoder to use,
+# and autovideosink choose which video-sink to use (not recommended)
+gst-launch-1.0 filesrc location=fire.mp4 ! decodebin ! autovideosink
+
+# h264 software decode without opengl display
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux ! h264parse ! avdec_h264 ! xvimagesink
+
+# h264 hardware decode with opengl display
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux ! h264parse ! omxh264dec ! glimagesink
+
+# h265 hardware decode
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux ! h265parse ! omxh265dec ! glimagesink
+
+# vp9 hardware decode
+gst-launch-1.0 filesrc location=fire.webm ! matroskademux ! omxvp9dec ! glimagesink
+
+# mpeg4 hardware decode
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux ! queue ! mpeg4videoparse ! omxmpeg4videodec ! glimagesink
+
+# play mkv/webm file
+gst-launch-1.0 filesrc location=fire.mkv ! matroskademux ! decodebin ! glimagesink
+
+# todo 10-bit h264/h265 decode
+
+# there is no hardware decoder on th1520
+
+# let autoaudiosink choose which audio-sink to use
+gst-launch-1.0 filesrc location=blade.mp3 ! decodebin ! audioconvert ! autoaudiosink
+
+# mp3 decode
+gst-launch-1.0 filesrc location=blade.mp3 ! mpegaudioparse ! avdec_mp3 ! audioconvert ! autoaudiosink
+
+# aac decode
+gst-launch-1.0 filesrc location=blade.aac ! aacparse ! avdec_aac ! audioconvert ! autoaudiosink
+gst-launch-1.0 filesrc location=blade.aac ! aacparse ! faad ! audioconvert ! autoaudiosink
+## faad works well without aacparse
+gst-launch-1.0 filesrc location=blade.aac ! faad ! audioconvert ! autoaudiosink
+
+# opus decode
+## ogg file must be demuxed by oggdemux first
+gst-launch-1.0 filesrc location=blade.ogg ! oggdemux ! opusparse ! opusdec ! audioconvert ! autoaudiosink
+gst-launch-1.0 filesrc location=blade.ogg ! oggdemux ! opusparse ! avdec_opus ! audioconvert ! autoaudiosink
+
+# wav decode
+gst-launch-1.0 filesrc location=test.wav ! wavparse ! audioresample ! audioconvert ! autoaudiosink
+
+# use specific audiosink
+gst-launch-1.0 filesrc location=blade.mp3 ! decodebin ! audioconvert ! pulsesink
+
+# specify the output device by using alsasink with device property
+gst-launch-1.0 filesrc location=blade.mp3 ! decodebin ! audioconvert ! alsasink device=hw:0,2
+
+We play media file in this section.
+# play mp4 file with both audio and video
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux name=demux \
+ demux.video_0 ! queue ! decodebin ! videoconvert ! autovideosink \
+ demux.audio_0 ! queue ! decodebin ! audioconvert ! autoaudiosink
+
+# h264 encode test
+# before import video stream to omxh264dec, data should be transformed to frame with rawvideoparse
+# property and pad of rawvideoparse should be set to the same, so we use 'use-sink-caps=true' here
+gst-launch-1.0 videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=640, height=480 \
+ ! rawvideoparse use-sink-caps=true ! omxh264enc ! fakesink
+
+# h264 hardware encode to file
+## todo: encoded h264 file has seek problem
+gst-launch-1.0 videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=640, height=480 \
+ ! rawvideoparse use-sink-caps=true ! omxh264enc \
+ ! h264parse ! qtmux ! mp4mux ! filesink location=test.mp4
+
+# h264 hardware encode to file with specific bitrate(bit per second)
+gst-launch-1.0 videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=640, height=480 \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc target-bitrate=3000000 \
+ ! h264parse ! filesink location=test.mp4
+
+
+# h265 hardware encode to file
+## this pipeline produces h265 stream only
+## qtdemux is not needed while decoding
+gst-launch-1.0 videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=640, height=480 \
+ ! rawvideoparse use-sink-caps=true ! omxh265enc \
+ ! h265parse ! filesink location=test.h265
+
+# h264 hardware encode from camera to file
+gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert \
+ ! video/x-raw, format=NV12,width=640,height=480 \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc ! h264parse ! filesink location=test.mp4 -e
+
+# There is no hardware audio encoder on th1520
+
+# encode aac stream with adts container(.aac file)
+## the unit of the bitrate is 'bit/sec'
+gst-launch-1.0 audiotestsrc ! voaacenc bitrate=128000 ! avmux_adts ! filesink location=test.aac
+
+
+# todo: encode aac stream with adif container(.m4a file)
+
+# encode to mp3 file
+## the unit of the bitrate is 'kbit/sec'
+gst-launch-1.0 audiotestsrc ! lamemp3enc quality=2 target=bitrate bitrate=192 cbr=true ! id3v2mux ! filesink location=test.mp3
+
+# encode opus stream to .ogg file
+gst-launch-1.0 audiotestsrc ! opusenc ! oggmux ! filesink location=test.opus
+
+
+# todo: encode pcm stream to .wav file
+
+This part has been removed to Video + audio transcode
section.
Since omx...dec
cannot fulfill qtdemux and mp4mux, and gst-omx is no longer maintained, it is hard to mux mp4 file with these two plugins. To mux stream from omxh264dec, use avmux_mp4
instead. But there is no h265 or vp9 muxer available for omx...dec
The raw video stream should be processed by rawvideoparse
before sent to encoder. Because itself cannot scale frame or change framerate, rawvideoparse
need to get the stream info of its sink pad(src pad of the backward element). Therefore use-sink-caps
must be set to true
.
To change width and height, set properties output-width
and output-height
of omx...dec
. To modify bitrate and bitrate control method, set properties control-rate
and target-bitrate
of omx...enc
. To change framerate, set properties of videorate
.
# h265 to h264
+gst-launch-1.0 filesrc location=test_h265.mp4 ! qtdemux ! h265parse ! omxh265dec \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc ! h264parse ! avmux_mp4 ! filesink location=t_h264.mp4
+
+# vp9 to h264
+gst-launch-1.0 filesrc location=test_vp9.webm ! matroskademux ! omxvp9dec \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc ! h264parse ! avmux_mp4 ! filesink location=t_h264.mp4
+
+# arbitrary input to h264
+gst-launch-1.0 filesrc location=test_h264.mp4 ! decodebin \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc ! h264parse ! filesink location=t_h264.mp4
+
+# h264 to h264, with more options
+## set the video width and height to 1280×720, framerate to 15fps, bitrate mode to constant and bitrate to 5Mbps
+gst-launch-1.0 filesrc location=test_h264.mp4 ! qtdemux ! h264parse \
+ ! omxh264dec output-width=1280 output-height=720 \
+ ! videorate ! video/x-raw, framerate=15/1 \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc control-rate=constant target-bitrate=5000000 ! h264parse ! filesink location=t_h264.mp4
+
+## there is no vp9 encoder in th1520 omxil lib
+
+# aac to mp3
+gst-launch-1.0 filesrc location=test.aac ! aacparse ! avdec_aac ! audioconvert ! lamemp3enc quality=2 target=bitrate bitrate=192 cbr=true ! id3v2mux ! filesink location=t.mp3
+
+# mp3 to aac
+gst-launch-1.0 filesrc location=test.mp3 ! mpegaudioparse ! avdec_mp3 ! audioconvert ! voaacenc bitrate=128000 ! avmux_adts ! filesink location=t.aac
+
+# wav to mp3
+gst-launch-1.0 filesrc location=test.wav ! wavparse ! audioresample ! audioconvert ! lamemp3enc quality=2 target=bitrate bitrate=192 cbr=true ! id3v2mux ! filesink location=t.mp3
+
+# mp3 to wav
+gst-launch-1.0 filesrc location=test.mp3 ! mpegaudioparse ! avdec_mp3 ! audioresample ! audioconvert \
+ ! audio/x-raw, rate=44100, format=S16LE ! wavenc ! filesink location=t.wav
+
+# mux test
+gst-launch-1.0 audiotestsrc ! autoaudiosink videotestsrc ! autovideosink
+
+# mux the test video and audio stream to a mp4 file
+## be aware that '-e' must be set to this pipeline,
+## and there is no '!' before audiotestsrc
+gst-launch-1.0 -e videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=960, height=540 \
+ ! rawvideoparse use-sink-caps=true ! omxh264enc ! h264parse \
+ ! avmux_mp4 name=mux ! filesink location=t_h264.mp4 \
+ audiotestsrc ! lamemp3enc ! mux.
+
+# change container from mkv to mp4 with h264 stream
+## this means demux a mkv file then mux video and audio stream to mp4 file
+gst-launch-1.0 filesrc location=test_h264.mkv \
+ ! matroskademux name=demux mp4mux force-create-timecode-trak=true name=mux ! filesink location=t_h264.mp4 \
+ demux.video_0 ! queue ! video/x-h264 ! mux. \
+ demux.audio_0 ! queue ! audio/mpeg ! mux.
+
+You can use command v4l2-ctl
, which is included in package v4l-utils
to get information of your camera.
For more information, read this article
+# h264 hardware encode from camera to file
+gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert \
+ ! video/x-raw, format=NV12,width=640,height=480 \
+ ! rawvideoparse format=nv12 width=640 height=480 \
+ ! omxh264enc ! h264parse ! filesink location=test.mp4 -e
+
+
+# capture camera and stream to other machine
+
+## source
+gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! videorate \
+ ! video/x-raw, format=NV12,width=640,height=480,framerate=20/1 \
+ ! rawvideoparse format=nv12 width=640 height=480 framerate=20/1 \
+ ! omxh264enc ! h264parse config-interval=1 ! video/x-h264,stream-format=byte-stream,alignment=nal \
+ ! rtph264pay ! udpsink host=192.168.31.27 port=5600
+
+## destination
+gst-launch-1.0 udpsrc port=5600 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' \
+ ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink
+
+gst-inspect-1.0
is a tool to print info about a GStreamer element(factory), which is included in gstreamer1.0-tools
.
# print the GStreamer element list with a 'less' like paing filter.
+gst-inspect-1.0
+
+# print info of the element
+gst-inspect-1.0 <element_name>
+
+gst-discover-1.0
is a tool to show info about the media file, which is inclucded in gstreamer1.0-plugins-base-apps
.
gst-discoverer-1.0 -v test.mp4
+
+If you are tired of manually build pipeline for playback by hand. You can use gst-play-1.0
as an alternative, which is included in gstreamer1.0-plugins-base-apps
.
# play media file
+gst-play-1.0 test.mp4
+
+# play media file with specific sink
+gst-play-1.0 --videosink=glimagesink --audiosink=alsasink
+
+Left button and right button can be used to seek. For more info, please read this article.
+To get the cap info or property of an element, you may need to run gst-inspect-1.0 <element_name>
. If gst-inspect-1.0
command not found, install gstreamer1.0-tools
.
If you want to debug GStreamer, refer to the articles below. +https://gstreamer.freedesktop.org/documentation/tutorials/basic/debugging-tools.html +https://gstreamer.freedesktop.org/documentation/gstreamer/running.html?gi-language=c
+Here is a simple command-line pipeline.
+gst-launch-1.0 videotestsrc ! autovideosink
+
+!
represent a link. The established pipeline looks like
videotestsrc => autovideosink
+
+There are several properties in videotestsrc, which could be lookup by gst-inspect-1.0 videotestsrc
.Set some properties:
gst-launch-1.0 videotestsrc pattern=ball flip=true ! autovideosink
+
+NAME=VALUE
is a property. pattern
and flip
are properties of videotestsrc.
Sometimes we need to control the behavior of gst-launch-1.0
.
GST_DEBUG=3 gst-launch-1.0 videotestsrc pattern=ball flip=true ! autovideosink
+gst-launch-1.0 videotestsrc pattern=ball flip=true ! autovideosink --gst-debug-level=3
+
+There are two ways to achieve this goal. One is setting environment variable. Another one is passing command-line argument to gst-launch-1.0
. GST_DEBUG=3
and --gst-debug-level=3
have the same meaning.
In most video decoding cases, there is a video-stream and an audio stream. We need to use demuxer to seperate them. Demuxer usually have several src pad. Here is an example.
+gst-launch-1.0 filesrc location=test-video.mp4 ! qtdemux name=demux demux. ! queue ! h264parse ! omxh264dec ! glimagesink demux. ! queue ! aacparse ! avdec_aac ! audioconvert ! alsasink
+
+It is hard to read. Add some word wrap:
+gst-launch-1.0 filesrc location=test-video.mp4 ! qtdemux name=demux \
+ demux. ! queue ! h264parse ! omxh264dec ! glimagesink \
+ demux. ! queue ! aacparse ! avdec_aac ! audioconvert ! pulsesink
+
+Here we use a demuxer to seperate video and audio, the grammer is:
+... demuxer name=DEMUXER_NAME \
+DEMUXER_NAME.PIPELINE_NAME_1 ! queue ! ...(the remaining part of pipeline 1) \
+DEMUXER_NAME.PIPELINE_NAME_2 ! queue ! ...(the remaining part of pipeline 2)
+
+Sometimes we need to set certain properties of the stream at certain nodes in the pipeline, e.g set resolution of the videostream of the videotestsrc
.
gst-launch-1.0 videotestsrc ! video/x-raw, width=800, height=600 ! glimagesink
+
+We negotiated the pad properties between videotestsrc
and glimagesink
. The property names and values must be supported by both element. You can find them in Pad Templates
section of gst-inspect-1.0
.
适用SDK v1.1.2
+PTG 的 OpenMAX IL 库(下称 vpu-omxil
)可使 LicheePi 4A 能够流畅硬解码 4k 60fps 的视频,那么具体应该如何使用该库呢?本文将主要介绍 LicheePi 4A 开发板上 Parole 播放器的集成与使用,用户可根据本文来了解在 LicheePi 4A 上的适配过程
+以 h264 的硬解为例,视频硬解的工作流程如图所示
+-------------------------------------------+
+ | +------------+ +------------+ | +--------+
+video stream----+--->| omxh264dec +------>| video-sink +----+-->| player |
+ | +------+-----+ +------------+ | +--------+
+ | | GStreamer |
+ +-----------+-------------------------------+
+ |
+ +-----v-----+
+ | vpu-omxil |
+ +-----+-----+
+ |
+ |
+ +-------v-------+
+ | kernel module |
+ | (driver) |
+ +-------+-------+
+ |
+ v
+ hardware
+
+omxh264dec
中将 omxh264 解码的部分单独拎出来,大体的结构如下
+ +---+------------+----+
+ | +------------+ |
+ | | omxh264dec | |
+ | +------------+ |
+ | GStreamer |
+ +----------+----------+
+ |
+ +----+-----v-----+----+
+ | +-----------+ |
+ | | vpu-omxil | |
+ | +-----------+ |
+ | libomxil-bellagio |
+ +----------+----------+
+ |
++------------v------------+
+| - memalloc - vc8000 |
+| - hantrodec - vidmem |
+| kernel modules |
++------------+------------+
+ |
+ v
+ hardware
+
+我们依照自底向上的顺序构建图示的链条。 +本节的主要目的是使 omxh264dec 解码器能够运行,并不涉及到输出屏幕等内容。
+硬解码需要访问硬件,而访问硬件又需要驱动,所以需要编译并安装驱动
+PTG 提供的驱动源:
+https://github.com/revyos/vpu-vc8000e-kernel
+https://github.com/revyos/vpu-vc8000d-kernel
+https://github.com/revyos/video_memory
+revyos/thead-kernel 已经合并了上述三个内核模块, 使用revyos_defconfig 可以无需编译上述内核模块
+# depmod 分析可载入模块的依赖关系,在 /lib/modules/<kernel-version>中添加modules.dep文件,以便后续 modprobe 使用
+sudo depmod -a
+sudo modprobe vidmem vc8000 hantrodec memalloc
+
+## 如果 modprobe 安装有问题的话,可以尝试使用 insmod 安装
+#cd /usr/lib/modules/$(uname -r)
+#sudo insmod $(find . -name *vidmem.ko*)
+#sudo insmod $(find . -name *vc8000.ko*)
+#sudo insmod $(find . -name *hantrodec.ko*)
+#sudo insmod $(find . -name *memalloc.ko*)
+
+# 可选:设置开机加载模块
+echo -e "\nvidmem\nhantrodec\nmemalloc\nvc8000\n" | sudo tee -a /etc/modules > /dev/null
+
+安装内核模块后,/dev
目录下会出现 hantrodec
vidmem
vc8000
三个设备文件。默认情况下,用户对其没有访问权限,如果不修改权限的话,非 root 用户在打开 omxil 库时会报错。
# 生效一次
+cd /dev
+sudo chmod 666 hantrodec vidmem vc8000
+
+# 长期生效
+cat << EOF | sudo tee /lib/udev/rules.d/70-hantro.rules > /dev/null
+KERNEL=="vidmem", MODE="0666"
+KERNEL=="hantrodec", MODE="0666"
+KERNEL=="vc8000", MODE="0666"
+EOF
+
+如果要获取 RevyOS 特定版本的内核模块,可进入 revyos/thead-kernel ,并在 GitHub CI 中下载 artifacts
+首先,请将 vpu-omxil 下载并解压到 /usr/lib/omxil/中 +vpu-omxil_1.2.1.tar.gz +如下图所示, 需要
+vpu-omxil
中的 OpenMax 组件注册到 libomxil-bellagio
中gst-omx
(该包提供了 omxh264dec 解码器) 调用 libomxil-bellagio
的时候也需要知道调用的组件名称+---------+ +-------------------+ +-----------+
+| gst-omx +-->| libomxil-bellagio +-->| vpu-omxil |
++---------+ +-------------------+ +-----------+
+
+vpu-omxil
中的组件注册到 libomxil-bellagio
中sudo apt install libomxil-bellagio-bin libomxil-bellagio0
+# 注册组件
+omxregister-bellagio -v /usr/lib/omxil/
+
+使用 omxregister-bellagio 生成注册文件,默认路径为 ~/.omxregister
+th1520-vpu 利用了 debian 在 usr/lib/riscv64-linux-gnu/libomxil-bellagio0
安装之后
+触发自动注册行为 结果如下
cat /var/lib/libomxil-bellagio0/registry
+/usr/lib/riscv64-linux-gnu/libomxil-bellagio0/libOMX.hantro.H2.video.encoder.so
+ ==> OMX.hantro.H2.video.encoder ==> OMX.hantro.H2.video.encoder.avc:OMX.hantro.H2.video.encoder.hevc:
+/usr/lib/riscv64-linux-gnu/libomxil-bellagio0/libOMX.hantro.VC8000D.image.decoder.so
+ ==> OMX.hantro.VC8000D.image.decoder ==> OMX.hantro.VC8000D.image.decoder.jpeg:
+/usr/lib/riscv64-linux-gnu/libomxil-bellagio0/libOMX.hantro.H2.image.encoder.so
+ ==> OMX.hantro.H2.image.encoder ==> OMX.hantro.H2.image.encoder.jpeg:
+/usr/lib/riscv64-linux-gnu/libomxil-bellagio0/libOMX.hantro.VC8000D.video.decoder.so
+ ==> OMX.hantro.VC8000D.video.decoder ==> OMX.hantro.VC8000D.video.decoder.mpeg4:OMX.hantro.VC8000D.video.decoder.avc:OMX.hantro.VC8000D.video.decoder.avs:OMX.hantro.VC8000D.video.decoder.h263:OMX.hantro.VC8000D.video.decoder.wmv:OMX.hantro.VC8000D.video.decoder.vp6:OMX.hantro.VC8000D.video.decoder.vp8:OMX.hantro.VC8000D.video.decoder.jpeg:OMX.hantro.VC8000D.video.decoder.hevc:OMX.hantro.VC8000D.video.decoder.vp9:OMX.hantro.VC8000D.video.decoder.avs2:
+
+调整 gstomx.conf 的设置以使解码器 omxh264dec 调用正确的组件,具体请查看针对 gst-omx 的补丁
+gst-omx-01-add-libomxil-config.patch
+请查看 PTG 提供的针对 gst-omx 的 dmabuf 补丁 +gst-omx-02-set-dec-out-port-dmabuf.patch
+sudo apt install gstreamer1.0-omx-generic gstreamer1.0-omx-bellagio-config gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-gl gstreamer1.0-plugins-good gstreamer1.0-tools
+
+# 1 基本解码
+gst-launch-1.0 filesrc location=<test.mp4> ! qtdemux ! h264parse ! omxh264dec ! videoconvert ! fakesink sync=false
+# 2 在终端中显示 fps
+# 参考:https://stackoverflow.com/questions/73948308
+gst-launch-1.0 filesrc location=<test.mp4> ! qtdemux ! h264parse ! omxh264dec ! videoconvert ! fpsdisplaysink video-sink=fakesink text-overlay=false sync=false -v 2>&1
+
+fakesink
会把前面的视频流全部吞掉,不输出画面(因而不会在 video-sink 这一环节损失性能),但是结合fpsdisplaysink可以读取到解码的速度。正常日志如下:
Setting pipeline to PAUSED ...[DBGT]
+vc8kdec compiled without trace support (ENABLE_DBGT_TRACE switch not enabled)
+Pipeline is PREROLLING ...
+Redistribute latency...
+OMX ! decoder_get_parameter OMX_ErrorNoMore (2)
+Pipeline is PREROLLED ...
+Setting pipeline to PLAYING ...
+New clock: GstSystemClockRedistribute latency...
+0:01:39.5 / 0:01:49.4 (90.9 %)
+
+【TIP】如果有 [omxh264dec-omxh264dec0: Could not initialize supporting library.](https://gist.github.com/Sakura286/015fae6792e160268db7ad8a697dd2df)
等字样的报错,可以安装gst-omx
、libomxil-bellagio
与libc6
相关的 debug-symbol 包,使用 gdb
启动上述命令进行调试。调试时,先断DWLInit
,然后再断open
,具体看是打开哪个地方的时候出错了。
RevyOS 适配过程中对于初始化动态库失败找到了如下三种原因:
+omxregister-bellagio
注册 vpu-omxil/dev
目录下 hantrodec
vc8000
vidmem
等设备的权限video-sink
是视频流在整个 GStreamer pipeline 中的最后一步,其作用一般是将视频流输出到屏幕上。
+前文中fakesink
只是测试解码器是否正常工作的特殊 video-sink
,可选的 video-sink非常多,常见的有 autovideosink
,ximagesink
,xvimagesink
,fbdevsink
,waylandsink
,glimagesink
,gtkglsink
等,它们各在不同的插件包里,需要酌情安装:
video-sink | +所属包名 | +
---|---|
waylandsink | +gstreamer1.0-plugins-bad | +
fbdevsink | +gstreamer1.0-plugins-bad | +
autovideosink | +gstreamer1.0-plugins-good | +
gtkglsink | +gstreamer1.0-plugins-good | +
ximagesink | xvimagesink | +gstreamer1.0-plugins-base | +
glimagesink | +gstreamer1.0-plugins-base | gstreamer1.0-gl | +
【TIP】使用 gst-inspect-1.0 <video-sink-name>
来查看对应 video-sink 可用的选项
+【TIP】添加 --gst-debug-level=<lv>
来获得更多的输出日志,其中 <lv>
代表了从 1 到 6,啰嗦程度从低到高,建议在等级 4 及以下,否则日志会非常长
+请尝试不同的 video-sink ,并尝试不同的插件参数,以及给予不同的环境变量,直至找到可以流畅硬解 H264 的那一个。
**waylandsink**
:由于现在(20230720)RevyOS 采用了 Xfce 桌面,不可能支持 Wayland,故 waylandsink
从原理上无法使用**fbdevsink**
与**ximagesink**
:无法使用**xvimagesink**
:通过流水线图以及日志可以确定,playbin 或 autovideosink 会自动调用 xvimagesink,使用 perf 分析后可以发现,使用xvimagesink 不可避免地会进行大量的 memcpy 操作,严重降低解码性能;该问题在获得PTG的 dmabuf 补丁后依然存在,故无法使用**gtkglsink**
:GTK3 不支持 EGL on X11,而 RevyOS 目前基于 x11,且只支持 EGL,故无法使用剩下的只有glimagesink
,根据 Running and debugging GStreamer Applications,并观察其他使用到 glimagesink 的例子,可以猜测需要明确指定环境变量 GST_GL_API
与 GST_GL_PLATFORM
+由于 RevyOS 使用了 gles2+egl 的组合,使用如下的命令,成功硬解。
GST_GL_API=gles2 GST_GL_PLATFORM=egl gst-launch-1.0 filesrc location=<test.mp4> ! qtdemux ! h264parse ! omxh264dec ! videoconvert ! fpsdisplaysink video-sink=glimagesink sync=false
+
+然而 GStreamer 被播放器调用时是无法通过环境变量来传递参数的,所以构建 gst-plugins-base 时应当传递额外的 meson 编译参数:
+-Dgl_api=[\'gles2\'] -Dgl_platform=[\'egl\']
+
+GStreamer 的 pipeline 没有问题之后,就需要使播放器支持。不同播放器会使用到不同的 video-sink,同样对 gstreamer 有着不同程度的依赖。 +适配播放器时,最重要的工作便是①使播放器适配已验证的 video-sink,或者②使 gstreamer pipeline 支持播放器指定的 video-sink,此次 RevyOS 适配过程采用了①方案。
+ +-------------------------------------------+
+ | +------------+ +------------+ | +--------+
+video stream----+--->| omxh264dec +------>| video-sink +----+-->| player |
+ | +------------+ +------------+ | +--------+
+ | GStreamer |
+ +-------------------------------------------+
+
+根据 https://gstreamer.freedesktop.org/apps/ 进行简单的排查
+是否可用 | +是否更新 | +应用名 | +备注 | +
---|---|---|---|
❌ | ++ | Gnash | +Flash 播放器 | +
❌ | ++ | GEntrans | +Debian 未收录 | +
❓ | +20230226 | +Kaffeine | +❌ 需要大量 KDE 相关组件 | +
+ | + | + | ✔️ 存在于riscv64 仓库中 | +
+ | + | + | ❌ 在 Debian amd64 Gnome 上,播放窗口与控制窗口分离,且默认调用了 VLC 进行播放 | +
❌ | ++ | Lcdgrilo | +Debian 未收录 | +
✔️ | +20230218 | +Parole | +✔️ For XFCE | +
+ | + | + | ❓ 不支持 Wayland,仅支持 x11 | +
+ | + | + | ✔️ Debian amd64 Gnome 验证通过 | +
+ | + | + | ✔️ 存在于riscv64 仓库 中 | +
❌ | ++ | Songbird | +Debian 未收录 | +
❌ | ++ | Snappy | +Debian 未收录 | +
❌ | ++ | Totem | +需要 GTK3,然而 GTK3 不支持 EGL on X11 | +
最初选择的播放器是 Totem,但是发现 Totem 无法指定除了 gtkglsink 以外的 video-sink,且由于 RevyOS 不支持 gtkglsink,所以支持 Totem 播放器的难度较大。 +对支持 GStreamer 的播放器进行排查后发现了 Parole , Parole 由 GObject 编写,与常见的面向对象编程略有区别。寻找其构建 parole_gst 对象时的方法 parole_gst_constructed,将 video-sink 属性设置为前文已验证的 glimagesink,补丁:
+parole-01-add-glimagesink-support.patch
+至此,粗略的适配工作完成。
+补丁集合:
+https://gist.github.com/Sakura286/26777ea8204c1819885e093806a4f7ca
+PTG omxil 库
+https://drive.google.com/file/d/1pYgCVI7WltfpskltJ-RqzVUCEC21FS56
+ + + + + + +测试网站地址:https://webglsamples.org/aquarium/aquarium.html
+直接打开即可,左侧数字是渲染的鱼的数量,数量越多越占性能
+ + + + + + + +CoreMark是一个综合基准,用于测量嵌入式系统中使用的中央处理器(CPU)的性能。它是在2009由eembc的shay gal-on开发的,旨在成为一个行业标准,取代过时的dehrystone基准。代码用C编写,包含以下算法:列表处理(增删改查和排序)、矩阵操作(公共矩阵操作)、状态机(确定输入流是否包含有效数字)和CRC。用户可以自由的下载Coremark,并移植到自己的平台上运行,随后就可以看到分数。
+├── barebones --移植到裸机环境下需要修改的目录
+│ ├── core_portme.c --移植的目标平台配置信息
+│ ├── core_portme.h --计时以及板级初始化实现
+│ ├── core_portme.mak --该子目录的makefile
+│ ├── cvt.c
+│ └── ee_printf.c --打印函数串口发送实现
+├── core_list_join.c --列表操作程序
+├── core_main.c --主程序
+├── coremark.h --项目配置与数据结构的定义头文件
+├── coremark.md5
+├── core_matrix.c --矩阵运算程序
+├── core_state.c --状态机控制程序
+├── core_util.c --CRC计算程序
+├── cygwin --x86 cygwin和gcc 3.4(四核,双核和单核系统)的测试代码
+│ ├── core_portme.c
+│ ├── core_portme.h
+│ └── core_portme.mak
+├── freebsd --以下同理,是在不同操作系统下的测试代码
+│ ├── ...
+├── LICENSE.md
+├── linux
+│ ├── ...
+├── linux64
+│ ├── ...
+├── macos
+│ ├── ...
+├── Makefile
+├── README.md --自述文件,CoreMark项目的基本介绍
+├── rtems
+│ ├── ...
+└── simple
+ ├── ...
+ └──
+
+根据 README 说法,只需要在 coremark 文件夹下执行 make 即可进行编译与测试。测试结果会出现在 Results 文件夹中,其中 run1.log 是测试结果。
+coremark 总体测试时间较短。 +计划同时测试 10 次取平均数值。
+$ git clone https://github.com/eembc/coremark.git
+$ cd coremark
+$ make
+
+2K performance run parameters for coremark.
+CoreMark Size : 666
+Total ticks : 12915
+Total time (secs): 12.915000
+Iterations/Sec : 8517.228029
+Iterations : 110000
+Compiler version : GCC13.1.0
+Compiler flags : -O2 -DPERFORMANCE_RUN=1 -lrt
+Memory location : Please put data memory location here
+ (e.g. code in flash, data on heap etc)
+seedcrc : 0xe9f5
+[0]crclist : 0xe714
+[0]crcmatrix : 0x1fd7
+[0]crcstate : 0x8e3a
+[0]crcfinal : 0x33ff
+Correct operation validated. See README.md for run and reporting rules.
+CoreMark 1.0 : 8517.228029 / GCC13.1.0 -O2 -DPERFORMANCE_RUN=1 -lrt / Heap
+
+
+make XCFLAGS="-march=rv64gv0p7_zfh_xtheadc -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -msignedness-cmpiv -fno-code-hoisting -mno-thread-jumps1 -mno-iv-adjust-addr-cost -mno-expand-split-imm"
+
+2K performance run parameters for coremark.
+CoreMark Size : 666
+Total ticks : 15129
+Total time (secs): 15.129000
+Iterations/Sec : 13219.644392
+Iterations : 200000
+Compiler version : GCC10.4.0
+Compiler flags : -O2 -march=rv64gv0p7_zfh_xtheadc -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -msignedness-cmpiv -fno-code-hoisting -mno-thread-jumps1 -mno-iv-adjust-addr-cost -mno-expand-split-imm -DPERFORMANCE_RUN=1 -lrt
+Memory location : Please put data memory location here
+ (e.g. code in flash, data on heap etc)
+seedcrc : 0xe9f5
+[0]crclist : 0xe714
+[0]crcmatrix : 0x1fd7
+[0]crcstate : 0x8e3a
+[0]crcfinal : 0x4983
+Correct operation validated. See README.md for run and reporting rules.
+CoreMark 1.0 : 13219.644392 / GCC10.4.0 -O2 -march=rv64gv0p7_zfh_xtheadc -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -msignedness-cmpiv -fno-code-hoisting -mno-thread-jumps1 -mno-iv-adjust-addr-cost -mno-expand-split-imm -DPERFORMANCE_RUN=1 -lrt / Heap
+
+make XCFLAGS="-march=rv64imafd_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -fno-code-hoisting -mno-thread-jumps"
+
+2K performance run parameters for coremark.
+CoreMark Size : 666
+Total ticks : 11897
+Total time (secs): 11.897000
+Iterations/Sec : 9246.028411
+Iterations : 110000
+Compiler version : GCC13.1.0
+Compiler flags : -O2 -march=rv64imafd_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -fno-code-hoisting -DPERFORMANCE_RUN=1 -lrt
+Memory location : Please put data memory location here
+ (e.g. code in flash, data on heap etc)
+seedcrc : 0xe9f5
+[0]crclist : 0xe714
+[0]crcmatrix : 0x1fd7
+[0]crcstate : 0x8e3a
+[0]crcfinal : 0x33ff
+Correct operation validated. See README.md for run and reporting rules.
+CoreMark 1.0 : 9246.028411 / GCC13.1.0 -O2 -march=rv64imafd_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -fno-code-hoisting -DPERFORMANCE_RUN=1 -lrt / Heap
+
+
+
+
+
+
+
+ glmark2 是基于 OpenGL 2.0 以及 ES 2.0 的一个性能测试.
+此处我们只使用 glmark2-es2 ,软件包已经预装在RevyOS中,用于 x11-glesv2 的测试.
+th1520
只支持 glmark-es2.
开始之前我们需要调整芯片进入高性能模式,在终端中执行下述命令即可,需要使用 sudo
或者root账户.
echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
+
+cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq
+
+如果在执行之后看到 "1848000" 数字,则表明已经调整至性能模式,可以继续向下操作.
+使用任意账户登陆系统,打开终端输入 glmark2-es2
,需要将HDMI连接到显示器,请勿通过SSH连接执行.
输入命令后,桌面上会出现一个有图形活动的新窗口。
+测试完成后,额外窗口会消失,分数会以 glmark2 Score: xxx
的形式输出在终端中。
测试示例:
+debian@lpi4a:~/Desktop$ glmark2-es2
+=======================================================
+ glmark2 2021.12
+=======================================================
+ OpenGL Information
+ GL_VENDOR: Imagination Technologies
+ GL_RENDERER: PowerVR B-Series BXM-4-64
+ GL_VERSION: OpenGL ES 3.2 build 1.17@6210866
+ Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=8
+ Surface Size: 800x600 windowed
+=======================================================
+[build] use-vbo=false: FPS: 513 FrameTime: 1.949 ms
+[build] use-vbo=true: FPS: 1367 FrameTime: 0.732 ms
+[texture] texture-filter=nearest: FPS: 1449 FrameTime: 0.690 ms
+[texture] texture-filter=linear: FPS: 1454 FrameTime: 0.688 ms
+[texture] texture-filter=mipmap: FPS: 1453 FrameTime: 0.688 ms
+[shading] shading=gouraud: FPS: 1172 FrameTime: 0.853 ms
+[shading] shading=blinn-phong-inf: FPS: 1180 FrameTime: 0.847 ms
+[shading] shading=phong: FPS: 1002 FrameTime: 0.998 ms
+[shading] shading=cel: FPS: 979 FrameTime: 1.021 ms
+[bump] bump-render=high-poly: FPS: 700 FrameTime: 1.429 ms
+[bump] bump-render=normals: FPS: 1354 FrameTime: 0.739 ms
+[bump] bump-render=height: FPS: 1320 FrameTime: 0.758 ms
+[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 1059 FrameTime: 0.944 ms
+[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 381 FrameTime: 2.625 ms
+[pulsar] light=false:quads=5:texture=false: FPS: 1484 FrameTime: 0.674 ms
+[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 349 FrameTime: 2.865 ms
+[desktop] effect=shadow:windows=4: FPS: 736 FrameTime: 1.359 ms
+[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 161 FrameTime: 6.211 ms
+[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 173 FrameTime: 5.780 ms
+[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 242 FrameTime: 4.132 ms
+[ideas] speed=duration: FPS: 593 FrameTime: 1.686 ms
+[jellyfish] <default>: FPS: 572 FrameTime: 1.748 ms
+[terrain] <default>: FPS: 42 FrameTime: 23.810 ms
+[shadow] <default>: FPS: 619 FrameTime: 1.616 ms
+[refract] <default>: FPS: 82 FrameTime: 12.195 ms
+[conditionals] fragment-steps=0:vertex-steps=0: FPS: 1539 FrameTime: 0.650 ms
+[conditionals] fragment-steps=5:vertex-steps=0: FPS: 1238 FrameTime: 0.808 ms
+[conditionals] fragment-steps=0:vertex-steps=5: FPS: 1535 FrameTime: 0.651 ms
+[function] fragment-complexity=low:fragment-steps=5: FPS: 1411 FrameTime: 0.709 ms
+[function] fragment-complexity=medium:fragment-steps=5: FPS: 1050 FrameTime: 0.952 ms
+[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 1376 FrameTime: 0.727 ms
+[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 1394 FrameTime: 0.717 ms
+[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 1379 FrameTime: 0.725 ms
+=======================================================
+ glmark2 Score: 950
+=======================================================
+
+
+
+
+
+
+
+
+ ++lmbench for revyOS
+
带宽测评工具 | +反应时间测评工具 | +其他 | +
---|---|---|
读取缓存文件 | +上下文切换 | +\ | +
拷贝内存 | +网络:连接的建立,管道,TCP,UDP 和RPC hot potato | +\ | +
读内存 | +文件系统的建立和删除 | +\ | +
写内存 | +进程创建 | +处理器时钟比率计算 | +
管道 | +信号处理 | +\ | +
TCP | +上层的系统调用 | +\ | +
\ | +内存读入反应时间 | +\ | +
下载测试工具:
+git clone https://github.com/revyos/lmbench3.git
+
+++该版本为已为 RevyOS 移植版本。
+
在开始测试前,需要先安装依赖:
+sudo apt install gcc make libntirpc-dev -y
+
+执行命令进行编译,配置,并测试
+cd lmbench3
+cd src
+make results
+
+编译完成后会有以下选项提示需要设置:
+以下不需要更改的项目直接回车,会自动设置默认值。
+MULTIPLE COPIES [default 1]
: 设置同时运行 lmbench 的份数,份数多会使 lmbench 运行缓慢,默认是 1,这里设置为默认值 1。
=====================================================================
+
+If you are running on an MP machine and you want to try running
+multiple copies of lmbench in parallel, you can specify how many here.
+
+Using this option will make the benchmark run 100x slower (sorry).
+
+NOTE: WARNING! This feature is experimental and many results are
+ known to be incorrect or random!
+
+MULTIPLE COPIES [default 1]:
+=====================================================================
+
+Job placement selection [default 1]
: 作业调度控制方法,默认值是 1,表示允许作业调度,这里设置为默认值。
=====================================================================
+
+Options to control job placement
+1) Allow scheduler to place jobs
+2) Assign each benchmark process with any attendent child processes
+ to its own processor
+3) Assign each benchmark process with any attendent child processes
+ to its own processor, except that it will be as far as possible
+ from other processes
+4) Assign each benchmark and attendent processes to their own
+ processors
+5) Assign each benchmark and attendent processes to their own
+ processors, except that they will be as far as possible from
+ each other and other processes
+6) Custom placement: you assign each benchmark process with attendent
+ child processes to processors
+7) Custom placement: you assign each benchmark and attendent
+ processes to processors
+
+Note: some benchmarks, such as bw_pipe, create attendent child
+processes for each benchmark process. For example, bw_pipe
+needs a second process to send data down the pipe to be read
+by the benchmark process. If you have three copies of the
+benchmark process running, then you actually have six processes;
+three attendent child processes sending data down the pipes and
+three benchmark processes reading data and doing the measurements.
+
+Job placement selection [default 1]:
+=====================================================================
+
+Memory
: 设置测试内存大小,默认是 $MB
, 即为程序计算出来的最大可测试内存,也可以手动定义测试值,这里设置为这里使用默认值。
=====================================================================
+
+Several benchmarks operate on a range of memory. This memory should be
+sized such that it is at least 4 times as big as the external cache[s]
+on your system. It should be no more than 80% of your physical memory.
+
+The bigger the range, the more accurate the results, but larger sizes
+take somewhat longer to run the benchmark.
+
+MB [default 686]:
+Checking to see if you have 686 MB; please wait for a moment...
+686MB OK
+686MB OK
+686MB OK
+Hang on, we are calculating your cache line size.
+OK, it looks like your cache line is 64 bytes.
+
+=====================================================================
+
+SUBSET (ALL|HARWARE|OS|DEVELOPMENT) [default all]
: 要运行的测试集,包含 ALL/HARWARE/OS/DEVELOPMENT
,默认选 all
,这里选 all
。
=====================================================================
+
+lmbench measures a wide variety of system performance, and the full suite
+of benchmarks can take a long time on some platforms. Consequently, we
+offer the capability to run only predefined subsets of benchmarks, one
+for operating system specific benchmarks and one for hardware specific
+benchmarks. We also offer the option of running only selected benchmarks
+which is useful during operating system development.
+
+Please remember that if you intend to publish the results you either need
+to do a full run or one of the predefined OS or hardware subsets.
+
+SUBSET (ALL|HARWARE|OS|DEVELOPMENT) [default all]:
+=====================================================================
+
+FASTMEM [default no]
: 内存 latency
测试,如果跳过该测试,则设置为 yes
,如果不跳过则设置为 no
,默认是 no
,这里设置为默认值。
=====================================================================
+
+This benchmark measures, by default, memory latency for a number of
+different strides. That can take a long time and is most useful if you
+are trying to figure out your cache line size or if your cache line size
+is greater than 128 bytes.
+
+If you are planning on sending in these results, please don't do a fast
+run.
+
+Answering yes means that we measure memory latency with a 128 byte stride.
+
+FASTMEM [default no]:
+=====================================================================
+
+SLOWFS [default no]
: 文件系统 latency
测试,如果跳过值设置为 yes
,不跳过设置为 no
,默认 no
,这里设置为默认值。
=====================================================================
+
+This benchmark measures, by default, file system latency. That can
+take a long time on systems with old style file systems (i.e., UFS,
+FFS, etc.). Linux' ext2fs and Sun's tmpfs are fast enough that this
+test is not painful.
+
+If you are planning on sending in these results, please don't do a fast
+run.
+
+If you want to skip the file system latency tests, answer "yes" below.
+
+SLOWFS [default no]:
+=====================================================================
+
+DISKS [default none]
: 硬盘带宽和 seek time
,需要设置测试硬盘的盘符,例如 /dev/sda
,默认不测试(默认 none ),这里设置为默认值。
=====================================================================
+
+This benchmark can measure disk zone bandwidths and seek times. These can
+be turned into whizzy graphs that pretty much tell you everything you might
+need to know about the performance of your disk.
+
+This takes a while and requires read access to a disk drive.
+Write is not measured, see disk.c to see how if you want to do so.
+
+If you want to skip the disk tests, hit return below.
+
+If you want to include disk tests, then specify the path to the disk
+device, such as /dev/sda. For each disk that is readable, you'll be
+prompted for a one line description of the drive, i.e.,
+
+ Iomega IDE ZIP
+or
+ HP C3725S 2GB on 10MB/sec NCR SCSI bus
+
+DISKS [default none]:
+=====================================================================
+
+REMOTE [default none]
: 网络测试,需要 2
台机器并设置 rsh
,是测试机器能 rsh
访问另一台,默认不测试(默认 none ),这里设置为默认值。
=====================================================================
+
+If you are running on an idle network and there are other, identically
+configured systems, on the same wire (no gateway between you and them),
+and you have rsh access to them, then you should run the network part
+of the benchmarks to them. Please specify any such systems as a space
+separated list such as: ether-host fddi-host hippi-host.
+
+REMOTE [default none]:
+=====================================================================
+
+Processor mhz [default 999 MHz, 1.0010 nanosec clock]
: 测试 cpu
,默认 $MHZ
,即为程序判断出的频率,也可以根据情况自己设定,例如 3500,单位 MHz
,这里设置为默认值。
=====================================================================
+
+Calculating mhz, please wait for a moment...
+I think your CPU mhz is
+
+ 999 MHz, 1.0010 nanosec clock
+
+but I am frequently wrong. If that is the wrong Mhz, type in your
+best guess as to your processor speed. It doesn't have to be exact,
+but if you know it is around 800, say 800.
+
+Please note that some processors, such as the P4, have a core which
+is double-clocked, so on those processors the reported clock speed
+will be roughly double the advertised clock rate. For example, a
+1.8GHz P4 may be reported as a 3592MHz processor.
+
+Processor mhz [default 999 MHz, 1.0010 nanosec clock]:
+=====================================================================
+
+FSDIR [default /usr/tmp]
: 临时目录用来存放测试文件,可以自己设定,默认 /usr/tmp
,这里设置为默认值。
=====================================================================
+
+We need a place to store a 686 Mbyte file as well as create and delete a
+large number of small files. We default to /usr/tmp. If /usr/tmp is a
+memory resident file system (i.e., tmpfs), pick a different place.
+Please specify a directory that has enough space and is a local file
+system.
+
+FSDIR [default /usr/tmp]:
+=====================================================================
+
+Status output file [default /dev/tty]
: 测试输出信息文件存放目录,可以自己设定,默认 /dev/tty
。
=====================================================================
+
+lmbench outputs status information as it runs various benchmarks.
+By default this output is sent to /dev/tty, but you may redirect
+it to any file you wish (such as /dev/null...).
+
+Status output file [default /dev/tty]:
+=====================================================================
+
+Mail results [default yes]
: 是否将测试结果邮件发出来,默认是 yes
,这里设置为 no
。
=====================================================================
+
+There is a database of benchmark results that is shipped with new
+releases of lmbench. Your results can be included in the database
+if you wish. The more results the better, especially if they include
+remote networking. If your results are interesting, i.e., for a new
+fast box, they may be made available on the lmbench web page, which is
+
+ http://www.bitmover.com/lmbench
+
+Mail results [default yes]: no
+OK, no results mailed.
+=====================================================================
+
+以上项目设置完成后,开始自动执行测试。
+p7zip 测试是用于测试系统解压性能,通过数据直观评估性能,以下是运行 7pzip 测试的操作步骤
+首先需要在 RevyOS 中 安装 p7zip
+debian@lpi4a:~/Desktop$ sudo apt update
+debian@lpi4a:~/Desktop$ sudo apt install p7zip-full
+
+进行 p7zip 测试需要在终端中输入以下命令来执行:
+debian@lpi4a:~/Desktop$ 7z b
+
+系统会开始进行测试然后输出性能数据。
+通过以上步骤,可以在 RevyOS 上安装并测试 7zip 的性能。
+以下是测试结果参考,使用镜像版本为RevyOS2023121016g版本
+debian@lpi4a:~/Desktop$ 7z b
+
+7-Zip 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
+p7zip Version 16.02 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs LE)
+
+LE
+CPU Freq: - 64000000 64000000 - - - - - -
+
+RAM size: 15739 MB, # CPU hardware threads: 4
+RAM usage: 882 MB, # Benchmark threads: 4
+
+ Compressing | Decompressing
+Dict Speed Usage R/U Rating | Speed Usage R/U Rating
+ KiB/s % MIPS MIPS | KiB/s % MIPS MIPS
+
+22: 3252 303 1045 3164 | 75268 394 1628 6422
+23: 3092 307 1025 3151 | 74514 399 1617 6447
+24: 3021 318 1022 3249 | 72017 398 1588 6322
+25: 2945 320 1050 3363 | 67801 395 1529 6034
+---------------------------------- | ------------------------------
+Avr: 312 1036 3232 | 396 1591 6306
+Tot: 354 1313 4769
+
+
+
+
+
+
+
+ 使用脚本对整机进行重启测试。
+测试机器重启会不会出现死机等问题。
+进行重启测试 500 次。
+在 /lib/system/system 下创建名为 cycletest.service_ 重启脚本:
+[Unit]
+Description=Reboots unit after 30s
+
+[Service]
+StandardOutput=syslog+console
+ExecStart=/bin/sh -c "\
+test -f /cycle-count || echo 0 > /cycle-count;\
+echo 'starting cycletest';\
+sleep 30;\
+expr `cat /cycle-count` + 1 > /cycle-count;\
+systemctl reboot;\
+"
+
+[Install]
+WantedBy=multi-user.target
+
+后根据以下指令安装并开始测试:
+systemctl daemon-reload
+systemctl enable cycletest.service (enable the service to start on reboot)
+systemctl start cycletest.service (start the service, should reboot in 30s)
+
+
+
+
+
+
+
+ STREAM 基准测试是一个简单的综合基准测试程序,它测量可持续内存带宽(以 MB/s 为单位)和简单向量内核的相应计算速率。
+stream 仅有单个文件,在进行测试时只需要对 stream.c
进行编译即可:
git clone <https://github.com/microseyuyu/STREAM.git>
+cd STREAM
+gcc -O3 -fopenmp -DN=2000000 -DNTIMES=10 stream.c -o stream
+export OMP_NUM_THREADS=8
+./stream
+
+参数说明:
+DN=2000000:指定测试数组a[]、b[]、c[]的大小(Array size)。该值对测试结果影响较大(5.9版本默认值2000000,。若stream.c为5.10版本,参数名变为-DSTREAM_ARRAY_SIZE,默认值10000000)。注意:必须设置测试数组大小远大于CPU 最高级缓存(一般为L3 Cache)的大小,否则就是测试CPU缓存的吞吐性能,而非内存吞吐性能。 +- -DNTIMES=10:执行的次数,并从这些结果中选最优值。 +- OMP_NUM_THREADS=8 线程数量。
+参考结果:
+debian@lpi4a:~/Desktop/STREAM$ ./stream
+-------------------------------------------------------------
+STREAM version $Revision: 5.10 $
+-------------------------------------------------------------
+This system uses 8 bytes per array element.
+-------------------------------------------------------------
+***** WARNING: ******
+ It appears that you set the preprocessor variable N when compiling this code.
+ This version of the code uses the preprocesor variable STREAM_ARRAY_SIZE to control the array size
+ Reverting to default value of STREAM_ARRAY_SIZE=10000000
+***** WARNING: ******
+Array size = 10000000 (elements), Offset = 0 (elements)
+Memory per array = 76.3 MiB (= 0.1 GiB).
+Total memory required = 228.9 MiB (= 0.2 GiB).
+Each kernel will be executed 10 times.
+ The *best* time for each kernel (excluding the first iteration)
+ will be used to compute the reported bandwidth.
+-------------------------------------------------------------
+Number of Threads requested = 8
+Number of Threads counted = 8
+-------------------------------------------------------------
+Your clock granularity/precision appears to be 1 microseconds.
+Each test below will take on the order of 21622 microseconds.
+ (= 21622 clock ticks)
+Increase the size of the arrays if this shows that
+you are not getting at least 20 clock ticks per test.
+-------------------------------------------------------------
+WARNING -- The above is only a rough guideline.
+For best results, please be sure you know the
+precision of your system timer.
+-------------------------------------------------------------
+Function Best Rate MB/s Avg time Min time Max time
+Copy: 8364.2 0.019258 0.019129 0.019508
+Scale: 8291.0 0.019572 0.019298 0.020162
+Add: 6223.6 0.038835 0.038563 0.040011
+Triad: 6222.5 0.038776 0.038570 0.039470
+-------------------------------------------------------------
+Solution Validates: avg error less than 1.000000e-13 on all three arrays
+-------------------------------------------------------------
+
+
+
+
+
+
+
+ # qemu-user 下编译
+sudo apt update
+sudo apt install -y \
+ sbuild buildd qemu-system-misc qemu-user-static binfmt-support \
+ ca-certificates apt-transport-https devscripts mmdebstrap
+
+# native
+sudo apt install -y \
+ sbuild buildd ca-certificates apt-transport-https devscripts mmdebstrap
+
+# 修正宿主的debian-ports证书相关问题 现阶段可能不需要了
+wget https://mirror.sjtu.edu.cn/debian/pool/main/d/debian-ports-archive-keyring/debian-ports-archive-keyring_2023.02.01_all.deb
+sudo dpkg -i ./debian-ports-archive-keyring_2023.02.01_all.deb
+
+
+# sbuild 增加当前用户免root
+sudo sbuild-adduser $USER
+
+export SUFFIX=revyos-c910v-sbuild
+sudo sbuild-createchroot --debootstrap=debootstrap --arch=riscv64 \
+ --chroot-suffix=-$SUFFIX \
+ --keyring='' \
+ --no-deb-src \
+ --include=debian-ports-archive-keyring,ca-certificates,apt-transport-https,eatmydata \
+ --extra-repository="deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-c910v/ revyos-c910v main contrib non-free" \
+ --extra-repository="deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-addons/ revyos-addons main" \
+ sid /srv/chroot/sid-riscv64-$SUFFIX \
+ https://mirror.iscas.ac.cn/revyos/revyos-base/
+
+# 修正环境相关问题
+sudo sed -i 's/deb http/deb [trusted=yes] http/g' /srv/chroot/sid-riscv64-$SUFFIX/etc/apt/sources.list
+sudo rm -rf /srv/chroot/sid-riscv64-$SUFFIX/var/lib/apt/lists/*
+echo "command-prefix=eatmydata" | sudo tee -a /etc/schroot/chroot.d/sid-riscv64-$SUFFIX-*
+
+# 调整source顺序 - 目的是同版本使用c910v仓库的
+# 编辑sources.list 确保以下顺序
+deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-c910v/ revyos-c910v main contrib non-free
+deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-addons/ revyos-addons main
+deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-base/ sid main contrib non-free non-free-firmware
+
+sbuild --arch=riscv64 -d sid -c sid-riscv64-revyos-c910v-sbuild xxx.dsc
+
+
+
+
+
+
+
+ 实验性 feature
如果发现问题可以进行issue申报
# 增加优化源
+sudo sed -i '1ideb https://mirror.iscas.ac.cn/revyos/revyos-c910v/ revyos-c910v main' /etc/apt/sources.list
+# 更新软件
+sudo apt update && sudo apt upgrade -y
+# 安装 gcc-10/gcc-13
+sudo apt install -y build-essential gcc-13 g++-13
+# 重启避免其他问题
+sudo reboot
+
+gcc -v
+Using built-in specs.
+COLLECT_GCC=gcc
+COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/10/lto-wrapper
+Target: riscv64-linux-gnu
+Configured with: ../src/configure -v --with-pkgversion='Debian 10.4.0-8revyos2.3' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=riscv64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libsanitizer --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --disable-multilib --with-arch=rv64gcv0p7_zfh_xtheadc --with-abi=lp64d --enable-checking=release --build=riscv64-linux-gnu --host=riscv64-linux-gnu --target=riscv64-linux-gnu
+Thread model: posix
+Supported LTO compression algorithms: zlib zstd
+gcc version 10.4.0 (Debian 10.4.0-8revyos2.3)
+
+gcc-13 -v
+Using built-in specs.
+COLLECT_GCC=gcc-13
+COLLECT_LTO_WRAPPER=/usr/libexec/gcc/riscv64-linux-gnu/13/lto-wrapper
+Target: riscv64-linux-gnu
+Configured with: ../src/configure -v --with-pkgversion='Debian 13.2.0-1revyos1' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=riscv64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --disable-multilib --with-arch=rv64gc_zfh_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync --with-abi=lp64d --enable-checking=release --build=riscv64-linux-gnu --host=riscv64-linux-gnu --target=riscv64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=16
+Thread model: posix
+Supported LTO compression algorithms: zlib zstd
+gcc version 13.2.0 (Debian 13.2.0-1revyos1)
+
+除了v0p7 其他优化都可以用 gcc-13 代替 gcc-10
+后者的优化可以主线报问题 是已经主线化的功能
+ + + + + + +RevyOS 会预制相关优化编译器 基本支持rv64gc
支持的优化 | +gcc-10 | +gcc-13 | +clang-17 | +
---|---|---|---|
Zfh | +✅ | +✅ | +✅ | +
v0p7 | +✅ | +❌ | +❌ | +
xthead 当前版本 v2.2
+支持的优化1 | +gcc-102 | +gcc-13.2 | +clang-17 | +
---|---|---|---|
XTheadCmo | +✅ | +✅ | +✅ | +
XTheadSync | +✅ | +✅ | +✅ | +
XTheadBa | +✅ | +✅ | +✅ | +
XTheadBb | +✅ | +✅ | +✅ | +
XTheadBs | +✅ | +✅ | +✅ | +
XTheadCondMov | +✅ | +✅ | +✅ | +
XTheadMemIdx | +✅ | +✅ | +✅ | +
XTheadMemPair | +✅ | +✅ | +✅ | +
XTheadFMemIdx | +✅ | +✅ | +✅ | +
XTheadMac | +✅ | +✅ | +✅ | +
XTheadFmv | +✅ | +✅ | +❌ | +
XTheadInt | +✅ | +✅ | +❌ | +
XTHeadVdot3 | +✅ | +✅ | +✅ | +
注:
+首先确保安装gcc:
+sudo apt update
+sudo apt install gcc
+
+下面以最简单的 'hello,world' 程序为例演示如何编译并运行:
+编译以下内容并命名为 hello.c
:
#include <stdio.h>
+
+int main()
+{
+ printf("hello, world\n");
+ return 0;
+}
+
+编译并执行:
+debian@lpi4a:~/test$ gcc -g hello.c -o hello
+
+debian@lpi4a:~/test$ ./hello
+hello, world
+
+
+首先确保安装g++:
+sudo apt update
+sudo apt install g++
+
+下面以最简单的 'hello,world' 程序为例演示如何编译并运行:
+编译以下内容并命名为 hello.cpp
:
#include <iostream>
+using namespace std;
+
+int main()
+{
+ cout << "Hello, World!\n";
+ return 0;
+}
+
+
+编译并执行:
+debian@lpi4a:~/test$ g++ -g hello.cpp -o hello
+debian@lpi4a:~/test$ ./hello
+Hello, World!
+
+以上就是gcc/g++ 编译程序并运行的最简单实例,更复杂的应用案例可以参考相应的 +系统编程手册。
+ + + + + + +内核工具链下载地址:
+https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1663142514282/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz
+这里假设编译环境为 Ubuntu
或 Debian
安装依赖:
+sudo apt install -y gdisk dosfstools g++-12-riscv64-linux-gnu build-essential libncurses-dev gawk flex bison openssl libssl-dev tree dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf device-tree-compiler
+
+解压工具链(这里解压到/opt):
+tar -xvf Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz -C /opt
+
+设置环境变量,将工具链加入环境变量中(假设工具链放在/opt中):
+export PATH="/opt/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1/bin:$PATH"
+export CROSS_COMPILE=riscv64-unknown-linux-gnu-
+export ARCH=riscv
+
+使用git下载内核代码:
+# 内核仓库
+git clone https://github.com/revyos/thead-kernel.git
+
+编译内核:
+# 创建安装目标目录
+mkdir rootfs && mkdir rootfs/boot
+
+# 目录创建完成后,目录结构应该看起来是这样:
+# .. << 当前工作路径
+# |-- rootfs
+# |-- boot
+# |-- thead-kernel
+# |-- ...
+
+# 进入内核代码目录,开始构建
+cd thead-kernel
+make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv revyos_defconfig
+make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv -j$(nproc)
+make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv -j$(nproc) dtbs
+sudo make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv INSTALL_MOD_PATH=../rootfs/ modules_install -j$(nproc)
+sudo make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv INSTALL_PATH=../rootfs/boot zinstall -j$(nproc)
+# 构建perf(如果需要的话)
+make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv LDFLAGS=-static NO_LIBELF=1 NO_JVMTI=1 VF=1 -C tools/perf/
+sudo cp -v tools/perf/perf ../rootfs/sbin/perf-thead
+# 安装内核到安装目标目录
+sudo cp -v arch/riscv/boot/Image ../rootfs/boot/
+# 安装设备树到安装目标目录
+sudo cp -v arch/riscv/boot/dts/thead/light-lpi4a.dtb ../rootfs/boot/
+sudo cp -v arch/riscv/boot/dts/thead/light-lpi4a-dsi0-hdmi.dtb ../rootfs/boot/
+
+之后只需要把rootfs中内容拷贝或覆盖到对应目录即可,注意内核Image和内核module目录一定要对应,不然会因缺失内核模块导致外设功能失效。
+ + + + + + +C910V强制cpu指定补丁
+From 5164bca5a4bcde4534dc1a9aa3a7f619719874cf Mon Sep 17 00:00:00 2001
+From: Han Gao <gaohan@iscas.ac.cn>
+Date: Sun, 23 Apr 2023 22:11:35 +0800
+Subject: [PATCH] qemu-user-riscv64 default cpu is c910v
+
+Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
+---
+ linux-user/riscv/target_elf.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/linux-user/riscv/target_elf.h b/linux-user/riscv/target_elf.h
+index 9dd65652ee45..3195cfa71408 100644
+--- a/linux-user/riscv/target_elf.h
++++ b/linux-user/riscv/target_elf.h
+@@ -9,7 +9,7 @@
+ #define RISCV_TARGET_ELF_H
+ static inline const char *cpu_get_model(uint32_t eflags)
+ {
+- /* TYPE_RISCV_CPU_ANY */
+- return "any";
++ /* TYPE_RISCV_CPU_C910V */
++ return "c910v";
+ }
+ #endif
+
+编译流程
+./configure \
+ --prefix=$HOME/qemu-install \
+ --static \
+ --target-list=riscv64-linux-user \
+ --disable-system \
+ --disable-pie \
+ --interp-prefix=/etc/qemu-binfmt/%M
+
+make -j20
+
+
+
+
+
+
+
+ 这里描述了 RevyOS 相关的构建文档
+ + + + + + +测试版镜像
+基于 lpi4a 20230614 版本 +增加 ahead 支持 混合新 20230820 改动
+https://mirror.iscas.ac.cn/revyos/extra/images/beagle/test/20230802/
+RevyOS 20230412 版本
+RevyOS 20230425 版本
+RevyOS 20230511 版本
+添加了gnome桌面支持
+RevyOS 20230614 版本
+当前版本只提供xfce4桌面支持
+提供了chromium支持
+RevyOS 20230810 版本
+重新设计了启动流程 所以需要重新刷写所有分区
+Retrieving file: /dtbs/linux-image-5.10.113-lpi4a/<NULL>-light-c910.
+Skipping l0r for failure retrieving fdt
+Light LPI4A#
+
+遇见这种情况需要执行</br>
+env default -a -f;env save;reset
+
+当前版本只提供xfce4桌面支持
+内核 commit ID: #2023.08.10.02.31+c130cdb21
+RevyOS 20230916 版本
+SBI 时间戳
+u-boot 时间戳
+内核 commit ID
+版本时间戳(/etc/revyos-release)
+RevyOS 20231026 版本
+RevyOS 20231210 版本
+SBI 时间戳
+u-boot 时间戳
+内核 commit ID
+版本时间戳(/etc/revyos-release)
+RevyOS 20240202 版本
+SBI 时间戳
+u-boot 时间戳
+内核 commit ID
+版本时间戳(/etc/revyos-release)
+RevyOS 20240601 版本
+SBI 时间戳
+u-boot 时间戳
+内核 commit ID
+版本时间戳(/etc/revyos-release)
+状态: +可以运行,软解图形
+资料: +https://github.com/OpenTTD/OpenTTD/blob/master/COMPILING.md +https://salsa.debian.org/openttd-team/openttd/-/blob/master/debian/control
+# 安装依赖
+sudo apt install libsdl2-dev zlib1g-dev libpng-dev libfreetype-dev libfontconfig-dev libicu-dev liblzo2-dev liblzma-dev libfluidsynth-dev libopengl-dev grfcodec openttd-opengfx cmake
+
+# 下载代码&编译
+git clone https://github.com/OpenTTD/OpenTTD.git
+cd OpenTTD
+mkdir build
+cd build
+cmake ..
+make
+
+# 运行
+./openttd
+
+图形和音频资源文件通过游戏内功能下载,支持中文
+ + + + + + + +状态: +可以运行,支持GLES加速
+资料: +https://github.com/yquake2/yquake2/blob/master/doc/020_installation.md +https://github.com/yquake2/yquake2/blob/master/doc/030_configuration.md
+# 安装依赖
+sudo apt install build-essential libgl1-mesa-dev libsdl2-dev libopenal-dev libcurl4-openssl-dev
+
+# 下载代码&编译
+git clone https://github.com/yquake2/yquake2.git
+mkdir build
+cd build
+cmake ..
+make
+
+# 运行
+#(需要准备好游戏原始资源文件夹baseq2)
+cd ..
+cd release
+cp -r ~/baseq2 .
+./quake2
+
+需要将原始游戏资源文件夹baseq2放到和quake2程序同一个目录中(Steam版可用)
+分辨率和图形加速选项在游戏内设置菜单修改,不修改默认是软渲染,硬渲染设置请改为“OpenGL ES3”(参见下图)
+ + + + + + + +在RevyOS中安装包只需要在 terminal 中输入
+apt install + 包名
+
+即可安装
+以下以安装 git作为演示
+debian@lpi4a:~$ sudo apt install git
+[sudo] password for debian:
+Reading package lists... Done
+Building dependency tree... Done
+Reading state information... Done
+The following additional packages will be installed:
+ git-man liberror-perl patch
+Suggested packages:
+ gettext-base git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui
+ gitk gitweb git-cvs git-mediawiki git-svn ed diffutils-doc
+The following NEW packages will be installed:
+ git git-man liberror-perl patch
+0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
+Need to get 8605 kB of archives.
+After this operation, 39.4 MB of additional disk space will be used.
+Do you want to continue? [Y/n] y
+Get:1 https://mirror.iscas.ac.cn/revyos/revyos-base sid/main riscv64 liberror-perl all 0.17029-2 [29.0 kB]
+Get:2 https://mirror.iscas.ac.cn/revyos/revyos-base sid/main riscv64 git-man all 1:2.40.1-1 [2072 kB]
+Get:3 https://mirror.iscas.ac.cn/revyos/revyos-base sid/main riscv64 git riscv64 1:2.40.1-1 [6390 kB]
+Get:4 https://mirror.iscas.ac.cn/revyos/revyos-base sid/main riscv64 patch riscv64 2.7.6-7+b1 [114 kB]
+Fetched 8605 kB in 1s (6656 kB/s)
+Selecting previously unselected package liberror-perl.
+(Reading database ... 75688 files and directories currently installed.)
+Preparing to unpack .../liberror-perl_0.17029-2_all.deb ...
+Unpacking liberror-perl (0.17029-2) ...
+Selecting previously unselected package git-man.
+Preparing to unpack .../git-man_1%3a2.40.1-1_all.deb ...
+Unpacking git-man (1:2.40.1-1) ...
+Selecting previously unselected package git.
+Preparing to unpack .../git_1%3a2.40.1-1_riscv64.deb ...
+Unpacking git (1:2.40.1-1) ...
+Selecting previously unselected package patch.
+Preparing to unpack .../patch_2.7.6-7+b1_riscv64.deb ...
+Unpacking patch (2.7.6-7+b1) ...
+Setting up liberror-perl (0.17029-2) ...
+Setting up patch (2.7.6-7+b1) ...
+Setting up git-man (1:2.40.1-1) ...
+Setting up git (1:2.40.1-1) ...
+Processing triggers for man-db (2.11.2-2) ...
+
+
+
+
+
+
+
+ 源中已有 riscv64 的docker安装包,名为 docker.io
,可以直接使用:
sudo apt install docker.io
+
+sudo docker pull riscv64/debian:unstable
+
+如果需要不以 root 权限运行 docker, 即如果不用 sudo, 出现了下面的错误:
+debian@lpi4a:~$ docker pull riscv64/debian:unstable
+Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/create?fromImage=riscv64%2Fdebian&tag=unstable": dial unix /var/run/docker.sock: connect: permission denied
+
+
+需要执行以下命令将用户加入 docker
用户组中:
sudo usermod -aG docker $USER # 或换成需要免root运行docker的用户名
+
+重新登陆,如果出现下面的结果即可免特权运行docker
+$ id
+uid=1000(debian) gid=1000(debian) groups=1000(debian),4(adm),7(lp),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),105(netdev),106(bluetooth),112(docker),996(input) # 这里出现了 docker 用户组即可
+
+编辑 /usr/lib/systemd/system/docker.service
,在 [Service]
下加入代理,docker只读取下面三个变量
[Service]
+...
+Environment="HTTP_PROXY=http://proxy.example.com:8080/"
+Environment="HTTPS_PROXY=http://proxy.example.com:8080/"
+Environment="NO_PROXY=localhost,127.0.0.1,.example.com"
+
+添加完成后重加载 systemd units,然后重启 docker 即可
+sudo systemctl daemon-reload
+sudo systemctl restart docker
+
+
+
+
+
+
+
+ ++本页的 ROS 指 ROS 2
+
状态:可以运行
+官方资料页:https://ros.org/
+官方文档: https://docs.ros.org/
+ROS (Robot Operating System, 机器人操作系统) 提供一系列程序库和工具以帮助软件开发者创建机器人应用软件。它提供了硬件抽象、设备驱动、函数库、可视化工具、消息传递和软件包管理等诸多功能。ROS遵循BSD开源许可协议。
+假设使用来自 ros.z572.online
的源
注意下面应该使用 bookworm
sudo sh -c "echo 'deb [trusted=yes] https://ros.z572.online/main bookworm main\ndeb-src [trusted=yes] https://ros.z572.online/main bookworm main' > /etc/apt/sources.list.d/ros.list"
+sudo apt update
+sudo apt upgrade
+
+目前已经测试 ROS Jazzy 和 Humble 版本可用
+注意:两个版本可能会存在依赖冲突,请不要尝试同时安装两个版本
+Jazzy:
+apt install ros-jazzy-desktop-full
+
+Humble:
+apt install ros-humble-desktop-full
+
+sudo apt install python3-rosdep2
+
+然后删除 /etc/ros/rosdep/sources.list.d/10-debian.list
,
+并修改 etc/ros/rosdep/sources.list.d/20-default.list
为下面的内容
yaml https://raw.githubusercontent.com/revyos-ros/rosdistro/master/rosdep/base.yaml
+yaml https://raw.githubusercontent.com/revyos-ros/rosdistro/master/rosdep/python.yaml
+yaml https://raw.githubusercontent.com/revyos-ros/rosdistro/master/rosdep/ruby.yaml
+
+根据安装的 ROS 版本,选择相应的命令
+Jazzy:
+source /opt/ros/jazzy/setup.sh
+
+Humble:
+source /opt/ros/Humble/setup.sh
+
+可以将上面的内容加入 .bashrc
或者您使用的 shell profile 中。
rosdep update
+
+使用 rosdep 安装外部依赖(以 micro_ros_setup
)为例
1.设置环境变量 +请根据您安装的版本选择对应的命令
+Jazzy:
+AMENT_PACKAGE_PATH=/opt/ros/jazzy
+
+Humble:
+AMENT_PACKAGE_PATH=/opt/ros/humble
+
+2.下载源代码
+git clone https://github.com/micro-ROS/micro_ros_setup && cd micro_ros_setup
+
+3.安装依赖
+rosdep install --from-paths . -y --ignore-src
+
+colon 是一款现代的 ROS 编译工具
+sudo apt install colcon
+
+测试编译(依然以 micro_ros_setup
)为例
git clone https://github.com/micro-ROS/micro_ros_setup && cd micro_ros_setup
+colcon build
+
+ros2 pkg
命令用于管理 ROS 2 包。ros2 run
命令用于运行 ROS 2 包中的特定节点。ros2 topic
命令用于与 ROS 2 的话题交互。ros2 param
命令用于管理 ROS 2 参数。ros2 service
命令用于与 ROS 2 服务交互。ros2 node
命令用于与 ROS 2 节点交互。ros2 bag
命令用于记录和回放 ROS 2 数据。ros2 launch
命令用于启动 ROS 2 启动文件。Node(C++)
+ 运行 C++ 节点:
+bash
+ ros2 run demo_nodes_cpp talker
+ ros2 run demo_nodes_cpp listener
Node(Python)
+ 运行 Python 节点:
+bash
+ ros2 run demo_nodes_py talker
+ ros2 run demo_nodes_py listener
Add Two Ints Server
+ 测试服务端和客户端:
+bash
+ ros2 run demo_nodes_cpp add_two_ints_server
+ ros2 run demo_nodes_cpp add_two_ints_client
TF2
+ 测试静态变换、监听和监控功能:
+ 发布静态变换并监听:
+bash
+ ros2 run tf2_ros static_transform_publisher 1 1 1 0 0 0 /base_link /odom
+ ros2 run tf2_ros tf2_echo base_link odom
+ 监控变换:
+bash
+ ros2 run tf2_ros static_transform_publisher 1 1 1 0 0 0 /base_link /odom
+ ros2 run tf2_ros tf2_monitor
+ 查看变换框架图(需生成 PDF 文件):
+bash
+ ros2 run tf2_ros static_transform_publisher 1 1 1 0 0 0 /base_link /odom
+ ros2 run tf2_tools view_frames
TurtleSim
+ 需要图形界面支持:
+ 启动 turtlesim 节点:
+bash
+ ros2 run turtlesim turtlesim_node
+ 图形界面会弹出一个窗口。
+ 使用键盘控制小乌龟:
+bash
+ ros2 run turtlesim turtle_teleop_key
bash
+ ros2 run rqt_gui rqt_gui
需要使用 sudo switch-gl gl4es
再重启后使用 LIBGL_ALWAYS_SOFTWARE=true rviz2 here
启动,效果如下
使用 sudo apt install gazebo11
安装
需要使用 sudo switch-gl gl4es
再重启后使用 LIBGL_ALWAYS_SOFTWARE=true gazebo
启动,效果如下
状态:可以运行
+官方资料页:https://docs.gimp.org/2.10/en/
+GIMP 是一个多平台工具,用于创建和编辑各种图像。 GIMP 是 GNU Image Manipulation Program 的首字母缩写。 GIMP 有很多功能。它可以用作简单的绘画程序、专家级的照片修饰程序、创建数字艺术的工具、在线批处理系统、批量生产的图像渲染器、图像格式转换器等。 GIMP 是可扩展和可扩展的。它旨在通过插件和扩展来增强以执行任何操作。先进的脚本界面允许从最简单的任务到最复杂的图像处理程序的所有内容都可以轻松编写脚本。
+GIMP是 RevyOS 预安装图形处理软件,如想使用 GIMP,在terminal中输入
+gimp
+
+在等待资源加载后就会弹出 GIMP 主界面
+ +使用功能参考官方资料页
+ + + + + + +状态:可以运行
+资料:https://wiki.debian.org/I18n/ibus
+sudo apt install ibus ibus-libpinyin
+sudo reboot
+
+重启后需要手动将中文输入法添加到输入选项中:
+托盘图标->右击->Preference +
+点击选项卡Input Method->Add,打开下图窗口 +
+点击Chinese->Intelligent Pinyin->Add +
+ + + + + + +WIP
+ + + + + + +WIP
+ + + + + + +The LicheePi 4A board supports booting from both SD card and eMMC. Below are instructions for flashing RevyOS images for each method.
+Environment: Ubuntu 22.04
+++Note: Ensure the dip switch is set for eMMC boot, even when booting from an SD card.
+
Install zstd
for decompressing the image:
apt install zstd
+
+Download the system image starting with sdcard-
for LicheePi4A from the RevyOS mirror site.
Decompress the downloaded image file:
+unzstd sdcard-lpi4a-20240720_171951.img.zst
+
+Install BalenaEtcher from official website https://etcher.balena.io/.
+.img
file.
+ You must the device after of=
is correct.
# sudo dd if=./sdcard-lpi4a-20240720_171951.img of=<Target Device> status=progress
+# sync
+
+After completed, you can boot from that SD card.
+After flashing, insert the SD card into the slot on the board, as shown below. +
+Connect the HDMI and power cables to start the system.
+When booting from eMMC, RevyOS images are flashed to the eMMC storage using fastboot
. There are two options: connecting with or without a serial interface. This guide provides instructions for both methods.
You must eject SD card when booting from eMMC.
+Flashing the image to eMMC requires U-Boot, boot, and root files to be flashed via fastboot
. Ensure fastboot
is installed:
apt install fastboot
+
+If using a serial connection, install minicom
to monitor the console:
apt install minicom
+
+Download the necessary image files for LicheePi4A from the RevyOS mirror site.
+Make sure to choose the U-Boot file that matches your board model.
+After downloading, decompress root and boot image with unzstd
.
unzstd boot-lpi4a-20240720_171951.ext4.zst
+unzstd root-lpi4a-20240720_171951.ext4.zst
+
+Hold down the BOOT button on the board and connect it to the computer via USB. The board will enter flashing mode.
+Open minicom
in a terminal to access the serial console:
bash
+ sudo minicom
Connect the USB end to the computer, and connect the Type-C interface on the board to the computer with a USB-Type-C cable.
+Connect the serial port like following image. In the red circle(count from left to right, the second pin on the first row) is GND, in the yellow circle(fifth pin on the first row) is TX and in the green circle(fifth pin on the second row) is RX. You have to connect TX to RX, RX to TX and GND to GND when connecting to your host device.
+ +In the serial console, press any key to interrupt the boot process. Then, enter the following command:
+bash
+ fastboot usb 0
In a new terminal window, navigate to the folder where the image files are stored, and execute the following flash commands:
+If running lsusb
doesn't give a ID 1234:8888 Brain Actuated Technologies USB download gadget
output, excecute following commant to enter u-boot fastboot
fastboot flash ram u-boot-with-spl-lpi4a-16g.bin # Replace with your device's uboot image
+ fastboot reboot
+ sleep 1
+
+bash
+ fastboot flash ram u-boot-with-spl-lpi4a-16g.bin # Replace with your device's uboot image
+ fastboot reboot
+ sleep 1
+ fastboot flash uboot u-boot-with-spl-lpi4a-16g.bin
+ fastboot flash boot boot-lpi4a-20240720_171951.ext4
+ fastboot flash root root-lpi4a-20240720_171951.ext4
Monitor the flashing progress in the serial console.
+In serial you can see the image size and the being flashing partition in cmd_parameter: boot, imagesize: 92886476
(In this guide we are flashing the boot image which has a size of 92886476 Bytes)
+
After flashing is complete, disconnect the USB-Type-C cable, connect the power cable, and boot into the system.
+If you can see download device in lsusb
, butfastboot
stuck at < waiting for any device >
you can try run fastboot
with root privilege.
Default credentials for RevyOS:
+RevyOS image directory: Download Link
+Latest image version: 20240819
+Example directory for the 20240819 image:
+ +RevyOS requires flashing both firmware and system files, as listed below:
+firmware_single_sg2042-v6.6-lts-v0p7.bin
(for SPI Flash)firmware_single_sg2042-v6.6-lts-v0p7.img
(for SD card)
System file:
+revyos-pioneer-20240819-154656.img.zst
Firmware files can be stored on either the SPI Flash or an SD card, so the method will vary accordingly.
+Operating System: Ubuntu 22.04
+firmware_single_sg2042-v6.6-lts-v0p7.img
.Insert the SD card into a reader connected to your computer, then verify the device path.
+Navigate to the directory with firmware_single_sg2042-v6.6-lts-v0p7.img
and flash it with the following command:
sudo dd if=firmware_single_sg2042-v6.6-lts-v0p7.img of=/dev/sda bs=4M status=progress
+
+Replace of=/dev/sda
with your specific device path if different.
After flashing, use sync
to ensure data is fully written to the SD card.
Operating System: RevyOS0819
+++Note: For first-time installation, using an SD card to store the firmware is recommended.
+
Flashing to the SPI Flash requires installing utilities and loading the mtd
module.
Install necessary packages:
+bash
+ sudo apt install mtd-utils
+ sudo modprobe mtdblock
Download the firmware file:
+bash
+ wget https://mirror.iscas.ac.cn/revyos/extra/images/sg2042/20240819/firmware_single_sg2042-v6.6-lts-v0p7.bin
Navigate to the directory where firmware_single_sg2042-v6.6-lts-v0p7.bin
was downloaded and run:
bash
+ sudo flashcp -v firmware_single_sg2042-v6.6-lts-v0p7.bin /dev/mtd1
Flashing to SPI Flash is now complete.
+Operating System: Ubuntu 22.04
+Decompress the revyos-pioneer-20240819-154656.img.zst
file using unzstd revyos-pioneer-20240819-154656.img.zst
. This produces the revyos-pioneer-20240819-154656.img
file.
Insert the NVMe SSD into the reader and connect it to your computer, then confirm the device path.
+In the directory containing revyos-pioneer-20240819-154656.img
, flash the image to the NVMe SSD with dd command: sudo dd if=revyos-pioneer-20240819-154656.img of=/dev/nvme0n1 bs=4M status=progress
. Replace of=/dev/nvme0n1
with the correct device path if different.
After flashing, use sync
to ensure the data is fully written to the NVMe SSD.
android-platform-tools
using brew
or an alternative method.Visit the RevyOS mirror site and navigate to the latest dated folder (e.g., 20240720
). Download the following files:
++Note: Ensure the files match your LPI4A hardware configuration, as the 8GB and 16GB models require different U-Boot files.
+
Use brew
to install the tools:
brew install android-platform-tools
+
+Verify fastboot
is available by running:
yuiyuuhayashi@MacBook-Air ~ % fastboot usb 0
+< waiting for any device >
+
+fastboot usb 0
. Ensure the board is properly connected via USB Type-C and powered by 12V.bash
+ fastboot flash uboot <filename>
bash
+ fastboot reboot
++If the board doesn’t reboot, perform a manual power cycle.
+
bash
+ fastboot flash root <filename>
bash
+ fastboot reboot
Once booted, log in with the following credentials:
+Username: debian
+Password: debian
+
+After login, you can use neofetch
or similar tools to verify the system version and other information.
Some GStreamer pipeline command-line examples with omxil library on TH1520, RevyOS
+In this section, the grammer of the gstreamer command-line pipeline and some usefule debug tips are introduced. They have been moved to the end of the article.
+Basically, you neet to install gstreamer1.0-plugins-base
, gstreamer1.0-plugins-good
, gstreamer1.0-plugins-bad
, gstreamer1.0-omx-generic
, gstreamer1.0-omx-bellagio-config
,gstreamer1.0-tools
.
# videotestsrc
+gst-launch-1.0 videotestsrc ! autovideosink
+
+# specify the video stream format
+gst-launch-1.0 videotestsrc ! video/x-raw, format=NV12, width=960, height=540, framerate=60/1 ! autovideosink
+
+# display framerate
+gst-launch-1.0 videotestsrc ! fpsdisplaysink
+
+# no need to sync on the clock - used to test the performance of the pipeline
+gst-launch-1.0 videotestsrc ! fpsdisplaysink sync=false
+
+# stop display on the screen, but redirect the output to stdout
+gst-launch-1.0 videotestsrc ! fpsdisplaysink text-overlay=false -v 2>&1
+
+# specify which sink to use
+gst-launch-1.0 videotestsrc ! fpsdisplaysink sink=glimagesink
+
+# combine the previous examples
+gst-launch-1.0 videotestsrc ! fpsdisplaysink sink=glimagesink sync=false text-overlay=false -v 2>&1
+
+# audiotestsrc
+gst-launch-1.0 audiotestsrc ! autoaudiosink
+
+# change volume (0 to 1)
+gst-launch-1.0 audiotestsrc volume=0.1 ! autoaudiosink
+
+# change waveform
+# could be selected among square, silence, pink-noise, etc.
+gst-launch-1.0 audiotestsrc wave=pink-noise ! autoaudiosink
+
+# set fix frequency, such as "do" (262 Hz)
+gst-launch-1.0 audiotestsrc freq=262 ! autoaudiosink
+
+# a dummy sink that swallows everything
+gst-launch-1.0 videotestsrc ! fakesink
+
+# let decodebin choose which decoder to use,
+# and autovideosink choose which video-sink to use (not recommended)
+gst-launch-1.0 filesrc location=fire.mp4 ! decodebin ! autovideosink
+
+# h264 software decode without opengl display
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux ! h264parse ! avdec_h264 ! xvimagesink
+
+# h264 hardware decode with opengl display
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux ! h264parse ! omxh264dec ! glimagesink
+
+# h265 hardware decode
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux ! h265parse ! omxh265dec ! glimagesink
+
+# vp9 hardware decode
+gst-launch-1.0 filesrc location=fire.webm ! matroskademux ! omxvp9dec ! glimagesink
+
+# mpeg4 hardware decode
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux ! queue ! mpeg4videoparse ! omxmpeg4videodec ! glimagesink
+
+# play mkv/webm file
+gst-launch-1.0 filesrc location=fire.mkv ! matroskademux ! decodebin ! glimagesink
+
+# todo 10-bit h264/h265 decode
+
+# there is no hardware decoder on th1520
+
+# let autoaudiosink choose which audio-sink to use
+gst-launch-1.0 filesrc location=blade.mp3 ! decodebin ! audioconvert ! autoaudiosink
+
+# mp3 decode
+gst-launch-1.0 filesrc location=blade.mp3 ! mpegaudioparse ! avdec_mp3 ! audioconvert ! autoaudiosink
+
+# aac decode
+gst-launch-1.0 filesrc location=blade.aac ! aacparse ! avdec_aac ! audioconvert ! autoaudiosink
+gst-launch-1.0 filesrc location=blade.aac ! aacparse ! faad ! audioconvert ! autoaudiosink
+## faad works well without aacparse
+gst-launch-1.0 filesrc location=blade.aac ! faad ! audioconvert ! autoaudiosink
+
+# opus decode
+## ogg file must be demuxed by oggdemux first
+gst-launch-1.0 filesrc location=blade.ogg ! oggdemux ! opusparse ! opusdec ! audioconvert ! autoaudiosink
+gst-launch-1.0 filesrc location=blade.ogg ! oggdemux ! opusparse ! avdec_opus ! audioconvert ! autoaudiosink
+
+# wav decode
+gst-launch-1.0 filesrc location=test.wav ! wavparse ! audioresample ! audioconvert ! autoaudiosink
+
+# use specific audiosink
+gst-launch-1.0 filesrc location=blade.mp3 ! decodebin ! audioconvert ! pulsesink
+
+# specify the output device by using alsasink with device property
+gst-launch-1.0 filesrc location=blade.mp3 ! decodebin ! audioconvert ! alsasink device=hw:0,2
+
+We play media file in this section.
+# play mp4 file with both audio and video
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux name=demux \
+ demux.video_0 ! queue ! decodebin ! videoconvert ! autovideosink \
+ demux.audio_0 ! queue ! decodebin ! audioconvert ! autoaudiosink
+
+# h264 encode test
+# before import video stream to omxh264dec, data should be transformed to frame with rawvideoparse
+# property and pad of rawvideoparse should be set to the same, so we use 'use-sink-caps=true' here
+gst-launch-1.0 videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=640, height=480 \
+ ! rawvideoparse use-sink-caps=true ! omxh264enc ! fakesink
+
+# h264 hardware encode to file
+## todo: encoded h264 file has seek problem
+gst-launch-1.0 videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=640, height=480 \
+ ! rawvideoparse use-sink-caps=true ! omxh264enc \
+ ! h264parse ! qtmux ! mp4mux ! filesink location=test.mp4
+
+# h264 hardware encode to file with specific bitrate(bit per second)
+gst-launch-1.0 videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=640, height=480 \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc target-bitrate=3000000 \
+ ! h264parse ! filesink location=test.mp4
+
+
+# h265 hardware encode to file
+## this pipeline produces h265 stream only
+## qtdemux is not needed while decoding
+gst-launch-1.0 videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=640, height=480 \
+ ! rawvideoparse use-sink-caps=true ! omxh265enc \
+ ! h265parse ! filesink location=test.h265
+
+# h264 hardware encode from camera to file
+gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert \
+ ! video/x-raw, format=NV12,width=640,height=480 \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc ! h264parse ! filesink location=test.mp4 -e
+
+# There is no hardware audio encoder on th1520
+
+# encode aac stream with adts container(.aac file)
+## the unit of the bitrate is 'bit/sec'
+gst-launch-1.0 audiotestsrc ! voaacenc bitrate=128000 ! avmux_adts ! filesink location=test.aac
+
+
+# todo: encode aac stream with adif container(.m4a file)
+
+# encode to mp3 file
+## the unit of the bitrate is 'kbit/sec'
+gst-launch-1.0 audiotestsrc ! lamemp3enc quality=2 target=bitrate bitrate=192 cbr=true ! id3v2mux ! filesink location=test.mp3
+
+# encode opus stream to .ogg file
+gst-launch-1.0 audiotestsrc ! opusenc ! oggmux ! filesink location=test.opus
+
+
+# todo: encode pcm stream to .wav file
+
+This part has been removed to Video + audio transcode
section.
Since omx...dec
cannot fulfill qtdemux and mp4mux, and gst-omx is no longer maintained, it is hard to mux mp4 file with these two plugins. To mux stream from omxh264dec, use avmux_mp4
instead. But there is no h265 or vp9 muxer available for omx...dec
The raw video stream should be processed by rawvideoparse
before sent to encoder. Because itself cannot scale frame or change framerate, rawvideoparse
need to get the stream info of its sink pad(src pad of the backward element). Therefore use-sink-caps
must be set to true
.
To change width and height, set properties output-width
and output-height
of omx...dec
. To modify bitrate and bitrate control method, set properties control-rate
and target-bitrate
of omx...enc
. To change framerate, set properties of videorate
.
# h265 to h264
+gst-launch-1.0 filesrc location=test_h265.mp4 ! qtdemux ! h265parse ! omxh265dec \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc ! h264parse ! avmux_mp4 ! filesink location=t_h264.mp4
+
+# vp9 to h264
+gst-launch-1.0 filesrc location=test_vp9.webm ! matroskademux ! omxvp9dec \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc ! h264parse ! avmux_mp4 ! filesink location=t_h264.mp4
+
+# arbitrary input to h264
+gst-launch-1.0 filesrc location=test_h264.mp4 ! decodebin \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc ! h264parse ! filesink location=t_h264.mp4
+
+# h264 to h264, with more options
+## set the video width and height to 1280×720, framerate to 15fps, bitrate mode to constant and bitrate to 5Mbps
+gst-launch-1.0 filesrc location=test_h264.mp4 ! qtdemux ! h264parse \
+ ! omxh264dec output-width=1280 output-height=720 \
+ ! videorate ! video/x-raw, framerate=15/1 \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc control-rate=constant target-bitrate=5000000 ! h264parse ! filesink location=t_h264.mp4
+
+## there is no vp9 encoder in th1520 omxil lib
+
+# aac to mp3
+gst-launch-1.0 filesrc location=test.aac ! aacparse ! avdec_aac ! audioconvert ! lamemp3enc quality=2 target=bitrate bitrate=192 cbr=true ! id3v2mux ! filesink location=t.mp3
+
+# mp3 to aac
+gst-launch-1.0 filesrc location=test.mp3 ! mpegaudioparse ! avdec_mp3 ! audioconvert ! voaacenc bitrate=128000 ! avmux_adts ! filesink location=t.aac
+
+# wav to mp3
+gst-launch-1.0 filesrc location=test.wav ! wavparse ! audioresample ! audioconvert ! lamemp3enc quality=2 target=bitrate bitrate=192 cbr=true ! id3v2mux ! filesink location=t.mp3
+
+# mp3 to wav
+gst-launch-1.0 filesrc location=test.mp3 ! mpegaudioparse ! avdec_mp3 ! audioresample ! audioconvert \
+ ! audio/x-raw, rate=44100, format=S16LE ! wavenc ! filesink location=t.wav
+
+# mux test
+gst-launch-1.0 audiotestsrc ! autoaudiosink videotestsrc ! autovideosink
+
+# mux the test video and audio stream to a mp4 file
+## be aware that '-e' must be set to this pipeline,
+## and there is no '!' before audiotestsrc
+gst-launch-1.0 -e videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=960, height=540 \
+ ! rawvideoparse use-sink-caps=true ! omxh264enc ! h264parse \
+ ! avmux_mp4 name=mux ! filesink location=t_h264.mp4 \
+ audiotestsrc ! lamemp3enc ! mux.
+
+# change container from mkv to mp4 with h264 stream
+## this means demux a mkv file then mux video and audio stream to mp4 file
+gst-launch-1.0 filesrc location=test_h264.mkv \
+ ! matroskademux name=demux mp4mux force-create-timecode-trak=true name=mux ! filesink location=t_h264.mp4 \
+ demux.video_0 ! queue ! video/x-h264 ! mux. \
+ demux.audio_0 ! queue ! audio/mpeg ! mux.
+
+You can use command v4l2-ctl
, which is included in package v4l-utils
to get information of your camera.
For more information, read this article
+# h264 hardware encode from camera to file
+gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert \
+ ! video/x-raw, format=NV12,width=640,height=480 \
+ ! rawvideoparse format=nv12 width=640 height=480 \
+ ! omxh264enc ! h264parse ! filesink location=test.mp4 -e
+
+
+# capture camera and stream to other machine
+
+## source
+gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! videorate \
+ ! video/x-raw, format=NV12,width=640,height=480,framerate=20/1 \
+ ! rawvideoparse format=nv12 width=640 height=480 framerate=20/1 \
+ ! omxh264enc ! h264parse config-interval=1 ! video/x-h264,stream-format=byte-stream,alignment=nal \
+ ! rtph264pay ! udpsink host=192.168.31.27 port=5600
+
+## destination
+gst-launch-1.0 udpsrc port=5600 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' \
+ ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink
+
+gst-inspect-1.0
is a tool to print info about a GStreamer element(factory), which is included in gstreamer1.0-tools
.
# print the GStreamer element list with a 'less' like paing filter.
+gst-inspect-1.0
+
+# print info of the element
+gst-inspect-1.0 <element_name>
+
+gst-discover-1.0
is a tool to show info about the media file, which is inclucded in gstreamer1.0-plugins-base-apps
.
gst-discoverer-1.0 -v test.mp4
+
+If you are tired of manually build pipeline for playback by hand. You can use gst-play-1.0
as an alternative, which is included in gstreamer1.0-plugins-base-apps
.
# play media file
+gst-play-1.0 test.mp4
+
+# play media file with specific sink
+gst-play-1.0 --videosink=glimagesink --audiosink=alsasink
+
+Left button and right button can be used to seek. For more info, please read this article.
+To get the cap info or property of an element, you may need to run gst-inspect-1.0 <element_name>
. If gst-inspect-1.0
command not found, install gstreamer1.0-tools
.
If you want to debug GStreamer, refer to the articles below. +https://gstreamer.freedesktop.org/documentation/tutorials/basic/debugging-tools.html +https://gstreamer.freedesktop.org/documentation/gstreamer/running.html?gi-language=c
+Here is a simple command-line pipeline.
+gst-launch-1.0 videotestsrc ! autovideosink
+
+!
represent a link. The established pipeline looks like
videotestsrc => autovideosink
+
+There are several properties in videotestsrc, which could be lookup by gst-inspect-1.0 videotestsrc
.Set some properties:
gst-launch-1.0 videotestsrc pattern=ball flip=true ! autovideosink
+
+NAME=VALUE
is a property. pattern
and flip
are properties of videotestsrc.
Sometimes we need to control the behavior of gst-launch-1.0
.
GST_DEBUG=3 gst-launch-1.0 videotestsrc pattern=ball flip=true ! autovideosink
+gst-launch-1.0 videotestsrc pattern=ball flip=true ! autovideosink --gst-debug-level=3
+
+There are two ways to achieve this goal. One is setting environment variable. Another one is passing command-line argument to gst-launch-1.0
. GST_DEBUG=3
and --gst-debug-level=3
have the same meaning.
In most video decoding cases, there is a video-stream and an audio stream. We need to use demuxer to seperate them. Demuxer usually have several src pad. Here is an example.
+gst-launch-1.0 filesrc location=test-video.mp4 ! qtdemux name=demux demux. ! queue ! h264parse ! omxh264dec ! glimagesink demux. ! queue ! aacparse ! avdec_aac ! audioconvert ! alsasink
+
+It is hard to read. Add some word wrap:
+gst-launch-1.0 filesrc location=test-video.mp4 ! qtdemux name=demux \
+ demux. ! queue ! h264parse ! omxh264dec ! glimagesink \
+ demux. ! queue ! aacparse ! avdec_aac ! audioconvert ! pulsesink
+
+Here we use a demuxer to seperate video and audio, the grammer is:
+... demuxer name=DEMUXER_NAME \
+DEMUXER_NAME.PIPELINE_NAME_1 ! queue ! ...(the remaining part of pipeline 1) \
+DEMUXER_NAME.PIPELINE_NAME_2 ! queue ! ...(the remaining part of pipeline 2)
+
+Sometimes we need to set certain properties of the stream at certain nodes in the pipeline, e.g set resolution of the videostream of the videotestsrc
.
gst-launch-1.0 videotestsrc ! video/x-raw, width=800, height=600 ! glimagesink
+
+We negotiated the pad properties between videotestsrc
and glimagesink
. The property names and values must be supported by both element. You can find them in Pad Templates
section of gst-inspect-1.0
.
Applicable SDK v1.1.2
+PTG's OpenMAX IL library (vpu-omxil
) enables the LicheePi 4A to smoothly perform hardware decoding for 4K 60fps video playback. This document details the integration and usage of the Parole player on the LicheePi 4A development board, providing a guide to the adaptation process on this platform. The workflow for hardware decoding, using H.264 as an example, is shown below.
+-------------------------------------------+
+ | +------------+ +------------+ | +--------+
+video stream----+--->| omxh264dec +------>| video-sink +----+-->| player |
+ | +------+-----+ +------------+ | +--------+
+ | | GStreamer |
+ +-----------+-------------------------------+
+ |
+ +-----v-----+
+ | vpu-omxil |
+ +-----+-----+
+ |
+ |
+ +-------v-------+
+ | kernel module |
+ | (driver) |
+ +-------+-------+
+ |
+ v
+ hardware
+
+omxh264dec
decoder in GStreamer.omxh264dec
invokes PTG's vpu-omxil
library, which accesses the hardware through the driver (kernel module) for hardware decoding.To isolate the omxh264dec
decoding component, the general structure is as follows:
+---+------------+----+
+ | +------------+ |
+ | | omxh264dec | |
+ | +------------+ |
+ | GStreamer |
+ +----------+----------+
+ |
+ +----+-----v-----+----+
+ | +-----------+ |
+ | | vpu-omxil | |
+ | +-----------+ |
+ | libomxil-bellagio |
+ +----------+----------+
+ |
++------------v------------+
+| - memalloc - vc8000 |
+| - hantrodec - vidmem |
+| kernel modules |
++------------+------------+
+ |
+ v
+ hardware
+
+This section focuses on enabling the omxh264dec
decoder, without involving screen output.
To enable hardware decoding, drivers must be compiled and installed to access the hardware.
+PTG-provided driver sources:
+ +The revyos/thead-kernel has merged the above modules, so you may avoid compiling these if using revyos_defconfig
.
# Use depmod to analyze dependencies and create modules.dep in /lib/modules/<kernel-version>.
+sudo depmod -a
+sudo modprobe vidmem vc8000 hantrodec memalloc
+
+# If modprobe fails, try using insmod
+# cd /usr/lib/modules/$(uname -r)
+# sudo insmod $(find . -name *vidmem.ko*)
+# sudo insmod $(find . -name *vc8000.ko*)
+# sudo insmod $(find . -name *hantrodec.ko*)
+# sudo insmod $(find . -name *memalloc.ko*)
+
+# Optional: Load modules at boot
+echo -e "\nvidmem\nhantrodec\nmemalloc\nvc8000\n" | sudo tee -a /etc/modules > /dev/null
+
+After installing kernel modules, device files for hantrodec
, vidmem
, and vc8000
will appear in /dev
. By default, users lack access permissions, so non-root users will encounter errors when opening the omxil library.
# For one-time effect
+cd /dev
+sudo chmod 666 hantrodec vidmem vc8000
+
+# For persistent effect
+cat << EOF | sudo tee /lib/udev/rules.d/70-hantro.rules > /dev/null
+KERNEL=="vidmem", MODE="0666"
+KERNEL=="hantrodec", MODE="0666"
+KERNEL=="vc8000", MODE="0666"
+EOF
+
+For RevyOS-specific kernel modules, go to revyos/thead-kernel and download artifacts from GitHub CI.
+vpu-omxil
and Adjust ConfigurationFirst, download and extract vpu-omxil
to /usr/lib/omxil/
.
+Download vpu-omxil_1.2.1.tar.gz
As illustrated below, the following steps are required:
+vpu-omxil
with libomxil-bellagio
.gst-omx
(which provides the omxh264dec
decoder) to recognize the component names when calling libomxil-bellagio
.+---------+ +-------------------+ +-----------+
+| gst-omx +-->| libomxil-bellagio +-->| vpu-omxil |
++---------+ +-------------------+ +-----------+
+
+vpu-omxil
with libomxil-bellagio
sudo apt install libomxil-bellagio-bin libomxil-bellagio0
+# Register components
+omxregister-bellagio -v /usr/lib/omxil/
+
+The registration file is generated by omxregister-bellagio
and, by default, is located at ~/.omxregister
.
th1520-vpu utilizes Debian’s automatic registration process in /usr/lib/riscv64-linux-gnu/libomxil-bellagio0
upon installation. The resulting registry appears as follows:
cat /var/lib/libomxil-bellagio0/registry
+/usr/lib/riscv64-linux-gnu/libomxil-bellagio0/libOMX.hantro.H2.video.encoder.so
+ ==> OMX.hantro.H2.video.encoder ==> OMX.hantro.H2.video.encoder.avc:OMX.hantro.H2.video.encoder.hevc:
+/usr/lib/riscv64-linux-gnu/libomxil-bellagio0/libOMX.hantro.VC8000D.image.decoder.so
+ ==> OMX.hantro.VC8000D.image.decoder ==> OMX.hantro.VC8000D.image.decoder.jpeg:
+/usr/lib/riscv64-linux-gnu/libomxil-bellagio0/libOMX.hantro.H2.image.encoder.so
+ ==> OMX.hantro.H2.image.encoder ==> OMX.hantro.H2.image.encoder.jpeg:
+/usr/lib/riscv64-linux-gnu/libomxil-bellagio0/libOMX.hantro.VC8000D.video.decoder.so
+ ==> OMX.hantro.VC8000D.video.decoder ==> OMX.hantro.VC8000D.video.decoder.mpeg4:OMX.hantro.VC8000D.video.decoder.avc:OMX.hantro.VC8000D.video.decoder.avs:OMX.hantro.VC8000D.video.decoder.h263:OMX.hantro.VC8000D.video.decoder.wmv:OMX.hantro.VC8000D.video.decoder.vp6:OMX.hantro.VC8000D.video.decoder.vp8:OMX.hantro.VC8000D.video.decoder.jpeg:OMX.hantro.VC8000D.video.decoder.hevc:OMX.hantro.VC8000D.video.decoder.vp9:OMX.hantro.VC8000D.video.decoder.avs2:
+
+gstomx.conf
Adjust the gstomx.conf
settings to ensure the omxh264dec
decoder calls the correct components. See the following patch for gst-omx
configuration details:
gst-omx-01-add-libomxil-config.patch
+dmabuf
PatchPlease refer to the dmabuf
patch for gst-omx
provided by PTG:
gst-omx-02-set-dec-out-port-dmabuf.patch
+sudo apt install gstreamer1.0-omx-generic gstreamer1.0-omx-bellagio-config gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-gl gstreamer1.0-plugins-good gstreamer1.0-tools
+
+# 1. Basic decoding
+gst-launch-1.0 filesrc location=<test.mp4> ! qtdemux ! h264parse ! omxh264dec ! videoconvert ! fakesink sync=false
+# 2. Display FPS in the terminal
+# Reference: https://stackoverflow.com/questions/73948308
+gst-launch-1.0 filesrc location=<test.mp4> ! qtdemux ! h264parse ! omxh264dec ! videoconvert ! fpsdisplaysink video-sink=fakesink text-overlay=false sync=false -v 2>&1
+
+fakesink
discards all incoming video frames, bypassing the video-sink
rendering stage to avoid performance loss, while fpsdisplaysink
provides decoding speed statistics. Sample log output:
Setting pipeline to PAUSED ...[DBGT]
+vc8kdec compiled without trace support (ENABLE_DBGT_TRACE switch not enabled)
+Pipeline is PREROLLING ...
+Redistribute latency...
+OMX ! decoder_get_parameter OMX_ErrorNoMore (2)
+Pipeline is PREROLLED ...
+Setting pipeline to PLAYING ...
+New clock: GstSystemClockRedistribute latency...
+0:01:39.5 / 0:01:49.4 (90.9 %)
+
+Tip: If encountering errors such as [omxh264dec-omxh264dec0: Could not initialize supporting library.](https://gist.github.com/Sakura286/015fae6792e160268db7ad8a697dd2df)
, consider installing the debug-symbol packages for gst-omx
, libomxil-bellagio
, and libc6
. Use gdb
to troubleshoot by running the command above, setting a breakpoint at DWLInit
and open
to pinpoint where the issue arises.
During the RevyOS adaptation process, the following issues were identified as causes for dynamic library initialization failures:
+vpu-omxil
.vpu-omxil
registration with omxregister-bellagio
./dev
devices hantrodec
, vc8000
, and vidmem
.video-sink
The video-sink
is the last step in the GStreamer pipeline, handling the final output of the video stream to the screen.
+In the tests above, fakesink
served as a testing video-sink
to verify decoder functionality. There are, however, many video-sink
options available (see list), such as autovideosink
, ximagesink
, xvimagesink
, fbdevsink
, waylandsink
, glimagesink
, gtkglsink
, each requiring specific installation packages as follows:
video-sink | +Package | +
---|---|
waylandsink | +gstreamer1.0-plugins-bad | +
fbdevsink | +gstreamer1.0-plugins-bad | +
autovideosink | +gstreamer1.0-plugins-good | +
gtkglsink | +gstreamer1.0-plugins-good | +
ximagesink | xvimagesink | +gstreamer1.0-plugins-base | +
glimagesink | +gstreamer1.0-plugins-base | gstreamer1.0-gl | +
Tip: Use gst-inspect-1.0 <video-sink-name>
to view available options for each video-sink
.
+Tip: Adjust --gst-debug-level=<lv>
to set the debug log level, where <lv>
ranges from 1 to 6, with higher levels providing more verbose output. Setting the level below 4 is recommended, as higher levels can result in very long logs.
+Experiment with different video-sink
options, plugin parameters, and environmental variables until you find one that enables smooth H.264 hardware decoding.
waylandsink
is inherently unusable.playbin
or autovideosink
automatically calls xvimagesink
. After analyzing with perf
, it’s evident that xvimagesink
involves significant memcpy
operations, severely impacting decoding performance. This issue persists even with the PTG-provided dmabuf
patch, so it’s not a viable option.The only remaining option is glimagesink
. Based on Running and debugging GStreamer Applications and examples that use glimagesink
, it appears necessary to specify the environment variables GST_GL_API
and GST_GL_PLATFORM
. Since RevyOS uses a gles2
+ egl
setup, the following command enables successful hardware decoding:
GST_GL_API=gles2 GST_GL_PLATFORM=egl gst-launch-1.0 filesrc location=<test.mp4> ! qtdemux ! h264parse ! omxh264dec ! videoconvert ! fpsdisplaysink video-sink=glimagesink sync=false
+
+However, these parameters cannot be passed as environment variables when GStreamer is invoked by a media player. Therefore, it’s essential to pass additional meson
build options when compiling gst-plugins-base
:
-Dgl_api=[\'gles2\'] -Dgl_platform=[\'egl\']
+
+Once the GStreamer pipeline functions correctly, the next step is to enable player support. Different players utilize different video-sink
elements and have varying levels of dependency on GStreamer. The adaptation strategy for players is to either (1) modify the player to support the verified video-sink
or (2) modify the GStreamer pipeline to support the player’s specified video-sink
. The RevyOS adaptation process adopts the first approach.
+-------------------------------------------+
+ | +------------+ +------------+ | +--------+
+video stream----+--->| omxh264dec +------>| video-sink +----+-->| player |
+ | +------------+ +------------+ | +--------+
+ | GStreamer |
+ +-------------------------------------------+
+
+Based on the GStreamer-supported applications list:
+Usable | +Updated | +Application | +Notes | +
---|---|---|---|
❌ | ++ | Gnash | +Flash Player | +
❌ | ++ | GEntrans | +Not in Debian | +
❓ | +20230226 | +Kaffeine | +❌ Requires extensive KDE dependencies | +
+ | + | + | ✔️ Present in the riscv64 repository | +
+ | + | + | ❌ On Debian amd64 Gnome, the playback and control windows are separated, with VLC as the default player. | +
❌ | ++ | Lcdgrilo | +Not in Debian | +
✔️ | +20230218 | +Parole | +✔️ For XFCE | +
+ | + | + | ❓ No Wayland support, X11 only | +
+ | + | + | ✔️ Verified on Debian amd64 Gnome | +
+ | + | + | ✔️ Available in the riscv64 repository | +
❌ | ++ | Songbird | +Not in Debian | +
❌ | ++ | Snappy | +Not in Debian | +
❌ | ++ | Totem | +Requires GTK3, which doesn’t support EGL on X11 | +
Totem was initially chosen but proved difficult to support due to its inability to specify a video-sink
other than gtkglsink
, which RevyOS does not support. After evaluating GStreamer-compatible players, Parole emerged as a suitable choice. Parole, written with GObject, requires modification in the parole_gst_constructed
method to set video-sink
to glimagesink
, as previously validated. The patch can be found here:
parole-01-add-glimagesink-support.patch
+With this, the preliminary adaptation work is complete.
+omxil
binary dynamic library files as th1520-vpu
.th1520-vpu
dependencies to require gst-omx
, libomxil-bellagio
, etc.omxregister-bellagio
.gst-omx
:vpu-omxil
component in the config.dmabuf
patches.gst-base
to limit GL support to gles2
+ egl
during compilation.glimagesink
.Patch collection:
+https://gist.github.com/Sakura286/26777ea8204c1819885e093806a4f7ca
+PTG omxil library:
+https://drive.google.com/file/d/1pYgCVI7WltfpskltJ-RqzVUCEC21FS56
+ + + + + + +Test website: https://webglsamples.org/aquarium/aquarium.html
+Simply open the link. The number on the left indicates the number of fish being rendered; the more fish, the more it impacts performance.
+ + + + + + + +CoreMark is a comprehensive benchmark designed to measure CPU performance in embedded systems. Developed in 2009 by Shay Gal-On of EEMBC, it aims to be an industry standard, replacing the outdated Dhrystone benchmark. The code, written in C, includes the following algorithms: list processing (insert, delete, find, and sort), matrix operations (common matrix functions), state machines (checking if an input stream contains valid numbers), and CRC. Users can freely download CoreMark, port it to their platform, and obtain performance scores.
+├── barebones -- Directory for modifications when porting to a bare-metal environment
+│ ├── core_portme.c -- Target platform configuration information for porting
+│ ├── core_portme.h -- Timer and board initialization implementation
+│ ├── core_portme.mak -- Makefile for this subdirectory
+│ ├── cvt.c
+│ └── ee_printf.c -- Serial implementation of print function
+├── core_list_join.c -- List operation program
+├── core_main.c -- Main program
+├── coremark.h -- Header file with project configuration and data structure definitions
+├── coremark.md5
+├── core_matrix.c -- Matrix operations program
+├── core_state.c -- State machine control program
+├── core_util.c -- CRC calculation program
+├── cygwin -- Test code for x86 Cygwin and GCC 3.4 (quad-core, dual-core, and single-core systems)
+│ ├── core_portme.c
+│ ├── core_portme.h
+│ └── core_portme.mak
+├── freebsd -- Similarly, test code for various OS platforms
+│ ├── ...
+├── LICENSE.md
+├── linux
+│ ├── ...
+├── linux64
+│ ├── ...
+├── macos
+│ ├── ...
+├── Makefile
+├── README.md -- Readme file with basic introduction to the CoreMark project
+├── rtems
+│ ├── ...
+└── simple
+ ├── ...
+ └──
+
+run
- Default target, generates run1.log
and run2.log
run1.log
- Runs the benchmark with performance parameters and outputs to run1.log
run2.log
- Runs the benchmark with validation parameters and outputs to run2.log
run3.log
- Runs the benchmark with config file-generated parameters and outputs to run3.log
compile
- Compiles the benchmark executablelink
- Links the benchmark executablecheck
- Tests the MD5 of unmodified source filesclean
- Cleans temporary filesAccording to the README, simply executing make
in the coremark folder compiles and runs the tests. The results appear in the Results folder, with run1.log
containing the performance results.
CoreMark tests are generally short. Plan to run 10 tests concurrently and take the average score.
+$ git clone https://github.com/eembc/coremark.git
+$ cd coremark
+$ make
+
+2K performance run parameters for coremark.
+CoreMark Size : 666
+Total ticks : 12915
+Total time (secs): 12.915000
+Iterations/Sec : 8517.228029
+Iterations : 110000
+Compiler version : GCC13.1.0
+Compiler flags : -O2 -DPERFORMANCE_RUN=1 -lrt
+Memory location : Please put data memory location here
+ (e.g. code in flash, data on heap etc)
+seedcrc : 0xe9f5
+[0]crclist : 0xe714
+[0]crcmatrix : 0x1fd7
+[0]crcstate : 0x8e3a
+[0]crcfinal : 0x33ff
+Correct operation validated. See README.md for run and reporting rules.
+CoreMark 1.0 : 8517.228029 / GCC13.1.0 -O2 -DPERFORMANCE_RUN=1 -lrt / Heap
+
+make XCFLAGS="-march=rv64gv0p7_zfh_xtheadc -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -msignedness-cmpiv -fno-code-hoisting -mno-thread-jumps1 -mno-iv-adjust-addr-cost -mno-expand-split-imm"
+
+2K performance run parameters for coremark.
+CoreMark Size : 666
+Total ticks : 15129
+Total time (secs): 15.129000
+Iterations/Sec : 13219.644392
+Iterations : 200000
+Compiler version : GCC10.4.0
+Compiler flags : -O2 -march=rv64gv0p7_zfh_xtheadc -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -msignedness-cmpiv -fno-code-hoisting -mno-thread-jumps1 -mno-iv-adjust-addr-cost -mno-expand-split-imm -DPERFORMANCE_RUN=1 -lrt
+Memory location : Please put data memory location here
+ (e.g. code in flash, data on heap etc)
+seedcrc : 0xe9f5
+[0]crclist : 0xe714
+[0]crcmatrix : 0x1fd7
+[0]crcstate : 0x8e3a
+[0]crcfinal : 0x4983
+Correct operation validated. See README.md for run and reporting rules.
+CoreMark 1.0 : 13219.644392 / GCC10.4.0 -O2 -march=rv64gv0p7_zfh_xtheadc -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -msignedness-cmpiv -fno-code-hoisting -mno-thread-jumps1 -mno-iv-adjust-addr-cost -mno-expand-split-imm -DPERFORMANCE_RUN=1 -lrt / Heap
+
+make XCFLAGS="-march=rv64imafd_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -fno-code-hoisting -mno-thread-jumps"
+
+2K performance run parameters for coremark.
+CoreMark Size : 666
+Total ticks : 11897
+Total time (secs): 11.897000
+Iterations/Sec : 9246.028411
+Iterations : 110000
+Compiler version : GCC13.1.0
+Compiler flags : -O2 -march=rv64imafd_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -fno-code-hoisting -DPERFORMANCE_RUN=1 -lrt
+Memory location : Please put data memory location here
+ (e.g. code in flash, data on heap etc)
+seedcrc : 0xe9f5
+[0]crclist : 0xe714
+[0]crcmatrix : 0x1fd7
+[0]crcstate : 0x8e3a
+[0]crcfinal : 0x33ff
+Correct operation validated. See README.md for run and reporting rules.
+CoreMark 1.0 : 9246.028411 / GCC13.1.0 -O2 -march=rv64imafd_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -fno-code-hoisting -DPERFORMANCE_RUN=1 -lrt / Heap
+
+
+
+
+
+
+
+ glmark2 is an OpenGL 2.0 and ES 2.0 benchmark. +We will only use glmark2-es2 for relevant tests here . This is a testing tool for x11-glesv2.
+This software package is already pre-installed in the system.
+th1520
only support glmark-es2.
If you need perfect performance, put your device into performance mode before you start, here's how to do it.
+Please execute the following commands in the terminal. This command requires a root account or sudo
.
echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
+
+cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq
+
+After the execution is completed, you will see a series of numbers, such as "1848000".
+Open a terminal and enter glmark2-es2
. This test allows the use of non-root accounts.
After entering the command, a new window will appear on your desktop with an active screen.
+Need to connect HDMI to the monitor, do not execute the command through SSH connection.
+After the test is completed, the additional activity screen will disappear and the score will be output in the terminal in the form of glmark2 Score: xxx
.
For example:
+debian@lpi4a:~/Desktop$ glmark2-es2
+=======================================================
+ glmark2 2021.12
+=======================================================
+ OpenGL Information
+ GL_VENDOR: Imagination Technologies
+ GL_RENDERER: PowerVR B-Series BXM-4-64
+ GL_VERSION: OpenGL ES 3.2 build 1.17@6210866
+ Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=8
+ Surface Size: 800x600 windowed
+=======================================================
+[build] use-vbo=false: FPS: 513 FrameTime: 1.949 ms
+[build] use-vbo=true: FPS: 1367 FrameTime: 0.732 ms
+[texture] texture-filter=nearest: FPS: 1449 FrameTime: 0.690 ms
+[texture] texture-filter=linear: FPS: 1454 FrameTime: 0.688 ms
+[texture] texture-filter=mipmap: FPS: 1453 FrameTime: 0.688 ms
+[shading] shading=gouraud: FPS: 1172 FrameTime: 0.853 ms
+[shading] shading=blinn-phong-inf: FPS: 1180 FrameTime: 0.847 ms
+[shading] shading=phong: FPS: 1002 FrameTime: 0.998 ms
+[shading] shading=cel: FPS: 979 FrameTime: 1.021 ms
+[bump] bump-render=high-poly: FPS: 700 FrameTime: 1.429 ms
+[bump] bump-render=normals: FPS: 1354 FrameTime: 0.739 ms
+[bump] bump-render=height: FPS: 1320 FrameTime: 0.758 ms
+[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 1059 FrameTime: 0.944 ms
+[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 381 FrameTime: 2.625 ms
+[pulsar] light=false:quads=5:texture=false: FPS: 1484 FrameTime: 0.674 ms
+[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 349 FrameTime: 2.865 ms
+[desktop] effect=shadow:windows=4: FPS: 736 FrameTime: 1.359 ms
+[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 161 FrameTime: 6.211 ms
+[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 173 FrameTime: 5.780 ms
+[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 242 FrameTime: 4.132 ms
+[ideas] speed=duration: FPS: 593 FrameTime: 1.686 ms
+[jellyfish] <default>: FPS: 572 FrameTime: 1.748 ms
+[terrain] <default>: FPS: 42 FrameTime: 23.810 ms
+[shadow] <default>: FPS: 619 FrameTime: 1.616 ms
+[refract] <default>: FPS: 82 FrameTime: 12.195 ms
+[conditionals] fragment-steps=0:vertex-steps=0: FPS: 1539 FrameTime: 0.650 ms
+[conditionals] fragment-steps=5:vertex-steps=0: FPS: 1238 FrameTime: 0.808 ms
+[conditionals] fragment-steps=0:vertex-steps=5: FPS: 1535 FrameTime: 0.651 ms
+[function] fragment-complexity=low:fragment-steps=5: FPS: 1411 FrameTime: 0.709 ms
+[function] fragment-complexity=medium:fragment-steps=5: FPS: 1050 FrameTime: 0.952 ms
+[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 1376 FrameTime: 0.727 ms
+[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 1394 FrameTime: 0.717 ms
+[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 1379 FrameTime: 0.725 ms
+=======================================================
+ glmark2 Score: 950
+=======================================================
+
+
+
+
+
+
+
+
+ ++lmbench for RevyOS
+
Bandwidth Measurement Tool | +Latency Measurement Tool | +Others | +
---|---|---|
Read Cache File | +Context Switching | +\ | +
Copy Memory | +Network: Connection Establishment, Pipe, TCP, UDP, and RPC Hot Potato | +\ | +
Read Memory | +File System Creation and Deletion | +\ | +
Write Memory | +Process Creation | +Processor Clock Rate Calculation | +
Pipe | +Signal Handling | +\ | +
TCP | +Upper-Level System Calls | +\ | +
\ | +Memory Read Latency | +\ | +
Download the testing tool:
+git clone https://github.com/revyos/lmbench3.git
+
+++This version has been ported for RevyOS.
+
Before starting the tests, you need to install the dependencies:
+sudo apt install gcc make libntirpc-dev -y
+
+Execute the commands to compile, configure, and test:
+cd lmbench3
+cd src
+make results
+
+After compilation, the following options will prompt you to set:
+The options that do not require changes can be left blank to automatically set default values.
+MULTIPLE COPIES [default 1]
: Sets the number of concurrent instances of lmbench to run. Running more instances may slow down lmbench. The default is 1, so set it to the default value of 1.
=====================================================================
+
+If you are running on an MP machine and you want to try running
+multiple copies of lmbench in parallel, you can specify how many here.
+
+Using this option will make the benchmark run 100x slower (sorry).
+
+NOTE: WARNING! This feature is experimental and many results are
+ known to be incorrect or random!
+
+MULTIPLE COPIES [default 1]:
+=====================================================================
+
+Job placement selection [default 1]
: Controls job scheduling methods. The default is 1, which allows job scheduling, so set it to the default value.
=====================================================================
+
+Options to control job placement
+1) Allow scheduler to place jobs
+2) Assign each benchmark process with any attendant child processes
+ to its own processor
+3) Assign each benchmark process with any attendant child processes
+ to its own processor, except that it will be as far as possible
+ from other processes
+4) Assign each benchmark and attendant processes to their own
+ processors
+5) Assign each benchmark and attendant processes to their own
+ processors, except that they will be as far as possible from
+ each other and other processes
+6) Custom placement: you assign each benchmark process with attendant
+ child processes to processors
+7) Custom placement: you assign each benchmark and attendant
+ processes to processors
+
+Note: some benchmarks, such as bw_pipe, create attendant child
+processes for each benchmark process. For example, bw_pipe
+needs a second process to send data down the pipe to be read
+by the benchmark process. If you have three copies of the
+benchmark process running, then you actually have six processes;
+three attendant child processes sending data down the pipes and
+three benchmark processes reading data and doing the measurements.
+
+Job placement selection [default 1]:
+=====================================================================
+
+Memory
: Sets the test memory size. The default is $MB
, which is the maximum testable memory calculated by the program, or you can manually define the test value. Here, we will use the default value.
=====================================================================
+
+Several benchmarks operate on a range of memory. This memory should be
+sized such that it is at least 4 times as big as the external cache[s]
+on your system. It should be no more than 80% of your physical memory.
+
+The bigger the range, the more accurate the results, but larger sizes
+take somewhat longer to run the benchmark.
+
+MB [default 686]:
+Checking to see if you have 686 MB; please wait for a moment...
+686MB OK
+686MB OK
+686MB OK
+Hang on, we are calculating your cache line size.
+OK, it looks like your cache line is 64 bytes.
+
+=====================================================================
+
+SUBSET (ALL|HARDWARE|OS|DEVELOPMENT) [default all]
: Selects the test set, which includes ALL/HARDWARE/OS/DEVELOPMENT
. The default is all
, so we will select all
.
=====================================================================
+
+lmbench measures a wide variety of system performance, and the full suite
+of benchmarks can take a long time on some platforms. Consequently, we
+offer the capability to run only predefined subsets of benchmarks, one
+for operating system-specific benchmarks and one for hardware-specific
+benchmarks. We also offer the option of running only selected benchmarks,
+which is useful during operating system development.
+
+Please remember that if you intend to publish the results you either need
+to do a full run or one of the predefined OS or hardware subsets.
+
+SUBSET (ALL|HARDWARE|OS|DEVELOPMENT) [default all]:
+=====================================================================
+
+FASTMEM [default no]
: Memory latency test. If you want to skip this test, set it to yes
. If you do not want to skip it, set it to no
. The default is no
, so we will keep the default value.
=====================================================================
+
+This benchmark measures, by default, memory latency for a number of
+different strides. That can take a long time and is most useful if you
+are trying to figure out your cache line size or if your cache line size
+is greater than 128 bytes.
+
+If you are planning on sending in these results, please don't do a fast
+run.
+
+Answering yes means that we measure memory latency with a 128-byte stride.
+
+FASTMEM [default no]:
+=====================================================================
+
+SLOWFS [default no]
: File system latency test. If you want to skip this test, set it to yes
. If you do not want to skip it, set it to no
. The default is no
, so we will keep the default value.
=====================================================================
+
+This benchmark measures, by default, file system latency. That can
+take a long time on systems with old-style file systems (i.e., UFS,
+FFS, etc.). Linux' ext2fs and Sun's tmpfs are fast enough that this
+test is not painful.
+
+If you are planning on sending in these results, please don't do a fast
+run.
+
+If you want to skip the file system latency tests, answer "yes" below.
+
+SLOWFS [default no]:
+=====================================================================
+
+DISKS [default none]
: Disk bandwidth and seek time. You need to specify the disk device path, such as /dev/sda
. By default, it does not test (default is none), so we will keep the default value.
=====================================================================
+
+This benchmark can measure disk zone bandwidths and seek times. These can
+be turned into whizzy graphs that pretty much tell you everything you might
+need to know about the performance of your disk.
+
+This takes a while and requires read access to a disk drive.
+Write is not measured, see disk.c to see how if you want to do so.
+
+If you want to skip the disk tests, hit return below.
+
+If you want to include disk tests, then specify the path to the disk
+device, such as /dev/sda. For each disk that is readable, you'll be
+prompted for a one-line description of the drive, i.e.,
+
+ Iomega IDE ZIP
+or
+ HP C3725S 2GB on 10MB/sec NCR SCSI bus
+
+DISKS [default none]:
+=====================================================================
+
+REMOTE [default none]
: Network testing requires two machines and rsh
access. This tests whether the testing machine can rsh
into another machine. By default, it does not test (default is none), so we will keep the default value.
=====================================================================
+
+If you are running on an idle network and there are other, identically
+configured systems, on the same wire (no gateway between you and them),
+and you have rsh access to them, then you should run the network part
+of the benchmarks to them. Please specify any such systems as a space
+separated list such as: ether-host fddi-host hippi-host.
+
+REMOTE [default none]:
+=====================================================================
+
+Processor mhz [default 999 MHz, 1.0010 nanosec clock]
: Tests the CPU frequency. The default is $MHZ
, which is the frequency determined by the program. You can also specify it based on your situation, e.g., 3500, in MHz. Here, we will keep the default value.
=====================================================================
+
+Calculating mhz, please wait for a moment...
+I think your CPU mhz is
+
+ 999 MHz, 1.0010 nanosec clock
+
+but I am frequently wrong. If that is the wrong Mhz, type in your
+best guess as to your processor speed. It doesn't have to be exact,
+but if you know it is around 800, say 800.
+
+Please note that some processors, such as the P4, have a core which
+is double-clocked, so on those processors the reported clock speed
+will be roughly double the advertised clock rate. For example, a
+1.8GHz P4 may be reported as a 3592MHz processor.
+
+Processor mhz [default 999 MHz, 1.0010 nanosec clock]:
+=====================================================================
+
+FSDIR [default /usr/tmp]
: A temporary directory to store test files. You can set your own value; the default is `/usr
/tmp`, so we will keep the default value.
+=====================================================================
+
+We need a place to store a 686 Mbyte file as well as create and delete a
+large number of small files. We default to /usr/tmp. If /usr/tmp is a
+memory-resident file system (i.e., tmpfs), pick a different place.
+Please specify a directory that has enough space and is a local file
+system.
+
+FSDIR [default /usr/tmp]:
+=====================================================================
+
+Status output file [default /dev/tty]
: The directory to store test output information. You can set your own value; the default is /dev/tty
, so we will keep the default value.
=====================================================================
+
+lmbench outputs status information as it runs various benchmarks.
+By default, this output is sent to /dev/tty, but you may redirect
+it to any file you wish (such as /dev/null...).
+
+Status output file [default /dev/tty]:
+=====================================================================
+
+Mail results [default yes]
: Whether to email the test results. The default is yes
, so we will set it to no
.
=====================================================================
+
+There is a database of benchmark results that is shipped with new
+releases of lmbench. Your results can be included in the database
+if you wish. The more results the better, especially if they include
+remote networking. If your results are interesting, i.e., for a new
+fast box, they may be made available on the lmbench web page, which is
+
+ http://www.bitmover.com/lmbench
+
+Mail results [default yes]: no
+OK, no results mailed.
+=====================================================================
+
+After completing the above settings, the tests will start automatically.
+p7zip test is used to evaluate the decompression performance of the system, visually assess performance through data. The following are the steps to run the 7zip test.
+First, you need to install p7zip in RevyOS.
+debian@lpi4a:~/Desktop$ sudo apt update
+debian@lpi4a:~/Desktop$ sudo apt install p7zip-full
+
+To conduct the p7zip test, enter the following command in the terminal to execute:
+debian@lpi4a:~/Desktop$ 7z b
+
+The system will begin testing and then output performance data.
+By following these steps, you can install and test the performance of 7zip on RevyOS.
+The following are reference test results, using the image version RevyOS20231210 16g version.
+debian@lpi4a:~/Desktop$ 7z b
+
+7-Zip 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
+p7zip Version 16.02 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs LE)
+
+LE
+CPU Freq: - 64000000 64000000 - - - - - -
+
+RAM size: 15739 MB, # CPU hardware threads: 4
+RAM usage: 882 MB, # Benchmark threads: 4
+
+ Compressing | Decompressing
+Dict Speed Usage R/U Rating | Speed Usage R/U Rating
+ KiB/s % MIPS MIPS | KiB/s % MIPS MIPS
+
+22: 3252 303 1045 3164 | 75268 394 1628 6422
+23: 3092 307 1025 3151 | 74514 399 1617 6447
+24: 3021 318 1022 3249 | 72017 398 1588 6322
+25: 2945 320 1050 3363 | 67801 395 1529 6034
+---------------------------------- | ------------------------------
+Avr: 312 1036 3232 | 396 1591 6306
+Tot: 354 1313 4769
+
+
+
+
+
+
+
+ Perform a restart test on the entire machine using a script.
+Check if there are any issues such as freezing when the test machine is restarted.
+Conduct restart tests 500 times.
+Create a restart script named cycletest.service_ in /lib/system/system:
+[Unit]
+Description=Reboots unit after 30s
+
+[Service]
+StandardOutput=syslog+console
+ExecStart=/bin/sh -c "\
+test -f /cycle-count || echo 0 > /cycle-count;\
+echo 'starting cycletest';\
+sleep 30;\
+expr `cat /cycle-count` + 1 > /cycle-count;\
+systemctl reboot;\
+"
+
+[Install]
+WantedBy=multi-user.target
+
+Then install and start the test with the following commands:
+systemctl daemon-reload
+systemctl enable cycletest.service (enable the service to start on reboot)
+systemctl start cycletest.service (start the service, should reboot in 30s)
+
+
+
+
+
+
+
+ The STREAM benchmark is a simple synthetic benchmark program that measures sustainable memory bandwidth (in MB/s) and the corresponding computation rate for simple vector kernels.
+The stream consists of a single file, and to perform the test, you only need to compile stream.c
:
git clone <https://github.com/microseyuyu/STREAM.git>
+cd STREAM
+gcc -O3 -fopenmp -DN=2000000 -DNTIMES=10 stream.c -o stream
+export OMP_NUM_THREADS=8
+./stream
+
+Parameter descriptions:
+DN=2000000: Specifies the size of the test arrays a[], b[], and c[] (Array size). This value has a significant impact on the test results (the default value for version 5.9 is 2000000. If stream.c is version 5.10, the parameter name changes to -DSTREAM_ARRAY_SIZE, with a default value of 10000000). Note: the size of the test array must be set much larger than the size of the CPU's highest-level cache (usually L3 Cache), otherwise it tests the throughput performance of the CPU cache, rather than the memory throughput performance. +- -DNTIMES=10: The number of repetitions, from which the optimal value is selected. +- OMP_NUM_THREADS=8: Number of threads.
+Sample results:
+debian@lpi4a:~/Desktop/STREAM$ ./stream
+-------------------------------------------------------------
+STREAM version $Revision: 5.10 $
+-------------------------------------------------------------
+This system uses 8 bytes per array element.
+-------------------------------------------------------------
+***** WARNING: ******
+ It appears that you set the preprocessor variable N when compiling this code.
+ This version of the code uses the preprocesor variable STREAM_ARRAY_SIZE to control the array size
+ Reverting to default value of STREAM_ARRAY_SIZE=10000000
+***** WARNING: ******
+Array size = 10000000 (elements), Offset = 0 (elements)
+Memory per array = 76.3 MiB (= 0.1 GiB).
+Total memory required = 228.9 MiB (= 0.2 GiB).
+Each kernel will be executed 10 times.
+ The *best* time for each kernel (excluding the first iteration)
+ will be used to compute the reported bandwidth.
+-------------------------------------------------------------
+Number of Threads requested = 8
+Number of Threads counted = 8
+-------------------------------------------------------------
+Your clock granularity/precision appears to be 1 microseconds.
+Each test below will take on the order of 21622 microseconds.
+ (= 21622 clock ticks)
+Increase the size of the arrays if this shows that
+you are not getting at least 20 clock ticks per test.
+-------------------------------------------------------------
+WARNING -- The above is only a rough guideline.
+For best results, please be sure you know the
+precision of your system timer.
+-------------------------------------------------------------
+Function Best Rate MB/s Avg time Min time Max time
+Copy: 8364.2 0.019258 0.019129 0.019508
+Scale: 8291.0 0.019572 0.019298 0.020162
+Add: 6223.6 0.038835 0.038563 0.040011
+Triad: 6222.5 0.038776 0.038570 0.039470
+-------------------------------------------------------------
+Solution Validates: avg error less than 1.000000e-13 on all three arrays
+-------------------------------------------------------------
+
+
+
+
+
+
+
+ # Compiling under qemu-user
+sudo apt update
+sudo apt install -y \
+ sbuild buildd qemu-system-misc qemu-user-static binfmt-support \
+ ca-certificates apt-transport-https devscripts mmdebstrap
+
+# Native
+sudo apt install -y \
+ sbuild buildd ca-certificates apt-transport-https devscripts mmdebstrap
+
+# Fix debian-ports certificate issues on the host (may not be necessary at this stage)
+wget https://mirror.sjtu.edu.cn/debian/pool/main/d/debian-ports-archive-keyring/debian-ports-archive-keyring_2023.02.01_all.deb
+sudo dpkg -i ./debian-ports-archive-keyring_2023.02.01_all.deb
+
+# Add current user to sbuild without root
+sudo sbuild-adduser $USER
+
+export SUFFIX=revyos-c910v-sbuild
+sudo sbuild-createchroot --debootstrap=debootstrap --arch=riscv64 \
+ --chroot-suffix=-$SUFFIX \
+ --keyring='' \
+ --no-deb-src \
+ --include=debian-ports-archive-keyring,ca-certificates,apt-transport-https,eatmydata \
+ --extra-repository="deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-c910v/ revyos-c910v main contrib non-free" \
+ --extra-repository="deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-addons/ revyos-addons main" \
+ sid /srv/chroot/sid-riscv64-$SUFFIX \
+ https://mirror.iscas.ac.cn/revyos/revyos-base/
+
+# Fix environment-related issues
+sudo sed -i 's/deb http/deb [trusted=yes] http/g' /srv/chroot/sid-riscv64-$SUFFIX/etc/apt/sources.list
+sudo rm -rf /srv/chroot/sid-riscv64-$SUFFIX/var/lib/apt/lists/*
+echo "command-prefix=eatmydata" | sudo tee -a /etc/schroot/chroot.d/sid-riscv64-$SUFFIX-*
+
+# Adjust source order - to use the c910v repository for the same version
+# Edit sources.list to ensure the following order
+deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-c910v/ revyos-c910v main contrib non-free
+deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-addons/ revyos-addons main
+deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-base/ sid main contrib non-free non-free-firmware
+
+sbuild --arch=riscv64 -d sid -c sid-riscv64-revyos-c910v-sbuild xxx.dsc
+
+
+
+
+
+
+
+ This is an experimental feature
. If you encounter any issues, you can report an issue.
# Add Optimization deb source
+sudo sed -i '1ideb https://mirror.iscas.ac.cn/revyos/revyos-c910v/ revyos-c910v main' /etc/apt/sources.list
+# Update
+sudo apt update && sudo apt upgrade -y
+# Install gcc-10/gcc-13
+sudo apt install -y build-essential gcc-13 g++-13
+# Reboot to avoid other problems
+sudo reboot
+
+gcc -v
+Using built-in specs.
+COLLECT_GCC=gcc
+COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/10/lto-wrapper
+Target: riscv64-linux-gnu
+Configured with: ../src/configure -v --with-pkgversion='Debian 10.4.0-8revyos2.3' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=riscv64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libsanitizer --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --disable-multilib --with-arch=rv64gcv0p7_zfh_xtheadc --with-abi=lp64d --enable-checking=release --build=riscv64-linux-gnu --host=riscv64-linux-gnu --target=riscv64-linux-gnu
+Thread model: posix
+Supported LTO compression algorithms: zlib zstd
+gcc version 10.4.0 (Debian 10.4.0-8revyos2.3)
+
+gcc-13 -v
+Using built-in specs.
+COLLECT_GCC=gcc-13
+COLLECT_LTO_WRAPPER=/usr/libexec/gcc/riscv64-linux-gnu/13/lto-wrapper
+Target: riscv64-linux-gnu
+Configured with: ../src/configure -v --with-pkgversion='Debian 13.2.0-1revyos1' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=riscv64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --disable-multilib --with-arch=rv64gc_zfh_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync --with-abi=lp64d --enable-checking=release --build=riscv64-linux-gnu --host=riscv64-linux-gnu --target=riscv64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=16
+Thread model: posix
+Supported LTO compression algorithms: zlib zstd
+gcc version 13.2.0 (Debian 13.2.0-1revyos1)
+
+Except for v0p7, all optimizations can use gcc-13 as a replacement for gcc-10.
+The optimizations in the latter can report issues to the mainline as they are already part of the mainline functionality.
+ + + + + + +RevyOS comes pre-packaged with an optimized compiler that primarily supports rv64gc
.
Supported Optimizations | +gcc-10 | +gcc-13 | +clang-17 | +
---|---|---|---|
Zfh | +✅ | +✅ | +✅ | +
v0p7 | +✅ | +❌ | +❌ | +
xthead Current Version v2.2
+Supported Optimizations1 | +gcc-102 | +gcc-13.2 | +clang-17 | +
---|---|---|---|
XTheadCmo | +✅ | +✅ | +✅ | +
XTheadSync | +✅ | +✅ | +✅ | +
XTheadBa | +✅ | +✅ | +✅ | +
XTheadBb | +✅ | +✅ | +✅ | +
XTheadBs | +✅ | +✅ | +✅ | +
XTheadCondMov | +✅ | +✅ | +✅ | +
XTheadMemIdx | +✅ | +✅ | +✅ | +
XTheadMemPair | +✅ | +✅ | +✅ | +
XTheadFMemIdx | +✅ | +✅ | +✅ | +
XTheadMac | +✅ | +✅ | +✅ | +
XTheadFmv | +✅ | +✅ | +❌ | +
XTheadInt | +✅ | +✅ | +❌ | +
XTHeadVdot3 | +✅ | +✅ | +✅ | +
Notes:
+First, ensure gcc is installed:
+sudo apt update
+sudo apt install gcc
+
+Here's an example of how to compile and run the simplest 'hello, world' program:
+Compile the following content and name it hello.c
:
#include <stdio.h>
+
+int main()
+{
+ printf("hello, world\n");
+ return 0;
+}
+
+Compile and execute:
+debian@lpi4a:~/test$ gcc -g hello.c -o hello
+
+debian@lpi4a:~/test$ ./hello
+hello, world
+
+First, ensure g++ is installed:
+sudo apt update
+sudo apt install g++
+
+Here's an example of how to compile and run the simplest 'hello, world' program:
+Compile the following content and name it hello.cpp
:
#include <iostream>
+using namespace std;
+
+int main()
+{
+ cout << "Hello, World!\n";
+ return 0;
+}
+
+Compile and execute:
+debian@lpi4a:~/test$ g++ -g hello.cpp -o hello
+debian@lpi4a:~/test$ ./hello
+Hello, World!
+
+These are the simplest examples of compiling and running programs with gcc/g++. For more complex applications, please refer to the corresponding system programming manuals.
+ + + + + + +Build Toolchain Download link:
+https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1663142514282/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz
+Assuming Build environment is Ubuntu
or Debian
Install dependency:
+sudo apt install -y gdisk dosfstools g++-12-riscv64-linux-gnu build-essential libncurses-dev gawk flex bison openssl libssl-dev tree dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf device-tree-compiler
+
+Uncompress Toolchain (Assuming install to /opt):
+tar -xvf Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz -C /opt
+
+Setup environment variables (Assuming Toolchain is in /opt):
+export PATH="/opt/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1/bin:$PATH"
+export CROSS_COMPILE=riscv64-unknown-linux-gnu-
+export ARCH=riscv
+
+Download code using git:
+# Kernel repo
+git clone https://github.com/revyos/thead-kernel.git
+
+Build Kernel:
+# make install target directory
+mkdir rootfs && mkdir rootfs/boot
+
+# after mkdir, the directory tree should look like this:
+# .. << current workdir
+# |-- rootfs
+# |-- boot
+# |-- thead-kernel
+# |-- ...
+
+# enter kernel directory and start build
+cd thead-kernel
+make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv revyos_defconfig
+make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv -j$(nproc)
+make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv -j$(nproc) dtbs
+sudo make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv INSTALL_MOD_PATH=../rootfs/ modules_install -j$(nproc)
+sudo make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv INSTALL_PATH=../rootfs/boot zinstall -j$(nproc)
+# build perf (if needed)
+make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv LDFLAGS=-static NO_LIBELF=1 NO_JVMTI=1 VF=1 -C tools/perf/
+sudo cp -v tools/perf/perf ../rootfs/sbin/perf-thead
+# Install Kernel
+sudo cp -v arch/riscv/boot/Image ../rootfs/boot/
+# Install DTB
+sudo cp -v arch/riscv/boot/dts/thead/light-lpi4a.dtb ../rootfs/boot/
+sudo cp -v arch/riscv/boot/dts/thead/light-lpi4a-dsi0-hdmi.dtb ../rootfs/boot/
+
+After all build steps, you can copy or override kernel and module files on your board using files in "rootfs", If you replace kernel with new one please make sure you also replace with corresponding kernel module folder.
+ + + + + + +C910V forced CPU specification patch
+From 5164bca5a4bcde4534dc1a9aa3a7f619719874cf Mon Sep 17 00:00:00 2001
+From: Han Gao <gaohan@iscas.ac.cn>
+Date: Sun, 23 Apr 2023 22:11:35 +0800
+Subject: [PATCH] qemu-user-riscv64 default cpu is c910v
+
+Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
+---
+ linux-user/riscv/target_elf.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/linux-user/riscv/target_elf.h b/linux-user/riscv/target_elf.h
+index 9dd65652ee45..3195cfa71408 100644
+--- a/linux-user/riscv/target_elf.h
++++ b/linux-user/riscv/target_elf.h
+@@ -9,7 +9,7 @@
+ #define RISCV_TARGET_ELF_H
+ static inline const char *cpu_get_model(uint32_t eflags)
+ {
+- /* TYPE_RISCV_CPU_ANY */
+- return "any";
++ /* TYPE_RISCV_CPU_C910V */
++ return "c910v";
+ }
+ #endif
+
+Compilation process
+./configure \
+ --prefix=$HOME/qemu-install \
+ --static \
+ --target-list=riscv64-linux-user \
+ --disable-system \
+ --disable-pie \
+ --interp-prefix=/etc/qemu-binfmt/%M
+
+make -j20
+
+
+
+
+
+
+
+ This section describes the build documentation related to RevyOS
+ + + + + + +Test Image
+Based on lpi4a 20230614 +Add ahead support & mixed 20230820 changes
+https://mirror.iscas.ac.cn/revyos/extra/images/beagle/test/20230802/
+RevyOS 20230412 version
+RevyOS 20230425 Version
+RevyOS 20230511 version
+Added support for the GNOME desktop
+RevyOS 20230614 Version
+The current version only provides support for the xfce4 desktop
+Chromium support is provided
+RevyOS 20230810 Version
+The boot process has been redesigned, so all partitions need to be reflashed.
+Retrieving file: /dtbs/linux-image-5.10.113-lpi4a/<NULL>-light-c910.
+Skipping l0r for failure retrieving fdt
+Light LPI4A#
+
+When encountering this situation, you need to execute</br>
+env default -a -f;env save;reset
+
+The current version only provides support for xfce4 desktop.
+Kernel commit ID: #2023.08.10.02.31+c130cdb21
+RevyOS 20230916 Version
+SBI Timestamp
+U-Boot Timestamp
+Kernel Commit ID
+Version Timestamp (/etc/revyos-release)
+RevyOS 20231026 Version
+RevyOS 20231210 Version
+SBI Timestamp
+U-Boot Timestamp
+Kernel Commit ID
+Version Timestamp (/etc/revyos-release)
+RevyOS 20240202 Version
+SBI Timestamp
+U-Boot Timestamp
+Kernel Commit ID
+Version Timestamp (/etc/revyos-release)
+RevyOS 20240601 version
+SBI Timestamp
+u-boot Timestamp
+Kernel Commit ID
+Version Timestamp (/etc/revyos-release)
+Status:
+Running, with software rendering for graphics.
Resources:
+- OpenTTD Compiling Guide
+- Debian Control File
# Install dependencies
+sudo apt install libsdl2-dev zlib1g-dev libpng-dev libfreetype-dev libfontconfig-dev libicu-dev liblzo2-dev liblzma-dev libfluidsynth-dev libopengl-dev grfcodec openttd-opengfx cmake
+
+# Download the code & compile
+git clone https://github.com/OpenTTD/OpenTTD.git
+cd OpenTTD
+mkdir build
+cd build
+cmake ..
+make
+
+# Run the game
+./openttd
+
+The graphics and audio resource files can be downloaded through the in-game functionality, and the game supports Chinese.
+ + + + + + + +Status:
+Running with GLES acceleration support.
Resources:
+- Installation Guide
+- Configuration Guide
# Install dependencies
+sudo apt install build-essential libgl1-mesa-dev libsdl2-dev libopenal-dev libcurl4-openssl-dev
+
+# Download the code & compile
+git clone https://github.com/yquake2/yquake2.git
+mkdir build
+cd build
+cmake ..
+make
+
+# Run the game
+# (Make sure to have the original game resource folder baseq2 ready)
+cd ..
+cd release
+cp -r ~/baseq2 .
+./quake2
+
+You need to place the original game resource folder baseq2
in the same directory as the quake2
program (the Steam version works).
The resolution and graphics acceleration options can be modified in the in-game settings menu. By default, it uses software rendering, so be sure to change it to “OpenGL ES3” for hardware rendering (see the image below).
+ + + + + + + +In RevyOS, packages can be installed by typing the following command in the terminal:
+sudo apt install <package-name>
+
+Here is an example of installing git
:
debian@lpi4a:~$ sudo apt install git
+[sudo] password for debian:
+Reading package lists... Done
+Building dependency tree... Done
+Reading state information... Done
+The following additional packages will be installed:
+ git-man liberror-perl patch
+Suggested packages:
+ gettext-base git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui
+ gitk gitweb git-cvs git-mediawiki git-svn ed diffutils-doc
+The following NEW packages will be installed:
+ git git-man liberror-perl patch
+0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
+Need to get 8605 kB of archives.
+After this operation, 39.4 MB of additional disk space will be used.
+Do you want to continue? [Y/n] y
+Get:1 https://mirror.iscas.ac.cn/revyos/revyos-base sid/main riscv64 liberror-perl all 0.17029-2 [29.0 kB]
+Get:2 https://mirror.iscas.ac.cn/revyos/revyos-base sid/main riscv64 git-man all 1:2.40.1-1 [2072 kB]
+Get:3 https://mirror.iscas.ac.cn/revyos/revyos-base sid/main riscv64 git riscv64 1:2.40.1-1 [6390 kB]
+Get:4 https://mirror.iscas.ac.cn/revyos/revyos-base sid/main riscv64 patch riscv64 2.7.6-7+b1 [114 kB]
+Fetched 8605 kB in 1s (6656 kB/s)
+Selecting previously unselected package liberror-perl.
+(Reading database ... 75688 files and directories currently installed.)
+Preparing to unpack .../liberror-perl_0.17029-2_all.deb ...
+Unpacking liberror-perl (0.17029-2) ...
+Selecting previously unselected package git-man.
+Preparing to unpack .../git-man_1%3a2.40.1-1_all.deb ...
+Unpacking git-man (1:2.40.1-1) ...
+Selecting previously unselected package git.
+Preparing to unpack .../git_1%3a2.40.1-1_riscv64.deb ...
+Unpacking git (1:2.40.1-1) ...
+Selecting previously unselected package patch.
+Preparing to unpack .../patch_2.7.6-7+b1_riscv64.deb ...
+Unpacking patch (2.7.6-7+b1) ...
+Setting up liberror-perl (0.17029-2) ...
+Setting up patch (2.7.6-7+b1) ...
+Setting up git-man (1:2.40.1-1) ...
+Setting up git (1:2.40.1-1) ...
+Processing triggers for man-db (2.11.2-2) ...
+
+After confirming with Y
, git
and its dependencies are installed and ready for use.
To install Go, use the following command:
+sudo apt install golang-go
+
+Verify the installation:
+debian@lpi4a:~$ go version
+go version go1.19.8 linux/riscv64
+
+A RISC-V64-compatible Docker package is available as docker.io
, and can be installed with:
sudo apt install docker.io
+
+To test the installation, try pulling the RISC-V64 Debian image:
+sudo docker pull riscv64/debian:unstable
+
+If the following error occurs when using the docker pull
command:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/create?fromImage=riscv64%2Fdebian&tag=unstable": dial unix /var/run/docker.sock: connect: permission denied
+
+resolve it with these commands:
+# Allow access to the Docker socket
+sudo chmod 666 /var/run/docker.sock
+
+# Start the Docker service
+sudo systemctl start docker
+
+# Run a test container
+sudo docker run hello-world
+
+This should enable Docker to run with the necessary permissions.
+ + + + + + +++本页的 ROS 指 ROS 2
+
状态:可以运行
+官方资料页:https://ros.org/
+官方文档: https://docs.ros.org/
+ROS (Robot Operating System, 机器人操作系统) 提供一系列程序库和工具以帮助软件开发者创建机器人应用软件。它提供了硬件抽象、设备驱动、函数库、可视化工具、消息传递和软件包管理等诸多功能。ROS遵循BSD开源许可协议。
+假设使用来自 ros.z572.online
的源
注意下面应该使用 bookworm
sudo sh -c "echo 'deb [trusted=yes] https://ros.z572.online/main bookworm main\ndeb-src [trusted=yes] https://ros.z572.online/main bookworm main' > /etc/apt/sources.list.d/ros.list"
+sudo apt update
+sudo apt upgrade
+
+目前已经测试 ROS Jazzy 和 Humble 版本可用
+注意:两个版本可能会存在依赖冲突,请不要尝试同时安装两个版本
+Jazzy:
+apt install ros-jazzy-desktop-full
+
+Humble:
+apt install ros-humble-desktop-full
+
+sudo apt install python3-rosdep2
+
+然后删除 /etc/ros/rosdep/sources.list.d/10-debian.list
,
+并修改 etc/ros/rosdep/sources.list.d/20-default.list
为下面的内容
yaml https://raw.githubusercontent.com/revyos-ros/rosdistro/master/rosdep/base.yaml
+yaml https://raw.githubusercontent.com/revyos-ros/rosdistro/master/rosdep/python.yaml
+yaml https://raw.githubusercontent.com/revyos-ros/rosdistro/master/rosdep/ruby.yaml
+
+根据安装的 ROS 版本,选择相应的命令
+Jazzy:
+source /opt/ros/jazzy/setup.sh
+
+Humble:
+source /opt/ros/Humble/setup.sh
+
+可以将上面的内容加入 .bashrc
或者您使用的 shell profile 中。
rosdep update
+
+使用 rosdep 安装外部依赖(以 micro_ros_setup
)为例
1.设置环境变量 +请根据您安装的版本选择对应的命令
+Jazzy:
+AMENT_PACKAGE_PATH=/opt/ros/jazzy
+
+Humble:
+AMENT_PACKAGE_PATH=/opt/ros/humble
+
+2.下载源代码
+git clone https://github.com/micro-ROS/micro_ros_setup && cd micro_ros_setup
+
+3.安装依赖
+rosdep install --from-paths . -y --ignore-src
+
+colon 是一款现代的 ROS 编译工具
+sudo apt install colcon
+
+测试编译(依然以 micro_ros_setup
)为例
git clone https://github.com/micro-ROS/micro_ros_setup && cd micro_ros_setup
+colcon build
+
+ros2 pkg
命令用于管理 ROS 2 包。ros2 run
命令用于运行 ROS 2 包中的特定节点。ros2 topic
命令用于与 ROS 2 的话题交互。ros2 param
命令用于管理 ROS 2 参数。ros2 service
命令用于与 ROS 2 服务交互。ros2 node
命令用于与 ROS 2 节点交互。ros2 bag
命令用于记录和回放 ROS 2 数据。ros2 launch
命令用于启动 ROS 2 启动文件。Node(C++)
+ 运行 C++ 节点:
+bash
+ ros2 run demo_nodes_cpp talker
+ ros2 run demo_nodes_cpp listener
Node(Python)
+ 运行 Python 节点:
+bash
+ ros2 run demo_nodes_py talker
+ ros2 run demo_nodes_py listener
Add Two Ints Server
+ 测试服务端和客户端:
+bash
+ ros2 run demo_nodes_cpp add_two_ints_server
+ ros2 run demo_nodes_cpp add_two_ints_client
TF2
+ 测试静态变换、监听和监控功能:
+ 发布静态变换并监听:
+bash
+ ros2 run tf2_ros static_transform_publisher 1 1 1 0 0 0 /base_link /odom
+ ros2 run tf2_ros tf2_echo base_link odom
+ 监控变换:
+bash
+ ros2 run tf2_ros static_transform_publisher 1 1 1 0 0 0 /base_link /odom
+ ros2 run tf2_ros tf2_monitor
+ 查看变换框架图(需生成 PDF 文件):
+bash
+ ros2 run tf2_ros static_transform_publisher 1 1 1 0 0 0 /base_link /odom
+ ros2 run tf2_tools view_frames
TurtleSim
+ 需要图形界面支持:
+ 启动 turtlesim 节点:
+bash
+ ros2 run turtlesim turtlesim_node
+ 图形界面会弹出一个窗口。
+ 使用键盘控制小乌龟:
+bash
+ ros2 run turtlesim turtle_teleop_key
bash
+ ros2 run rqt_gui rqt_gui
需要使用 sudo switch-gl gl4es
再重启后使用 LIBGL_ALWAYS_SOFTWARE=true rviz2 here
启动,效果如下
使用 sudo apt install gazebo11
安装
需要使用 sudo switch-gl gl4es
再重启后使用 LIBGL_ALWAYS_SOFTWARE=true gazebo
启动,效果如下
Status:
+Operational on RevyOS.
Official Documentation:
+GIMP User Manual
GIMP, short for the GNU Image Manipulation Program, is a versatile, cross-platform tool for creating and editing images. It supports a wide range of features, from simple drawing to expert-level photo retouching, digital art creation, batch processing, and format conversion. Designed to be extensible, GIMP can be enhanced through plugins and extensions to perform nearly any image manipulation task. Its advanced scripting interface also enables automation, covering everything from basic tasks to complex image processing operations.
+GIMP is pre-installed on RevyOS as the default image editing software. To start GIMP, enter the following command in the terminal:
+gimp
+
+After loading, the GIMP main interface will appear:
+ +For more detailed guidance, refer to the official documentation linked above.
+ + + + + + +Status:
+Operational.
Resources:
+iBus on Debian Wiki
sudo apt install ibus ibus-libpinyin
+sudo reboot
+
+After rebooting, manually add the Chinese input method:
+Right-click the iBus tray icon and select Preferences. +
+In the Input Method tab, click Add to open the input selection window. +
+Select Chinese -> Intelligent Pinyin and click Add. +
+RevyOS is a Debian based custom distribution developed and maintained by the RevyOS team under RuyiSDK, specifically optimized for the XuanTie chip ecosystem.
+RevyOS is part of RuyiSDK, an open-source project initiated by PLCT Lab, aimed at providing a convenient and comprehensive development environment for RISC-V developers. It offers the latest hardware information and software support, such as details about supported hardware devices and software components like OS images (e.g., RevyOS), toolchains, and package managers.
+RevyOS provides complete and thorough support for XuanTie chips including XuanTie C906, C910, C920, C908, with default integration of the XuanTie extended instruction sets and the GCC toolchain supporting RVV 1.0. It also features Glibc and Kernel optimized with RVV 1.0 instruction set.
+Currently, RevyOS meets basic user needs in office work, web browsing, and video watching.
+Based on these customizations and optimizations, RevyOS delivers excellent performance and a great experience on hardware platforms like Lichee Pi 4A, BeagleV-Ahead, and Milk-V Pioneer.
+The user version images of RevyOS are currently updated on the ISCAS (Institute of Software, Chinese Academy of Sciences) / Felix Finland Source open-source mirror sites.
+If you want to obtain the latest version of RevyOS, please select the corresponding device to get the appropriate U-Boot, boot partition, and root partition files:
+Supported Devices | +Image Download (Latest Version) | +Flashing Tutorial | +SD Card Support | +
---|---|---|---|
Lichee Pi 4A | +20241229 | +Flashing Tutorial | +Supported | +
Lichee Cluster 4A | +20240720 | +Flashing Tutorial | ++ |
Lichee Console 4A | +20240720 | +Flashing Tutorial | ++ |
Lichee Book 4A | +20240720 | +Flashing Tutorial | ++ |
Milk-V Pioneer | +20241230 | +Flashing Tutorial | +Supported | +
Milk-V Meles | +20241229 | ++ | Supported | +
Beagle-Ahead | +20231210 | ++ | + |
Huiwei Book | +20240617 | ++ | + |
For more details, see this document: How to Enable Optimized GCC.
+After each update to the image version, we will publish the supported features for the current version. To view the changelog, please click RevyOS Version Change Log and select the version you want to check.
+If you encounter any issues during use, you can report them by creating an issue.
+In this documentation, we provide guides for reference on building, adapting, and also system testing. This would help users get onboard easier with RevyOS.
+RevyOS has its own Telegram group: Invitation Link
+We are currently recruiting test interns. For more information, visit: RevyOS Team Test Intern Recruitment (Chinese only)
+ + + + + + +感谢使用 RevyOS!如果在使用过程中遇到问题或发现了 Bug,可以按照以下步骤操作:
+在提交新的 Issue 之前,建议先查看我们的已知问题记录:
+如果问题已存在,您可以选择:
+如果您想交流使用过程中的问题,可以通过以下方式联系我们:
+RevyOS是由 RuyiSDK 团队的 RevyOS 小队支持开发的一款针对 XuanTie 芯片生态的 Debian 优化定制发行版。
+RevyOS 是 RuyiSDK 的一部分。RuyiSDK 是一个由 PLCT Lab 所启动的开源项目,该项目旨在为 RISC-V 开发者提供一个便捷、完善的开发环境,其提供了相关最新的硬件信息、软件支持,例如在支持的设备中有提供相关支持硬件情况;软件层面提供了镜像(如 RevyOS)、工具链、包管理器等。
+RevyOS 围绕玄铁 C906、C910、C920、C908 等芯片提供了完整而全面的适配和优化支持,默认集成支持玄铁扩展指令集和 RVV 1.0 的 GCC 工具链,并搭载使用 RVV 1.0 指令集优化过的 Glibc 和 Kernel。
+目前,RevyOS 在办公、网页浏览、观看视频等方面已经能满足用户的基本使用需求。
+基于上述定制和优化的 RevyOS,在 Lichee RV,Lichee Pi 4A 等硬件平台上,能够提供优秀的性能和极佳的体验。
+RevyOS 的用户版镜像目前在 ISCAS(中国科学院软件研究所)开源镜像站进行更新。如您想获取 RevyOS 最新版镜像请访问镜像下载目录,根据所使用设备来获取对应镜像。
+支持设备 | +镜像下载(最新版本) | +刷写教程 | +SD 卡支持 | +
---|---|---|---|
Lichee Pi 4A | +20241229 | +镜像刷写 | +支持 | +
Lichee Cluster 4A | +20240720 | +镜像刷写 | ++ |
Lichee Console 4A | +20240720 | +镜像刷写 | ++ |
Lichee Book 4A | +20240720 | +镜像刷写 | ++ |
Milk-V Pioneer | +20241230 | +镜像刷写 | +支持 | +
Milk-V Meles | +20241229 | ++ | 支持 | +
Beagle-Ahead | +20231210 | ++ | + |
Huiwei book | +20240617 | ++ | + |
详见这篇文档如何启用优化 GCC
+镜像版本更新后我们会公布当前版本镜像支持内容,如您想查看镜像支持内容请点击RevyOS 版本更新日志后选择您所需要的版本进行查看。
+如果您在使用过程中遇到问题,可以进行issue 申报。
+在本 DOCS 中,我们拥有相关的使用构建与适配文档以及测试文档方便让用户对部分内容进行参考,完善的文档支持加快了用户对于系统的上手时间。
+RevyOS 有自己的 Telegram 群组:邀请链接
+现在正在招聘测试实习生,详情请看:RevyOS 小队测试实习生招聘
+ + + + + + +感谢使用 RevyOS!如果在使用过程中遇到问题或发现了 Bug,可以按照以下步骤操作:
+在提交新的 Issue 之前,建议先查看我们的已知问题记录:
+如果问题已存在,您可以选择:
+如果您想交流使用过程中的问题,可以通过以下方式联系我们:
+施工中
+ + + + + + +施工中
+ + + + + + +LicheePi4A支持从 SD card 启动和从 eMMC 启动。以下分别介绍这两种启动方式下该如何刷写RevyOS镜像。
+演示环境:Ubuntu22.04
+注意!从sd卡启动不需要改变拨码开关!按照eMMC拨码开关进行设置!
+准备MicroSD 读卡器和一张MicroSD 卡
+安装zstd用于解压镜像文件
+apt install zstd
+
+从以下链接下载 LicheePi4A 以 sdcard-
为前缀的 SD card 启动系统镜像:RevyOS0720。
解压镜像压缩包得到sdcard-lpi4a-20240720_171951.img文件
+unzstd sdcard-lpi4a-20240720_171951.img.zst
+
+从官网获取烧录工具 BalenaEtcher https://etcher.balena.io/
+把 SD 卡插入读卡器,并将其插入电脑。
+运行 BalenaEtcher用于写入镜像到SD 卡。 +在 BalenaEtcher 窗口中, 首先点击 "Flash from file" 来选择镜像文件。 + +选择完镜像文件后在第二栏选择需要写入的设备。 + +两项都选择完以后点击"Flash"写入镜像。 + +在等待一段时间后会显示烧录已完成。 +
+在刷写前请保证您在 of=
设置了正确的设备
# sudo dd if=./sdcard-lpi4a-20240720_171951.img of=<Target Device> status=progress
+# sync
+
+等待完成即可使用
+在写入镜像完成后将SD 卡插入如图所示卡槽中。 + +连接hdmi线与电源线后可直接启动。
+从eMMC启动镜像时,刷写镜像的途径分为连接串口与不连接串口两种情况,其中进行的操作有些许区别,在此将两种方式一起进行介绍。 +从eMMC启动应当先取出 SD Card
+从eMMC启动需要将u-boot文件、boot文件以及root文件通过fastboot刷入eMMC中,所以需要保证已安装fastboot。
+Ubuntu可直接通过apt安装
+apt install fastboot
+
+通过串口连接时需要串口控制台进行监控,在Ubuntu下选择使用minicom。
+apt install minicom
+
+从以下链接下载 LicheePi4A 的系统镜像:RevyOS0720。
+其中u-boot文件需要根据自己的板卡规格进行选择,请注意提前了解自己的板卡规格后进行下载。
+下载后使用 unzstd
解压 root 和 boot 镜像
unzstd boot-lpi4a-20240720_171951.ext4.zst
+unzstd root-lpi4a-20240720_171951.ext4.zst
+
+按住板卡上的BOOT键后,接入电脑。板卡会进入刷写模式
+首先从终端打开minicom,进入串口控制台。
+sudo minicom
+
+如图所示将串口与板卡进行连接,usb端接入电脑。板卡上的Type-C接口通过USB-Type-C线连接到电脑。
+连接串口,红色圈内(从左往右第一排第二个)为 GND,黄色圈内(第一排第五个)为 TX,绿色圈内(第二排第五个)为 RX。与主机应遵循TX到RX,RX到TX,GND到GND的接线。
+ +在接入后在串口控制台中按任意按键打断,在串口控制台窗口中输入
+fastboot usb 0
+
+随后另起一个窗口进行镜像刷写。
+以下命令均为在镜像文件下载文件夹路径内,注意文件路径和文件名。
+如果 lsusb
结果不是 ID 1234:8888 Brain Actuated Technologies USB download gadget
,运行下面的命令
fastboot flash ram u-boot-with-spl-lpi4a-16g.bin # 替换为您的型号对应的 uboot 镜像
+fastboot reboot
+sleep 1
+
+fastboot flash uboot u-boot-with-spl-lpi4a-16g.bin
+fastboot flash boot boot-lpi4a-20240720_171951.ext4
+fastboot flash root root-lpi4a-20240720_171951.ext4
+
+fastboot 会显示刷写进度,如果连接了串口,在串口控制台中可以看到具体进度(下图以刷写
+boot,大小为 92886476 Bytes为例,可在 cmd_parameter: boot, imagesize: 92886476
处查看刷入的内容)。
刷写完成后拔掉电脑与板卡连接的USB-Type-C线,接入电源线便可直接启动进入系统。
+如果 lsusb
中存在 download 设备,但fastboot
命令仍然卡在 < waiting for any device >
,可以尝试使用 sudo
运行 fastboot
命令。
RevyOS 镜像目录:镜像下载
+目前最新镜像版本为:20240819
+以下以20240819镜像目录为例:
+ +RevyOS 镜像刷写遵循固件文件+系统文件的方式,因此会用到以下文件
+固件文件:
+系统文件:
+根据镜像下载中的说明,固件文件可以存放于 SPI Flash 或 SD卡中,因此下面将会进行分类说明。
+操作环境:Ubuntu 22.04
+1、选择文件 firmware_single_sg2042-v6.6-lts-v0p7.img +2、选择目标SD卡 +3、点击烧录
+将SD卡插入读卡器并连接至电脑,确认是否正确连接以及设备路径
+在存放firmware_single_sg2042-v6.6-lts-v0p7.img文件的目录下时,使用dd命令将文件刷写到SD卡中
+sudo dd if=firmware_single_sg2042-v6.6-lts-v0p7.img of=/dev/sda bs=4M status=progress
of=/dev/sda
此项请根据设备路径进行更改
刷写完成后请使用sync
命令,确保数据写入到 SD 卡中。
操作环境:RevyOS0819
+注意事项:首次使用时推荐使用SD卡存放固件
+此方法是将.bin文件写入到mtd中,所以需要安装相关软件包以及加载相关模块
+sudo apt install mtd-utils
+sudo modprobe mtdblock
+
+然后下载文件
+wget https://mirror.iscas.ac.cn/revyos/extra/images/sg2042/20240819/firmware_single_sg2042-v6.6-lts-v0p7.bin
+
+下载完成后切换到 firmware_single_sg2042-v6.6-lts-v0p7.bin 的下载目录下,执行以下命令
+sudo flashcp -v firmware_single_sg2042-v6.6-lts-v0p7.bin /dev/mtd1
+
+至此刷写完成
+操作环境:Ubuntu 22.04
+首先需要解压revyos-pioneer-20240819-154656.img.zst
文件
unzstd revyos-pioneer-20240819-154656.img.zst
+
+得到revyos-pioneer-20240819-154656.img
文件
将NVMe SSD插入读卡器并连接至电脑,确认是否正确连接以及设备路径
+在存放revyos-pioneer-20240819-154656.img文件的目录下时,使用dd命令将文件刷写到NVMe SSD中
+sudo dd if=revyos-pioneer-20240819-154656.img of=/dev/nvme0n1 bs=4M status=progress
of=/dev/nvme0n1
此项请根据设备路径进行更改
刷写完成后请使用sync
命令,确保数据写入到NVMe SSD中。
brew
或其他方式安装 android-platform-tools开始下载 uboot 以及镜像:
+访问该网站,并且确保您进入的是最新日期的文件夹,这里以 20240720 为例:
+下载以下文件:
+++确保您下载的文件与您的硬件相符,荔枝派 4a 分为 8G 以及 16G 版本,对应的 uboot 也不相同。
+
接着,使用 brew
安装 android-platform-tools:
brew intsall android-platform-tools
确定 fastboot
指令能够正常使用:
yuiyuuhayashi@MacBook-Air ~ % fastboot usb 0
+< waiting for any device >
+
+首先, 让你的荔枝派在启动阶段进入 xx 模式。
+输入 fastboot usb 0
,并且确定您已经通过 type C 接口正确连接到您的 Mac 以及接入 12V 供电
+在 Mac 上输入如下指令:
fastboot flash uboot <filename>
+
+正确刷写后,使用 fastboot reboot
进行重启
++若没有开发版没有正确重启,请手动断电重启
+
同样的进入 xx 模式,在 macOS 上执行如下指令:
+fastboot flash root <filename>
+
+同样的,使用 fastboot reboot
进行重启
在进入系统后,请输入如下账号密码:
+debian
+debian
+
+成功进入系统后,可使用 neofetch
等方式查看系统版本等信息。
Some GStreamer pipeline command-line examples with omxil library on TH1520, RevyOS
+In this section, the grammer of the gstreamer command-line pipeline and some usefule debug tips are introduced. They have been moved to the end of the article.
+Basically, you neet to install gstreamer1.0-plugins-base
, gstreamer1.0-plugins-good
, gstreamer1.0-plugins-bad
, gstreamer1.0-omx-generic
, gstreamer1.0-omx-bellagio-config
,gstreamer1.0-tools
.
# videotestsrc
+gst-launch-1.0 videotestsrc ! autovideosink
+
+# specify the video stream format
+gst-launch-1.0 videotestsrc ! video/x-raw, format=NV12, width=960, height=540, framerate=60/1 ! autovideosink
+
+# display framerate
+gst-launch-1.0 videotestsrc ! fpsdisplaysink
+
+# no need to sync on the clock - used to test the performance of the pipeline
+gst-launch-1.0 videotestsrc ! fpsdisplaysink sync=false
+
+# stop display on the screen, but redirect the output to stdout
+gst-launch-1.0 videotestsrc ! fpsdisplaysink text-overlay=false -v 2>&1
+
+# specify which sink to use
+gst-launch-1.0 videotestsrc ! fpsdisplaysink sink=glimagesink
+
+# combine the previous examples
+gst-launch-1.0 videotestsrc ! fpsdisplaysink sink=glimagesink sync=false text-overlay=false -v 2>&1
+
+# audiotestsrc
+gst-launch-1.0 audiotestsrc ! autoaudiosink
+
+# change volume (0 to 1)
+gst-launch-1.0 audiotestsrc volume=0.1 ! autoaudiosink
+
+# change waveform
+# could be selected among square, silence, pink-noise, etc.
+gst-launch-1.0 audiotestsrc wave=pink-noise ! autoaudiosink
+
+# set fix frequency, such as "do" (262 Hz)
+gst-launch-1.0 audiotestsrc freq=262 ! autoaudiosink
+
+# a dummy sink that swallows everything
+gst-launch-1.0 videotestsrc ! fakesink
+
+# let decodebin choose which decoder to use,
+# and autovideosink choose which video-sink to use (not recommended)
+gst-launch-1.0 filesrc location=fire.mp4 ! decodebin ! autovideosink
+
+# h264 software decode without opengl display
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux ! h264parse ! avdec_h264 ! xvimagesink
+
+# h264 hardware decode with opengl display
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux ! h264parse ! omxh264dec ! glimagesink
+
+# h265 hardware decode
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux ! h265parse ! omxh265dec ! glimagesink
+
+# vp9 hardware decode
+gst-launch-1.0 filesrc location=fire.webm ! matroskademux ! omxvp9dec ! glimagesink
+
+# mpeg4 hardware decode
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux ! queue ! mpeg4videoparse ! omxmpeg4videodec ! glimagesink
+
+# play mkv/webm file
+gst-launch-1.0 filesrc location=fire.mkv ! matroskademux ! decodebin ! glimagesink
+
+# todo 10-bit h264/h265 decode
+
+# there is no hardware decoder on th1520
+
+# let autoaudiosink choose which audio-sink to use
+gst-launch-1.0 filesrc location=blade.mp3 ! decodebin ! audioconvert ! autoaudiosink
+
+# mp3 decode
+gst-launch-1.0 filesrc location=blade.mp3 ! mpegaudioparse ! avdec_mp3 ! audioconvert ! autoaudiosink
+
+# aac decode
+gst-launch-1.0 filesrc location=blade.aac ! aacparse ! avdec_aac ! audioconvert ! autoaudiosink
+gst-launch-1.0 filesrc location=blade.aac ! aacparse ! faad ! audioconvert ! autoaudiosink
+## faad works well without aacparse
+gst-launch-1.0 filesrc location=blade.aac ! faad ! audioconvert ! autoaudiosink
+
+# opus decode
+## ogg file must be demuxed by oggdemux first
+gst-launch-1.0 filesrc location=blade.ogg ! oggdemux ! opusparse ! opusdec ! audioconvert ! autoaudiosink
+gst-launch-1.0 filesrc location=blade.ogg ! oggdemux ! opusparse ! avdec_opus ! audioconvert ! autoaudiosink
+
+# wav decode
+gst-launch-1.0 filesrc location=test.wav ! wavparse ! audioresample ! audioconvert ! autoaudiosink
+
+# use specific audiosink
+gst-launch-1.0 filesrc location=blade.mp3 ! decodebin ! audioconvert ! pulsesink
+
+# specify the output device by using alsasink with device property
+gst-launch-1.0 filesrc location=blade.mp3 ! decodebin ! audioconvert ! alsasink device=hw:0,2
+
+We play media file in this section.
+# play mp4 file with both audio and video
+gst-launch-1.0 filesrc location=fire.mp4 ! qtdemux name=demux \
+ demux.video_0 ! queue ! decodebin ! videoconvert ! autovideosink \
+ demux.audio_0 ! queue ! decodebin ! audioconvert ! autoaudiosink
+
+# h264 encode test
+# before import video stream to omxh264dec, data should be transformed to frame with rawvideoparse
+# property and pad of rawvideoparse should be set to the same, so we use 'use-sink-caps=true' here
+gst-launch-1.0 videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=640, height=480 \
+ ! rawvideoparse use-sink-caps=true ! omxh264enc ! fakesink
+
+# h264 hardware encode to file
+## todo: encoded h264 file has seek problem
+gst-launch-1.0 videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=640, height=480 \
+ ! rawvideoparse use-sink-caps=true ! omxh264enc \
+ ! h264parse ! qtmux ! mp4mux ! filesink location=test.mp4
+
+# h264 hardware encode to file with specific bitrate(bit per second)
+gst-launch-1.0 videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=640, height=480 \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc target-bitrate=3000000 \
+ ! h264parse ! filesink location=test.mp4
+
+
+# h265 hardware encode to file
+## this pipeline produces h265 stream only
+## qtdemux is not needed while decoding
+gst-launch-1.0 videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=640, height=480 \
+ ! rawvideoparse use-sink-caps=true ! omxh265enc \
+ ! h265parse ! filesink location=test.h265
+
+# h264 hardware encode from camera to file
+gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert \
+ ! video/x-raw, format=NV12,width=640,height=480 \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc ! h264parse ! filesink location=test.mp4 -e
+
+# There is no hardware audio encoder on th1520
+
+# encode aac stream with adts container(.aac file)
+## the unit of the bitrate is 'bit/sec'
+gst-launch-1.0 audiotestsrc ! voaacenc bitrate=128000 ! avmux_adts ! filesink location=test.aac
+
+
+# todo: encode aac stream with adif container(.m4a file)
+
+# encode to mp3 file
+## the unit of the bitrate is 'kbit/sec'
+gst-launch-1.0 audiotestsrc ! lamemp3enc quality=2 target=bitrate bitrate=192 cbr=true ! id3v2mux ! filesink location=test.mp3
+
+# encode opus stream to .ogg file
+gst-launch-1.0 audiotestsrc ! opusenc ! oggmux ! filesink location=test.opus
+
+
+# todo: encode pcm stream to .wav file
+
+This part has been removed to Video + audio transcode
section.
Since omx...dec
cannot fulfill qtdemux and mp4mux, and gst-omx is no longer maintained, it is hard to mux mp4 file with these two plugins. To mux stream from omxh264dec, use avmux_mp4
instead. But there is no h265 or vp9 muxer available for omx...dec
The raw video stream should be processed by rawvideoparse
before sent to encoder. Because itself cannot scale frame or change framerate, rawvideoparse
need to get the stream info of its sink pad(src pad of the backward element). Therefore use-sink-caps
must be set to true
.
To change width and height, set properties output-width
and output-height
of omx...dec
. To modify bitrate and bitrate control method, set properties control-rate
and target-bitrate
of omx...enc
. To change framerate, set properties of videorate
.
# h265 to h264
+gst-launch-1.0 filesrc location=test_h265.mp4 ! qtdemux ! h265parse ! omxh265dec \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc ! h264parse ! avmux_mp4 ! filesink location=t_h264.mp4
+
+# vp9 to h264
+gst-launch-1.0 filesrc location=test_vp9.webm ! matroskademux ! omxvp9dec \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc ! h264parse ! avmux_mp4 ! filesink location=t_h264.mp4
+
+# arbitrary input to h264
+gst-launch-1.0 filesrc location=test_h264.mp4 ! decodebin \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc ! h264parse ! filesink location=t_h264.mp4
+
+# h264 to h264, with more options
+## set the video width and height to 1280×720, framerate to 15fps, bitrate mode to constant and bitrate to 5Mbps
+gst-launch-1.0 filesrc location=test_h264.mp4 ! qtdemux ! h264parse \
+ ! omxh264dec output-width=1280 output-height=720 \
+ ! videorate ! video/x-raw, framerate=15/1 \
+ ! rawvideoparse use-sink-caps=true \
+ ! omxh264enc control-rate=constant target-bitrate=5000000 ! h264parse ! filesink location=t_h264.mp4
+
+## there is no vp9 encoder in th1520 omxil lib
+
+# aac to mp3
+gst-launch-1.0 filesrc location=test.aac ! aacparse ! avdec_aac ! audioconvert ! lamemp3enc quality=2 target=bitrate bitrate=192 cbr=true ! id3v2mux ! filesink location=t.mp3
+
+# mp3 to aac
+gst-launch-1.0 filesrc location=test.mp3 ! mpegaudioparse ! avdec_mp3 ! audioconvert ! voaacenc bitrate=128000 ! avmux_adts ! filesink location=t.aac
+
+# wav to mp3
+gst-launch-1.0 filesrc location=test.wav ! wavparse ! audioresample ! audioconvert ! lamemp3enc quality=2 target=bitrate bitrate=192 cbr=true ! id3v2mux ! filesink location=t.mp3
+
+# mp3 to wav
+gst-launch-1.0 filesrc location=test.mp3 ! mpegaudioparse ! avdec_mp3 ! audioresample ! audioconvert \
+ ! audio/x-raw, rate=44100, format=S16LE ! wavenc ! filesink location=t.wav
+
+# mux test
+gst-launch-1.0 audiotestsrc ! autoaudiosink videotestsrc ! autovideosink
+
+# mux the test video and audio stream to a mp4 file
+## be aware that '-e' must be set to this pipeline,
+## and there is no '!' before audiotestsrc
+gst-launch-1.0 -e videotestsrc ! videoconvert \
+ ! video/x-raw, format=NV12, width=960, height=540 \
+ ! rawvideoparse use-sink-caps=true ! omxh264enc ! h264parse \
+ ! avmux_mp4 name=mux ! filesink location=t_h264.mp4 \
+ audiotestsrc ! lamemp3enc ! mux.
+
+# change container from mkv to mp4 with h264 stream
+## this means demux a mkv file then mux video and audio stream to mp4 file
+gst-launch-1.0 filesrc location=test_h264.mkv \
+ ! matroskademux name=demux mp4mux force-create-timecode-trak=true name=mux ! filesink location=t_h264.mp4 \
+ demux.video_0 ! queue ! video/x-h264 ! mux. \
+ demux.audio_0 ! queue ! audio/mpeg ! mux.
+
+You can use command v4l2-ctl
, which is included in package v4l-utils
to get information of your camera.
For more information, read this article
+# h264 hardware encode from camera to file
+gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert \
+ ! video/x-raw, format=NV12,width=640,height=480 \
+ ! rawvideoparse format=nv12 width=640 height=480 \
+ ! omxh264enc ! h264parse ! filesink location=test.mp4 -e
+
+
+# capture camera and stream to other machine
+
+## source
+gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! videorate \
+ ! video/x-raw, format=NV12,width=640,height=480,framerate=20/1 \
+ ! rawvideoparse format=nv12 width=640 height=480 framerate=20/1 \
+ ! omxh264enc ! h264parse config-interval=1 ! video/x-h264,stream-format=byte-stream,alignment=nal \
+ ! rtph264pay ! udpsink host=192.168.31.27 port=5600
+
+## destination
+gst-launch-1.0 udpsrc port=5600 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' \
+ ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink
+
+gst-inspect-1.0
is a tool to print info about a GStreamer element(factory), which is included in gstreamer1.0-tools
.
# print the GStreamer element list with a 'less' like paing filter.
+gst-inspect-1.0
+
+# print info of the element
+gst-inspect-1.0 <element_name>
+
+gst-discover-1.0
is a tool to show info about the media file, which is inclucded in gstreamer1.0-plugins-base-apps
.
gst-discoverer-1.0 -v test.mp4
+
+If you are tired of manually build pipeline for playback by hand. You can use gst-play-1.0
as an alternative, which is included in gstreamer1.0-plugins-base-apps
.
# play media file
+gst-play-1.0 test.mp4
+
+# play media file with specific sink
+gst-play-1.0 --videosink=glimagesink --audiosink=alsasink
+
+Left button and right button can be used to seek. For more info, please read this article.
+To get the cap info or property of an element, you may need to run gst-inspect-1.0 <element_name>
. If gst-inspect-1.0
command not found, install gstreamer1.0-tools
.
If you want to debug GStreamer, refer to the articles below. +https://gstreamer.freedesktop.org/documentation/tutorials/basic/debugging-tools.html +https://gstreamer.freedesktop.org/documentation/gstreamer/running.html?gi-language=c
+Here is a simple command-line pipeline.
+gst-launch-1.0 videotestsrc ! autovideosink
+
+!
represent a link. The established pipeline looks like
videotestsrc => autovideosink
+
+There are several properties in videotestsrc, which could be lookup by gst-inspect-1.0 videotestsrc
.Set some properties:
gst-launch-1.0 videotestsrc pattern=ball flip=true ! autovideosink
+
+NAME=VALUE
is a property. pattern
and flip
are properties of videotestsrc.
Sometimes we need to control the behavior of gst-launch-1.0
.
GST_DEBUG=3 gst-launch-1.0 videotestsrc pattern=ball flip=true ! autovideosink
+gst-launch-1.0 videotestsrc pattern=ball flip=true ! autovideosink --gst-debug-level=3
+
+There are two ways to achieve this goal. One is setting environment variable. Another one is passing command-line argument to gst-launch-1.0
. GST_DEBUG=3
and --gst-debug-level=3
have the same meaning.
In most video decoding cases, there is a video-stream and an audio stream. We need to use demuxer to seperate them. Demuxer usually have several src pad. Here is an example.
+gst-launch-1.0 filesrc location=test-video.mp4 ! qtdemux name=demux demux. ! queue ! h264parse ! omxh264dec ! glimagesink demux. ! queue ! aacparse ! avdec_aac ! audioconvert ! alsasink
+
+It is hard to read. Add some word wrap:
+gst-launch-1.0 filesrc location=test-video.mp4 ! qtdemux name=demux \
+ demux. ! queue ! h264parse ! omxh264dec ! glimagesink \
+ demux. ! queue ! aacparse ! avdec_aac ! audioconvert ! pulsesink
+
+Here we use a demuxer to seperate video and audio, the grammer is:
+... demuxer name=DEMUXER_NAME \
+DEMUXER_NAME.PIPELINE_NAME_1 ! queue ! ...(the remaining part of pipeline 1) \
+DEMUXER_NAME.PIPELINE_NAME_2 ! queue ! ...(the remaining part of pipeline 2)
+
+Sometimes we need to set certain properties of the stream at certain nodes in the pipeline, e.g set resolution of the videostream of the videotestsrc
.
gst-launch-1.0 videotestsrc ! video/x-raw, width=800, height=600 ! glimagesink
+
+We negotiated the pad properties between videotestsrc
and glimagesink
. The property names and values must be supported by both element. You can find them in Pad Templates
section of gst-inspect-1.0
.
适用SDK v1.1.2
+PTG 的 OpenMAX IL 库(下称 vpu-omxil
)可使 LicheePi 4A 能够流畅硬解码 4k 60fps 的视频,那么具体应该如何使用该库呢?本文将主要介绍 LicheePi 4A 开发板上 Parole 播放器的集成与使用,用户可根据本文来了解在 LicheePi 4A 上的适配过程
+以 h264 的硬解为例,视频硬解的工作流程如图所示
+-------------------------------------------+
+ | +------------+ +------------+ | +--------+
+video stream----+--->| omxh264dec +------>| video-sink +----+-->| player |
+ | +------+-----+ +------------+ | +--------+
+ | | GStreamer |
+ +-----------+-------------------------------+
+ |
+ +-----v-----+
+ | vpu-omxil |
+ +-----+-----+
+ |
+ |
+ +-------v-------+
+ | kernel module |
+ | (driver) |
+ +-------+-------+
+ |
+ v
+ hardware
+
+omxh264dec
中将 omxh264 解码的部分单独拎出来,大体的结构如下
+ +---+------------+----+
+ | +------------+ |
+ | | omxh264dec | |
+ | +------------+ |
+ | GStreamer |
+ +----------+----------+
+ |
+ +----+-----v-----+----+
+ | +-----------+ |
+ | | vpu-omxil | |
+ | +-----------+ |
+ | libomxil-bellagio |
+ +----------+----------+
+ |
++------------v------------+
+| - memalloc - vc8000 |
+| - hantrodec - vidmem |
+| kernel modules |
++------------+------------+
+ |
+ v
+ hardware
+
+我们依照自底向上的顺序构建图示的链条。 +本节的主要目的是使 omxh264dec 解码器能够运行,并不涉及到输出屏幕等内容。
+硬解码需要访问硬件,而访问硬件又需要驱动,所以需要编译并安装驱动
+PTG 提供的驱动源:
+https://github.com/revyos/vpu-vc8000e-kernel
+https://github.com/revyos/vpu-vc8000d-kernel
+https://github.com/revyos/video_memory
+revyos/thead-kernel 已经合并了上述三个内核模块, 使用revyos_defconfig 可以无需编译上述内核模块
+# depmod 分析可载入模块的依赖关系,在 /lib/modules/<kernel-version>中添加modules.dep文件,以便后续 modprobe 使用
+sudo depmod -a
+sudo modprobe vidmem vc8000 hantrodec memalloc
+
+## 如果 modprobe 安装有问题的话,可以尝试使用 insmod 安装
+#cd /usr/lib/modules/$(uname -r)
+#sudo insmod $(find . -name *vidmem.ko*)
+#sudo insmod $(find . -name *vc8000.ko*)
+#sudo insmod $(find . -name *hantrodec.ko*)
+#sudo insmod $(find . -name *memalloc.ko*)
+
+# 可选:设置开机加载模块
+echo -e "\nvidmem\nhantrodec\nmemalloc\nvc8000\n" | sudo tee -a /etc/modules > /dev/null
+
+安装内核模块后,/dev
目录下会出现 hantrodec
vidmem
vc8000
三个设备文件。默认情况下,用户对其没有访问权限,如果不修改权限的话,非 root 用户在打开 omxil 库时会报错。
# 生效一次
+cd /dev
+sudo chmod 666 hantrodec vidmem vc8000
+
+# 长期生效
+cat << EOF | sudo tee /lib/udev/rules.d/70-hantro.rules > /dev/null
+KERNEL=="vidmem", MODE="0666"
+KERNEL=="hantrodec", MODE="0666"
+KERNEL=="vc8000", MODE="0666"
+EOF
+
+如果要获取 RevyOS 特定版本的内核模块,可进入 revyos/thead-kernel ,并在 GitHub CI 中下载 artifacts
+首先,请将 vpu-omxil 下载并解压到 /usr/lib/omxil/中 +vpu-omxil_1.2.1.tar.gz +如下图所示, 需要
+vpu-omxil
中的 OpenMax 组件注册到 libomxil-bellagio
中gst-omx
(该包提供了 omxh264dec 解码器) 调用 libomxil-bellagio
的时候也需要知道调用的组件名称+---------+ +-------------------+ +-----------+
+| gst-omx +-->| libomxil-bellagio +-->| vpu-omxil |
++---------+ +-------------------+ +-----------+
+
+vpu-omxil
中的组件注册到 libomxil-bellagio
中sudo apt install libomxil-bellagio-bin libomxil-bellagio0
+# 注册组件
+omxregister-bellagio -v /usr/lib/omxil/
+
+使用 omxregister-bellagio 生成注册文件,默认路径为 ~/.omxregister
+th1520-vpu 利用了 debian 在 usr/lib/riscv64-linux-gnu/libomxil-bellagio0
安装之后
+触发自动注册行为 结果如下
cat /var/lib/libomxil-bellagio0/registry
+/usr/lib/riscv64-linux-gnu/libomxil-bellagio0/libOMX.hantro.H2.video.encoder.so
+ ==> OMX.hantro.H2.video.encoder ==> OMX.hantro.H2.video.encoder.avc:OMX.hantro.H2.video.encoder.hevc:
+/usr/lib/riscv64-linux-gnu/libomxil-bellagio0/libOMX.hantro.VC8000D.image.decoder.so
+ ==> OMX.hantro.VC8000D.image.decoder ==> OMX.hantro.VC8000D.image.decoder.jpeg:
+/usr/lib/riscv64-linux-gnu/libomxil-bellagio0/libOMX.hantro.H2.image.encoder.so
+ ==> OMX.hantro.H2.image.encoder ==> OMX.hantro.H2.image.encoder.jpeg:
+/usr/lib/riscv64-linux-gnu/libomxil-bellagio0/libOMX.hantro.VC8000D.video.decoder.so
+ ==> OMX.hantro.VC8000D.video.decoder ==> OMX.hantro.VC8000D.video.decoder.mpeg4:OMX.hantro.VC8000D.video.decoder.avc:OMX.hantro.VC8000D.video.decoder.avs:OMX.hantro.VC8000D.video.decoder.h263:OMX.hantro.VC8000D.video.decoder.wmv:OMX.hantro.VC8000D.video.decoder.vp6:OMX.hantro.VC8000D.video.decoder.vp8:OMX.hantro.VC8000D.video.decoder.jpeg:OMX.hantro.VC8000D.video.decoder.hevc:OMX.hantro.VC8000D.video.decoder.vp9:OMX.hantro.VC8000D.video.decoder.avs2:
+
+调整 gstomx.conf 的设置以使解码器 omxh264dec 调用正确的组件,具体请查看针对 gst-omx 的补丁
+gst-omx-01-add-libomxil-config.patch
+请查看 PTG 提供的针对 gst-omx 的 dmabuf 补丁 +gst-omx-02-set-dec-out-port-dmabuf.patch
+sudo apt install gstreamer1.0-omx-generic gstreamer1.0-omx-bellagio-config gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-gl gstreamer1.0-plugins-good gstreamer1.0-tools
+
+# 1 基本解码
+gst-launch-1.0 filesrc location=<test.mp4> ! qtdemux ! h264parse ! omxh264dec ! videoconvert ! fakesink sync=false
+# 2 在终端中显示 fps
+# 参考:https://stackoverflow.com/questions/73948308
+gst-launch-1.0 filesrc location=<test.mp4> ! qtdemux ! h264parse ! omxh264dec ! videoconvert ! fpsdisplaysink video-sink=fakesink text-overlay=false sync=false -v 2>&1
+
+fakesink
会把前面的视频流全部吞掉,不输出画面(因而不会在 video-sink 这一环节损失性能),但是结合fpsdisplaysink可以读取到解码的速度。正常日志如下:
Setting pipeline to PAUSED ...[DBGT]
+vc8kdec compiled without trace support (ENABLE_DBGT_TRACE switch not enabled)
+Pipeline is PREROLLING ...
+Redistribute latency...
+OMX ! decoder_get_parameter OMX_ErrorNoMore (2)
+Pipeline is PREROLLED ...
+Setting pipeline to PLAYING ...
+New clock: GstSystemClockRedistribute latency...
+0:01:39.5 / 0:01:49.4 (90.9 %)
+
+【TIP】如果有 [omxh264dec-omxh264dec0: Could not initialize supporting library.](https://gist.github.com/Sakura286/015fae6792e160268db7ad8a697dd2df)
等字样的报错,可以安装gst-omx
、libomxil-bellagio
与libc6
相关的 debug-symbol 包,使用 gdb
启动上述命令进行调试。调试时,先断DWLInit
,然后再断open
,具体看是打开哪个地方的时候出错了。
RevyOS 适配过程中对于初始化动态库失败找到了如下三种原因:
+omxregister-bellagio
注册 vpu-omxil/dev
目录下 hantrodec
vc8000
vidmem
等设备的权限video-sink
是视频流在整个 GStreamer pipeline 中的最后一步,其作用一般是将视频流输出到屏幕上。
+前文中fakesink
只是测试解码器是否正常工作的特殊 video-sink
,可选的 video-sink非常多,常见的有 autovideosink
,ximagesink
,xvimagesink
,fbdevsink
,waylandsink
,glimagesink
,gtkglsink
等,它们各在不同的插件包里,需要酌情安装:
video-sink | +所属包名 | +
---|---|
waylandsink | +gstreamer1.0-plugins-bad | +
fbdevsink | +gstreamer1.0-plugins-bad | +
autovideosink | +gstreamer1.0-plugins-good | +
gtkglsink | +gstreamer1.0-plugins-good | +
ximagesink | xvimagesink | +gstreamer1.0-plugins-base | +
glimagesink | +gstreamer1.0-plugins-base | gstreamer1.0-gl | +
【TIP】使用 gst-inspect-1.0 <video-sink-name>
来查看对应 video-sink 可用的选项
+【TIP】添加 --gst-debug-level=<lv>
来获得更多的输出日志,其中 <lv>
代表了从 1 到 6,啰嗦程度从低到高,建议在等级 4 及以下,否则日志会非常长
+请尝试不同的 video-sink ,并尝试不同的插件参数,以及给予不同的环境变量,直至找到可以流畅硬解 H264 的那一个。
**waylandsink**
:由于现在(20230720)RevyOS 采用了 Xfce 桌面,不可能支持 Wayland,故 waylandsink
从原理上无法使用**fbdevsink**
与**ximagesink**
:无法使用**xvimagesink**
:通过流水线图以及日志可以确定,playbin 或 autovideosink 会自动调用 xvimagesink,使用 perf 分析后可以发现,使用xvimagesink 不可避免地会进行大量的 memcpy 操作,严重降低解码性能;该问题在获得PTG的 dmabuf 补丁后依然存在,故无法使用**gtkglsink**
:GTK3 不支持 EGL on X11,而 RevyOS 目前基于 x11,且只支持 EGL,故无法使用剩下的只有glimagesink
,根据 Running and debugging GStreamer Applications,并观察其他使用到 glimagesink 的例子,可以猜测需要明确指定环境变量 GST_GL_API
与 GST_GL_PLATFORM
+由于 RevyOS 使用了 gles2+egl 的组合,使用如下的命令,成功硬解。
GST_GL_API=gles2 GST_GL_PLATFORM=egl gst-launch-1.0 filesrc location=<test.mp4> ! qtdemux ! h264parse ! omxh264dec ! videoconvert ! fpsdisplaysink video-sink=glimagesink sync=false
+
+然而 GStreamer 被播放器调用时是无法通过环境变量来传递参数的,所以构建 gst-plugins-base 时应当传递额外的 meson 编译参数:
+-Dgl_api=[\'gles2\'] -Dgl_platform=[\'egl\']
+
+GStreamer 的 pipeline 没有问题之后,就需要使播放器支持。不同播放器会使用到不同的 video-sink,同样对 gstreamer 有着不同程度的依赖。 +适配播放器时,最重要的工作便是①使播放器适配已验证的 video-sink,或者②使 gstreamer pipeline 支持播放器指定的 video-sink,此次 RevyOS 适配过程采用了①方案。
+ +-------------------------------------------+
+ | +------------+ +------------+ | +--------+
+video stream----+--->| omxh264dec +------>| video-sink +----+-->| player |
+ | +------------+ +------------+ | +--------+
+ | GStreamer |
+ +-------------------------------------------+
+
+根据 https://gstreamer.freedesktop.org/apps/ 进行简单的排查
+是否可用 | +是否更新 | +应用名 | +备注 | +
---|---|---|---|
❌ | ++ | Gnash | +Flash 播放器 | +
❌ | ++ | GEntrans | +Debian 未收录 | +
❓ | +20230226 | +Kaffeine | +❌ 需要大量 KDE 相关组件 | +
+ | + | + | ✔️ 存在于riscv64 仓库中 | +
+ | + | + | ❌ 在 Debian amd64 Gnome 上,播放窗口与控制窗口分离,且默认调用了 VLC 进行播放 | +
❌ | ++ | Lcdgrilo | +Debian 未收录 | +
✔️ | +20230218 | +Parole | +✔️ For XFCE | +
+ | + | + | ❓ 不支持 Wayland,仅支持 x11 | +
+ | + | + | ✔️ Debian amd64 Gnome 验证通过 | +
+ | + | + | ✔️ 存在于riscv64 仓库 中 | +
❌ | ++ | Songbird | +Debian 未收录 | +
❌ | ++ | Snappy | +Debian 未收录 | +
❌ | ++ | Totem | +需要 GTK3,然而 GTK3 不支持 EGL on X11 | +
最初选择的播放器是 Totem,但是发现 Totem 无法指定除了 gtkglsink 以外的 video-sink,且由于 RevyOS 不支持 gtkglsink,所以支持 Totem 播放器的难度较大。 +对支持 GStreamer 的播放器进行排查后发现了 Parole , Parole 由 GObject 编写,与常见的面向对象编程略有区别。寻找其构建 parole_gst 对象时的方法 parole_gst_constructed,将 video-sink 属性设置为前文已验证的 glimagesink,补丁:
+parole-01-add-glimagesink-support.patch
+至此,粗略的适配工作完成。
+补丁集合:
+https://gist.github.com/Sakura286/26777ea8204c1819885e093806a4f7ca
+PTG omxil 库
+https://drive.google.com/file/d/1pYgCVI7WltfpskltJ-RqzVUCEC21FS56
+ + + + + + +测试网站地址:https://webglsamples.org/aquarium/aquarium.html
+直接打开即可,左侧数字是渲染的鱼的数量,数量越多越占性能
+ + + + + + + +CoreMark是一个综合基准,用于测量嵌入式系统中使用的中央处理器(CPU)的性能。它是在2009由eembc的shay gal-on开发的,旨在成为一个行业标准,取代过时的dehrystone基准。代码用C编写,包含以下算法:列表处理(增删改查和排序)、矩阵操作(公共矩阵操作)、状态机(确定输入流是否包含有效数字)和CRC。用户可以自由的下载Coremark,并移植到自己的平台上运行,随后就可以看到分数。
+├── barebones --移植到裸机环境下需要修改的目录
+│ ├── core_portme.c --移植的目标平台配置信息
+│ ├── core_portme.h --计时以及板级初始化实现
+│ ├── core_portme.mak --该子目录的makefile
+│ ├── cvt.c
+│ └── ee_printf.c --打印函数串口发送实现
+├── core_list_join.c --列表操作程序
+├── core_main.c --主程序
+├── coremark.h --项目配置与数据结构的定义头文件
+├── coremark.md5
+├── core_matrix.c --矩阵运算程序
+├── core_state.c --状态机控制程序
+├── core_util.c --CRC计算程序
+├── cygwin --x86 cygwin和gcc 3.4(四核,双核和单核系统)的测试代码
+│ ├── core_portme.c
+│ ├── core_portme.h
+│ └── core_portme.mak
+├── freebsd --以下同理,是在不同操作系统下的测试代码
+│ ├── ...
+├── LICENSE.md
+├── linux
+│ ├── ...
+├── linux64
+│ ├── ...
+├── macos
+│ ├── ...
+├── Makefile
+├── README.md --自述文件,CoreMark项目的基本介绍
+├── rtems
+│ ├── ...
+└── simple
+ ├── ...
+ └──
+
+根据 README 说法,只需要在 coremark 文件夹下执行 make 即可进行编译与测试。测试结果会出现在 Results 文件夹中,其中 run1.log 是测试结果。
+coremark 总体测试时间较短。 +计划同时测试 10 次取平均数值。
+$ git clone https://github.com/eembc/coremark.git
+$ cd coremark
+$ make
+
+2K performance run parameters for coremark.
+CoreMark Size : 666
+Total ticks : 12915
+Total time (secs): 12.915000
+Iterations/Sec : 8517.228029
+Iterations : 110000
+Compiler version : GCC13.1.0
+Compiler flags : -O2 -DPERFORMANCE_RUN=1 -lrt
+Memory location : Please put data memory location here
+ (e.g. code in flash, data on heap etc)
+seedcrc : 0xe9f5
+[0]crclist : 0xe714
+[0]crcmatrix : 0x1fd7
+[0]crcstate : 0x8e3a
+[0]crcfinal : 0x33ff
+Correct operation validated. See README.md for run and reporting rules.
+CoreMark 1.0 : 8517.228029 / GCC13.1.0 -O2 -DPERFORMANCE_RUN=1 -lrt / Heap
+
+
+make XCFLAGS="-march=rv64gv0p7_zfh_xtheadc -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -msignedness-cmpiv -fno-code-hoisting -mno-thread-jumps1 -mno-iv-adjust-addr-cost -mno-expand-split-imm"
+
+2K performance run parameters for coremark.
+CoreMark Size : 666
+Total ticks : 15129
+Total time (secs): 15.129000
+Iterations/Sec : 13219.644392
+Iterations : 200000
+Compiler version : GCC10.4.0
+Compiler flags : -O2 -march=rv64gv0p7_zfh_xtheadc -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -msignedness-cmpiv -fno-code-hoisting -mno-thread-jumps1 -mno-iv-adjust-addr-cost -mno-expand-split-imm -DPERFORMANCE_RUN=1 -lrt
+Memory location : Please put data memory location here
+ (e.g. code in flash, data on heap etc)
+seedcrc : 0xe9f5
+[0]crclist : 0xe714
+[0]crcmatrix : 0x1fd7
+[0]crcstate : 0x8e3a
+[0]crcfinal : 0x4983
+Correct operation validated. See README.md for run and reporting rules.
+CoreMark 1.0 : 13219.644392 / GCC10.4.0 -O2 -march=rv64gv0p7_zfh_xtheadc -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -msignedness-cmpiv -fno-code-hoisting -mno-thread-jumps1 -mno-iv-adjust-addr-cost -mno-expand-split-imm -DPERFORMANCE_RUN=1 -lrt / Heap
+
+make XCFLAGS="-march=rv64imafd_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -fno-code-hoisting -mno-thread-jumps"
+
+2K performance run parameters for coremark.
+CoreMark Size : 666
+Total ticks : 11897
+Total time (secs): 11.897000
+Iterations/Sec : 9246.028411
+Iterations : 110000
+Compiler version : GCC13.1.0
+Compiler flags : -O2 -march=rv64imafd_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -fno-code-hoisting -DPERFORMANCE_RUN=1 -lrt
+Memory location : Please put data memory location here
+ (e.g. code in flash, data on heap etc)
+seedcrc : 0xe9f5
+[0]crclist : 0xe714
+[0]crcmatrix : 0x1fd7
+[0]crcstate : 0x8e3a
+[0]crcfinal : 0x33ff
+Correct operation validated. See README.md for run and reporting rules.
+CoreMark 1.0 : 9246.028411 / GCC13.1.0 -O2 -march=rv64imafd_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync -O3 -funroll-all-loops -finline-limit=500 -fgcse-sm -fno-schedule-insns -fno-code-hoisting -DPERFORMANCE_RUN=1 -lrt / Heap
+
+
+
+
+
+
+
+ glmark2 是基于 OpenGL 2.0 以及 ES 2.0 的一个性能测试.
+此处我们只使用 glmark2-es2 ,软件包已经预装在RevyOS中,用于 x11-glesv2 的测试.
+th1520
只支持 glmark-es2.
开始之前我们需要调整芯片进入高性能模式,在终端中执行下述命令即可,需要使用 sudo
或者root账户.
echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
+
+cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq
+
+如果在执行之后看到 "1848000" 数字,则表明已经调整至性能模式,可以继续向下操作.
+使用任意账户登陆系统,打开终端输入 glmark2-es2
,需要将HDMI连接到显示器,请勿通过SSH连接执行.
输入命令后,桌面上会出现一个有图形活动的新窗口。
+测试完成后,额外窗口会消失,分数会以 glmark2 Score: xxx
的形式输出在终端中。
测试示例:
+debian@lpi4a:~/Desktop$ glmark2-es2
+=======================================================
+ glmark2 2021.12
+=======================================================
+ OpenGL Information
+ GL_VENDOR: Imagination Technologies
+ GL_RENDERER: PowerVR B-Series BXM-4-64
+ GL_VERSION: OpenGL ES 3.2 build 1.17@6210866
+ Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=8
+ Surface Size: 800x600 windowed
+=======================================================
+[build] use-vbo=false: FPS: 513 FrameTime: 1.949 ms
+[build] use-vbo=true: FPS: 1367 FrameTime: 0.732 ms
+[texture] texture-filter=nearest: FPS: 1449 FrameTime: 0.690 ms
+[texture] texture-filter=linear: FPS: 1454 FrameTime: 0.688 ms
+[texture] texture-filter=mipmap: FPS: 1453 FrameTime: 0.688 ms
+[shading] shading=gouraud: FPS: 1172 FrameTime: 0.853 ms
+[shading] shading=blinn-phong-inf: FPS: 1180 FrameTime: 0.847 ms
+[shading] shading=phong: FPS: 1002 FrameTime: 0.998 ms
+[shading] shading=cel: FPS: 979 FrameTime: 1.021 ms
+[bump] bump-render=high-poly: FPS: 700 FrameTime: 1.429 ms
+[bump] bump-render=normals: FPS: 1354 FrameTime: 0.739 ms
+[bump] bump-render=height: FPS: 1320 FrameTime: 0.758 ms
+[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 1059 FrameTime: 0.944 ms
+[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 381 FrameTime: 2.625 ms
+[pulsar] light=false:quads=5:texture=false: FPS: 1484 FrameTime: 0.674 ms
+[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 349 FrameTime: 2.865 ms
+[desktop] effect=shadow:windows=4: FPS: 736 FrameTime: 1.359 ms
+[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 161 FrameTime: 6.211 ms
+[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 173 FrameTime: 5.780 ms
+[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 242 FrameTime: 4.132 ms
+[ideas] speed=duration: FPS: 593 FrameTime: 1.686 ms
+[jellyfish] <default>: FPS: 572 FrameTime: 1.748 ms
+[terrain] <default>: FPS: 42 FrameTime: 23.810 ms
+[shadow] <default>: FPS: 619 FrameTime: 1.616 ms
+[refract] <default>: FPS: 82 FrameTime: 12.195 ms
+[conditionals] fragment-steps=0:vertex-steps=0: FPS: 1539 FrameTime: 0.650 ms
+[conditionals] fragment-steps=5:vertex-steps=0: FPS: 1238 FrameTime: 0.808 ms
+[conditionals] fragment-steps=0:vertex-steps=5: FPS: 1535 FrameTime: 0.651 ms
+[function] fragment-complexity=low:fragment-steps=5: FPS: 1411 FrameTime: 0.709 ms
+[function] fragment-complexity=medium:fragment-steps=5: FPS: 1050 FrameTime: 0.952 ms
+[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 1376 FrameTime: 0.727 ms
+[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 1394 FrameTime: 0.717 ms
+[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 1379 FrameTime: 0.725 ms
+=======================================================
+ glmark2 Score: 950
+=======================================================
+
+
+
+
+
+
+
+
+ ++lmbench for revyOS
+
带宽测评工具 | +反应时间测评工具 | +其他 | +
---|---|---|
读取缓存文件 | +上下文切换 | +\ | +
拷贝内存 | +网络:连接的建立,管道,TCP,UDP 和RPC hot potato | +\ | +
读内存 | +文件系统的建立和删除 | +\ | +
写内存 | +进程创建 | +处理器时钟比率计算 | +
管道 | +信号处理 | +\ | +
TCP | +上层的系统调用 | +\ | +
\ | +内存读入反应时间 | +\ | +
下载测试工具:
+git clone https://github.com/revyos/lmbench3.git
+
+++该版本为已为 RevyOS 移植版本。
+
在开始测试前,需要先安装依赖:
+sudo apt install gcc make libntirpc-dev -y
+
+执行命令进行编译,配置,并测试
+cd lmbench3
+cd src
+make results
+
+编译完成后会有以下选项提示需要设置:
+以下不需要更改的项目直接回车,会自动设置默认值。
+MULTIPLE COPIES [default 1]
: 设置同时运行 lmbench 的份数,份数多会使 lmbench 运行缓慢,默认是 1,这里设置为默认值 1。
=====================================================================
+
+If you are running on an MP machine and you want to try running
+multiple copies of lmbench in parallel, you can specify how many here.
+
+Using this option will make the benchmark run 100x slower (sorry).
+
+NOTE: WARNING! This feature is experimental and many results are
+ known to be incorrect or random!
+
+MULTIPLE COPIES [default 1]:
+=====================================================================
+
+Job placement selection [default 1]
: 作业调度控制方法,默认值是 1,表示允许作业调度,这里设置为默认值。
=====================================================================
+
+Options to control job placement
+1) Allow scheduler to place jobs
+2) Assign each benchmark process with any attendent child processes
+ to its own processor
+3) Assign each benchmark process with any attendent child processes
+ to its own processor, except that it will be as far as possible
+ from other processes
+4) Assign each benchmark and attendent processes to their own
+ processors
+5) Assign each benchmark and attendent processes to their own
+ processors, except that they will be as far as possible from
+ each other and other processes
+6) Custom placement: you assign each benchmark process with attendent
+ child processes to processors
+7) Custom placement: you assign each benchmark and attendent
+ processes to processors
+
+Note: some benchmarks, such as bw_pipe, create attendent child
+processes for each benchmark process. For example, bw_pipe
+needs a second process to send data down the pipe to be read
+by the benchmark process. If you have three copies of the
+benchmark process running, then you actually have six processes;
+three attendent child processes sending data down the pipes and
+three benchmark processes reading data and doing the measurements.
+
+Job placement selection [default 1]:
+=====================================================================
+
+Memory
: 设置测试内存大小,默认是 $MB
, 即为程序计算出来的最大可测试内存,也可以手动定义测试值,这里设置为这里使用默认值。
=====================================================================
+
+Several benchmarks operate on a range of memory. This memory should be
+sized such that it is at least 4 times as big as the external cache[s]
+on your system. It should be no more than 80% of your physical memory.
+
+The bigger the range, the more accurate the results, but larger sizes
+take somewhat longer to run the benchmark.
+
+MB [default 686]:
+Checking to see if you have 686 MB; please wait for a moment...
+686MB OK
+686MB OK
+686MB OK
+Hang on, we are calculating your cache line size.
+OK, it looks like your cache line is 64 bytes.
+
+=====================================================================
+
+SUBSET (ALL|HARWARE|OS|DEVELOPMENT) [default all]
: 要运行的测试集,包含 ALL/HARWARE/OS/DEVELOPMENT
,默认选 all
,这里选 all
。
=====================================================================
+
+lmbench measures a wide variety of system performance, and the full suite
+of benchmarks can take a long time on some platforms. Consequently, we
+offer the capability to run only predefined subsets of benchmarks, one
+for operating system specific benchmarks and one for hardware specific
+benchmarks. We also offer the option of running only selected benchmarks
+which is useful during operating system development.
+
+Please remember that if you intend to publish the results you either need
+to do a full run or one of the predefined OS or hardware subsets.
+
+SUBSET (ALL|HARWARE|OS|DEVELOPMENT) [default all]:
+=====================================================================
+
+FASTMEM [default no]
: 内存 latency
测试,如果跳过该测试,则设置为 yes
,如果不跳过则设置为 no
,默认是 no
,这里设置为默认值。
=====================================================================
+
+This benchmark measures, by default, memory latency for a number of
+different strides. That can take a long time and is most useful if you
+are trying to figure out your cache line size or if your cache line size
+is greater than 128 bytes.
+
+If you are planning on sending in these results, please don't do a fast
+run.
+
+Answering yes means that we measure memory latency with a 128 byte stride.
+
+FASTMEM [default no]:
+=====================================================================
+
+SLOWFS [default no]
: 文件系统 latency
测试,如果跳过值设置为 yes
,不跳过设置为 no
,默认 no
,这里设置为默认值。
=====================================================================
+
+This benchmark measures, by default, file system latency. That can
+take a long time on systems with old style file systems (i.e., UFS,
+FFS, etc.). Linux' ext2fs and Sun's tmpfs are fast enough that this
+test is not painful.
+
+If you are planning on sending in these results, please don't do a fast
+run.
+
+If you want to skip the file system latency tests, answer "yes" below.
+
+SLOWFS [default no]:
+=====================================================================
+
+DISKS [default none]
: 硬盘带宽和 seek time
,需要设置测试硬盘的盘符,例如 /dev/sda
,默认不测试(默认 none ),这里设置为默认值。
=====================================================================
+
+This benchmark can measure disk zone bandwidths and seek times. These can
+be turned into whizzy graphs that pretty much tell you everything you might
+need to know about the performance of your disk.
+
+This takes a while and requires read access to a disk drive.
+Write is not measured, see disk.c to see how if you want to do so.
+
+If you want to skip the disk tests, hit return below.
+
+If you want to include disk tests, then specify the path to the disk
+device, such as /dev/sda. For each disk that is readable, you'll be
+prompted for a one line description of the drive, i.e.,
+
+ Iomega IDE ZIP
+or
+ HP C3725S 2GB on 10MB/sec NCR SCSI bus
+
+DISKS [default none]:
+=====================================================================
+
+REMOTE [default none]
: 网络测试,需要 2
台机器并设置 rsh
,是测试机器能 rsh
访问另一台,默认不测试(默认 none ),这里设置为默认值。
=====================================================================
+
+If you are running on an idle network and there are other, identically
+configured systems, on the same wire (no gateway between you and them),
+and you have rsh access to them, then you should run the network part
+of the benchmarks to them. Please specify any such systems as a space
+separated list such as: ether-host fddi-host hippi-host.
+
+REMOTE [default none]:
+=====================================================================
+
+Processor mhz [default 999 MHz, 1.0010 nanosec clock]
: 测试 cpu
,默认 $MHZ
,即为程序判断出的频率,也可以根据情况自己设定,例如 3500,单位 MHz
,这里设置为默认值。
=====================================================================
+
+Calculating mhz, please wait for a moment...
+I think your CPU mhz is
+
+ 999 MHz, 1.0010 nanosec clock
+
+but I am frequently wrong. If that is the wrong Mhz, type in your
+best guess as to your processor speed. It doesn't have to be exact,
+but if you know it is around 800, say 800.
+
+Please note that some processors, such as the P4, have a core which
+is double-clocked, so on those processors the reported clock speed
+will be roughly double the advertised clock rate. For example, a
+1.8GHz P4 may be reported as a 3592MHz processor.
+
+Processor mhz [default 999 MHz, 1.0010 nanosec clock]:
+=====================================================================
+
+FSDIR [default /usr/tmp]
: 临时目录用来存放测试文件,可以自己设定,默认 /usr/tmp
,这里设置为默认值。
=====================================================================
+
+We need a place to store a 686 Mbyte file as well as create and delete a
+large number of small files. We default to /usr/tmp. If /usr/tmp is a
+memory resident file system (i.e., tmpfs), pick a different place.
+Please specify a directory that has enough space and is a local file
+system.
+
+FSDIR [default /usr/tmp]:
+=====================================================================
+
+Status output file [default /dev/tty]
: 测试输出信息文件存放目录,可以自己设定,默认 /dev/tty
。
=====================================================================
+
+lmbench outputs status information as it runs various benchmarks.
+By default this output is sent to /dev/tty, but you may redirect
+it to any file you wish (such as /dev/null...).
+
+Status output file [default /dev/tty]:
+=====================================================================
+
+Mail results [default yes]
: 是否将测试结果邮件发出来,默认是 yes
,这里设置为 no
。
=====================================================================
+
+There is a database of benchmark results that is shipped with new
+releases of lmbench. Your results can be included in the database
+if you wish. The more results the better, especially if they include
+remote networking. If your results are interesting, i.e., for a new
+fast box, they may be made available on the lmbench web page, which is
+
+ http://www.bitmover.com/lmbench
+
+Mail results [default yes]: no
+OK, no results mailed.
+=====================================================================
+
+以上项目设置完成后,开始自动执行测试。
+p7zip 测试是用于测试系统解压性能,通过数据直观评估性能,以下是运行 7pzip 测试的操作步骤
+首先需要在 RevyOS 中 安装 p7zip
+debian@lpi4a:~/Desktop$ sudo apt update
+debian@lpi4a:~/Desktop$ sudo apt install p7zip-full
+
+进行 p7zip 测试需要在终端中输入以下命令来执行:
+debian@lpi4a:~/Desktop$ 7z b
+
+系统会开始进行测试然后输出性能数据。
+通过以上步骤,可以在 RevyOS 上安装并测试 7zip 的性能。
+以下是测试结果参考,使用镜像版本为RevyOS2023121016g版本
+debian@lpi4a:~/Desktop$ 7z b
+
+7-Zip 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
+p7zip Version 16.02 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs LE)
+
+LE
+CPU Freq: - 64000000 64000000 - - - - - -
+
+RAM size: 15739 MB, # CPU hardware threads: 4
+RAM usage: 882 MB, # Benchmark threads: 4
+
+ Compressing | Decompressing
+Dict Speed Usage R/U Rating | Speed Usage R/U Rating
+ KiB/s % MIPS MIPS | KiB/s % MIPS MIPS
+
+22: 3252 303 1045 3164 | 75268 394 1628 6422
+23: 3092 307 1025 3151 | 74514 399 1617 6447
+24: 3021 318 1022 3249 | 72017 398 1588 6322
+25: 2945 320 1050 3363 | 67801 395 1529 6034
+---------------------------------- | ------------------------------
+Avr: 312 1036 3232 | 396 1591 6306
+Tot: 354 1313 4769
+
+
+
+
+
+
+
+ 使用脚本对整机进行重启测试。
+测试机器重启会不会出现死机等问题。
+进行重启测试 500 次。
+在 /lib/system/system 下创建名为 cycletest.service_ 重启脚本:
+[Unit]
+Description=Reboots unit after 30s
+
+[Service]
+StandardOutput=syslog+console
+ExecStart=/bin/sh -c "\
+test -f /cycle-count || echo 0 > /cycle-count;\
+echo 'starting cycletest';\
+sleep 30;\
+expr `cat /cycle-count` + 1 > /cycle-count;\
+systemctl reboot;\
+"
+
+[Install]
+WantedBy=multi-user.target
+
+后根据以下指令安装并开始测试:
+systemctl daemon-reload
+systemctl enable cycletest.service (enable the service to start on reboot)
+systemctl start cycletest.service (start the service, should reboot in 30s)
+
+
+
+
+
+
+
+ STREAM 基准测试是一个简单的综合基准测试程序,它测量可持续内存带宽(以 MB/s 为单位)和简单向量内核的相应计算速率。
+stream 仅有单个文件,在进行测试时只需要对 stream.c
进行编译即可:
git clone <https://github.com/microseyuyu/STREAM.git>
+cd STREAM
+gcc -O3 -fopenmp -DN=2000000 -DNTIMES=10 stream.c -o stream
+export OMP_NUM_THREADS=8
+./stream
+
+参数说明:
+DN=2000000:指定测试数组a[]、b[]、c[]的大小(Array size)。该值对测试结果影响较大(5.9版本默认值2000000,。若stream.c为5.10版本,参数名变为-DSTREAM_ARRAY_SIZE,默认值10000000)。注意:必须设置测试数组大小远大于CPU 最高级缓存(一般为L3 Cache)的大小,否则就是测试CPU缓存的吞吐性能,而非内存吞吐性能。 +- -DNTIMES=10:执行的次数,并从这些结果中选最优值。 +- OMP_NUM_THREADS=8 线程数量。
+参考结果:
+debian@lpi4a:~/Desktop/STREAM$ ./stream
+-------------------------------------------------------------
+STREAM version $Revision: 5.10 $
+-------------------------------------------------------------
+This system uses 8 bytes per array element.
+-------------------------------------------------------------
+***** WARNING: ******
+ It appears that you set the preprocessor variable N when compiling this code.
+ This version of the code uses the preprocesor variable STREAM_ARRAY_SIZE to control the array size
+ Reverting to default value of STREAM_ARRAY_SIZE=10000000
+***** WARNING: ******
+Array size = 10000000 (elements), Offset = 0 (elements)
+Memory per array = 76.3 MiB (= 0.1 GiB).
+Total memory required = 228.9 MiB (= 0.2 GiB).
+Each kernel will be executed 10 times.
+ The *best* time for each kernel (excluding the first iteration)
+ will be used to compute the reported bandwidth.
+-------------------------------------------------------------
+Number of Threads requested = 8
+Number of Threads counted = 8
+-------------------------------------------------------------
+Your clock granularity/precision appears to be 1 microseconds.
+Each test below will take on the order of 21622 microseconds.
+ (= 21622 clock ticks)
+Increase the size of the arrays if this shows that
+you are not getting at least 20 clock ticks per test.
+-------------------------------------------------------------
+WARNING -- The above is only a rough guideline.
+For best results, please be sure you know the
+precision of your system timer.
+-------------------------------------------------------------
+Function Best Rate MB/s Avg time Min time Max time
+Copy: 8364.2 0.019258 0.019129 0.019508
+Scale: 8291.0 0.019572 0.019298 0.020162
+Add: 6223.6 0.038835 0.038563 0.040011
+Triad: 6222.5 0.038776 0.038570 0.039470
+-------------------------------------------------------------
+Solution Validates: avg error less than 1.000000e-13 on all three arrays
+-------------------------------------------------------------
+
+
+
+
+
+
+
+ # qemu-user 下编译
+sudo apt update
+sudo apt install -y \
+ sbuild buildd qemu-system-misc qemu-user-static binfmt-support \
+ ca-certificates apt-transport-https devscripts mmdebstrap
+
+# native
+sudo apt install -y \
+ sbuild buildd ca-certificates apt-transport-https devscripts mmdebstrap
+
+# 修正宿主的debian-ports证书相关问题 现阶段可能不需要了
+wget https://mirror.sjtu.edu.cn/debian/pool/main/d/debian-ports-archive-keyring/debian-ports-archive-keyring_2023.02.01_all.deb
+sudo dpkg -i ./debian-ports-archive-keyring_2023.02.01_all.deb
+
+
+# sbuild 增加当前用户免root
+sudo sbuild-adduser $USER
+
+export SUFFIX=revyos-c910v-sbuild
+sudo sbuild-createchroot --debootstrap=debootstrap --arch=riscv64 \
+ --chroot-suffix=-$SUFFIX \
+ --keyring='' \
+ --no-deb-src \
+ --include=debian-ports-archive-keyring,ca-certificates,apt-transport-https,eatmydata \
+ --extra-repository="deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-c910v/ revyos-c910v main contrib non-free" \
+ --extra-repository="deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-addons/ revyos-addons main" \
+ sid /srv/chroot/sid-riscv64-$SUFFIX \
+ https://mirror.iscas.ac.cn/revyos/revyos-base/
+
+# 修正环境相关问题
+sudo sed -i 's/deb http/deb [trusted=yes] http/g' /srv/chroot/sid-riscv64-$SUFFIX/etc/apt/sources.list
+sudo rm -rf /srv/chroot/sid-riscv64-$SUFFIX/var/lib/apt/lists/*
+echo "command-prefix=eatmydata" | sudo tee -a /etc/schroot/chroot.d/sid-riscv64-$SUFFIX-*
+
+# 调整source顺序 - 目的是同版本使用c910v仓库的
+# 编辑sources.list 确保以下顺序
+deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-c910v/ revyos-c910v main contrib non-free
+deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-addons/ revyos-addons main
+deb [trusted=yes] https://mirror.iscas.ac.cn/revyos/revyos-base/ sid main contrib non-free non-free-firmware
+
+sbuild --arch=riscv64 -d sid -c sid-riscv64-revyos-c910v-sbuild xxx.dsc
+
+
+
+
+
+
+
+ 实验性 feature
如果发现问题可以进行issue申报
# 增加优化源
+sudo sed -i '1ideb https://mirror.iscas.ac.cn/revyos/revyos-c910v/ revyos-c910v main' /etc/apt/sources.list
+# 更新软件
+sudo apt update && sudo apt upgrade -y
+# 安装 gcc-10/gcc-13
+sudo apt install -y build-essential gcc-13 g++-13
+# 重启避免其他问题
+sudo reboot
+
+gcc -v
+Using built-in specs.
+COLLECT_GCC=gcc
+COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/10/lto-wrapper
+Target: riscv64-linux-gnu
+Configured with: ../src/configure -v --with-pkgversion='Debian 10.4.0-8revyos2.3' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=riscv64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libsanitizer --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --disable-multilib --with-arch=rv64gcv0p7_zfh_xtheadc --with-abi=lp64d --enable-checking=release --build=riscv64-linux-gnu --host=riscv64-linux-gnu --target=riscv64-linux-gnu
+Thread model: posix
+Supported LTO compression algorithms: zlib zstd
+gcc version 10.4.0 (Debian 10.4.0-8revyos2.3)
+
+gcc-13 -v
+Using built-in specs.
+COLLECT_GCC=gcc-13
+COLLECT_LTO_WRAPPER=/usr/libexec/gcc/riscv64-linux-gnu/13/lto-wrapper
+Target: riscv64-linux-gnu
+Configured with: ../src/configure -v --with-pkgversion='Debian 13.2.0-1revyos1' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=riscv64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --disable-multilib --with-arch=rv64gc_zfh_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync --with-abi=lp64d --enable-checking=release --build=riscv64-linux-gnu --host=riscv64-linux-gnu --target=riscv64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=16
+Thread model: posix
+Supported LTO compression algorithms: zlib zstd
+gcc version 13.2.0 (Debian 13.2.0-1revyos1)
+
+除了v0p7 其他优化都可以用 gcc-13 代替 gcc-10
+后者的优化可以主线报问题 是已经主线化的功能
+ + + + + + +RevyOS 会预制相关优化编译器 基本支持rv64gc
支持的优化 | +gcc-10 | +gcc-13 | +clang-17 | +
---|---|---|---|
Zfh | +✅ | +✅ | +✅ | +
v0p7 | +✅ | +❌ | +❌ | +
xthead 当前版本 v2.2
+支持的优化1 | +gcc-102 | +gcc-13.2 | +clang-17 | +
---|---|---|---|
XTheadCmo | +✅ | +✅ | +✅ | +
XTheadSync | +✅ | +✅ | +✅ | +
XTheadBa | +✅ | +✅ | +✅ | +
XTheadBb | +✅ | +✅ | +✅ | +
XTheadBs | +✅ | +✅ | +✅ | +
XTheadCondMov | +✅ | +✅ | +✅ | +
XTheadMemIdx | +✅ | +✅ | +✅ | +
XTheadMemPair | +✅ | +✅ | +✅ | +
XTheadFMemIdx | +✅ | +✅ | +✅ | +
XTheadMac | +✅ | +✅ | +✅ | +
XTheadFmv | +✅ | +✅ | +❌ | +
XTheadInt | +✅ | +✅ | +❌ | +
XTHeadVdot3 | +✅ | +✅ | +✅ | +
注:
+首先确保安装gcc:
+sudo apt update
+sudo apt install gcc
+
+下面以最简单的 'hello,world' 程序为例演示如何编译并运行:
+编译以下内容并命名为 hello.c
:
#include <stdio.h>
+
+int main()
+{
+ printf("hello, world\n");
+ return 0;
+}
+
+编译并执行:
+debian@lpi4a:~/test$ gcc -g hello.c -o hello
+
+debian@lpi4a:~/test$ ./hello
+hello, world
+
+
+首先确保安装g++:
+sudo apt update
+sudo apt install g++
+
+下面以最简单的 'hello,world' 程序为例演示如何编译并运行:
+编译以下内容并命名为 hello.cpp
:
#include <iostream>
+using namespace std;
+
+int main()
+{
+ cout << "Hello, World!\n";
+ return 0;
+}
+
+
+编译并执行:
+debian@lpi4a:~/test$ g++ -g hello.cpp -o hello
+debian@lpi4a:~/test$ ./hello
+Hello, World!
+
+以上就是gcc/g++ 编译程序并运行的最简单实例,更复杂的应用案例可以参考相应的 +系统编程手册。
+ + + + + + +内核工具链下载地址:
+https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1663142514282/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz
+这里假设编译环境为 Ubuntu
或 Debian
安装依赖:
+sudo apt install -y gdisk dosfstools g++-12-riscv64-linux-gnu build-essential libncurses-dev gawk flex bison openssl libssl-dev tree dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf device-tree-compiler
+
+解压工具链(这里解压到/opt):
+tar -xvf Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz -C /opt
+
+设置环境变量,将工具链加入环境变量中(假设工具链放在/opt中):
+export PATH="/opt/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1/bin:$PATH"
+export CROSS_COMPILE=riscv64-unknown-linux-gnu-
+export ARCH=riscv
+
+使用git下载内核代码:
+# 内核仓库
+git clone https://github.com/revyos/thead-kernel.git
+
+编译内核:
+# 创建安装目标目录
+mkdir rootfs && mkdir rootfs/boot
+
+# 目录创建完成后,目录结构应该看起来是这样:
+# .. << 当前工作路径
+# |-- rootfs
+# |-- boot
+# |-- thead-kernel
+# |-- ...
+
+# 进入内核代码目录,开始构建
+cd thead-kernel
+make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv revyos_defconfig
+make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv -j$(nproc)
+make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv -j$(nproc) dtbs
+sudo make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv INSTALL_MOD_PATH=../rootfs/ modules_install -j$(nproc)
+sudo make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv INSTALL_PATH=../rootfs/boot zinstall -j$(nproc)
+# 构建perf(如果需要的话)
+make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv LDFLAGS=-static NO_LIBELF=1 NO_JVMTI=1 VF=1 -C tools/perf/
+sudo cp -v tools/perf/perf ../rootfs/sbin/perf-thead
+# 安装内核到安装目标目录
+sudo cp -v arch/riscv/boot/Image ../rootfs/boot/
+# 安装设备树到安装目标目录
+sudo cp -v arch/riscv/boot/dts/thead/light-lpi4a.dtb ../rootfs/boot/
+sudo cp -v arch/riscv/boot/dts/thead/light-lpi4a-dsi0-hdmi.dtb ../rootfs/boot/
+
+之后只需要把rootfs中内容拷贝或覆盖到对应目录即可,注意内核Image和内核module目录一定要对应,不然会因缺失内核模块导致外设功能失效。
+ + + + + + +C910V强制cpu指定补丁
+From 5164bca5a4bcde4534dc1a9aa3a7f619719874cf Mon Sep 17 00:00:00 2001
+From: Han Gao <gaohan@iscas.ac.cn>
+Date: Sun, 23 Apr 2023 22:11:35 +0800
+Subject: [PATCH] qemu-user-riscv64 default cpu is c910v
+
+Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
+---
+ linux-user/riscv/target_elf.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/linux-user/riscv/target_elf.h b/linux-user/riscv/target_elf.h
+index 9dd65652ee45..3195cfa71408 100644
+--- a/linux-user/riscv/target_elf.h
++++ b/linux-user/riscv/target_elf.h
+@@ -9,7 +9,7 @@
+ #define RISCV_TARGET_ELF_H
+ static inline const char *cpu_get_model(uint32_t eflags)
+ {
+- /* TYPE_RISCV_CPU_ANY */
+- return "any";
++ /* TYPE_RISCV_CPU_C910V */
++ return "c910v";
+ }
+ #endif
+
+编译流程
+./configure \
+ --prefix=$HOME/qemu-install \
+ --static \
+ --target-list=riscv64-linux-user \
+ --disable-system \
+ --disable-pie \
+ --interp-prefix=/etc/qemu-binfmt/%M
+
+make -j20
+
+
+
+
+
+
+
+ 这里描述了 RevyOS 相关的构建文档
+ + + + + + +测试版镜像
+基于 lpi4a 20230614 版本 +增加 ahead 支持 混合新 20230820 改动
+https://mirror.iscas.ac.cn/revyos/extra/images/beagle/test/20230802/
+RevyOS 20230412 版本
+RevyOS 20230425 版本
+RevyOS 20230511 版本
+添加了gnome桌面支持
+RevyOS 20230614 版本
+当前版本只提供xfce4桌面支持
+提供了chromium支持
+RevyOS 20230810 版本
+重新设计了启动流程 所以需要重新刷写所有分区
+Retrieving file: /dtbs/linux-image-5.10.113-lpi4a/<NULL>-light-c910.
+Skipping l0r for failure retrieving fdt
+Light LPI4A#
+
+遇见这种情况需要执行</br>
+env default -a -f;env save;reset
+
+当前版本只提供xfce4桌面支持
+内核 commit ID: #2023.08.10.02.31+c130cdb21
+RevyOS 20230916 版本
+SBI 时间戳
+u-boot 时间戳
+内核 commit ID
+版本时间戳(/etc/revyos-release)
+RevyOS 20231026 版本
+RevyOS 20231210 版本
+SBI 时间戳
+u-boot 时间戳
+内核 commit ID
+版本时间戳(/etc/revyos-release)
+RevyOS 20240202 版本
+SBI 时间戳
+u-boot 时间戳
+内核 commit ID
+版本时间戳(/etc/revyos-release)
+RevyOS 20240601 版本
+SBI 时间戳
+u-boot 时间戳
+内核 commit ID
+版本时间戳(/etc/revyos-release)
+状态: +可以运行,软解图形
+资料: +https://github.com/OpenTTD/OpenTTD/blob/master/COMPILING.md +https://salsa.debian.org/openttd-team/openttd/-/blob/master/debian/control
+# 安装依赖
+sudo apt install libsdl2-dev zlib1g-dev libpng-dev libfreetype-dev libfontconfig-dev libicu-dev liblzo2-dev liblzma-dev libfluidsynth-dev libopengl-dev grfcodec openttd-opengfx cmake
+
+# 下载代码&编译
+git clone https://github.com/OpenTTD/OpenTTD.git
+cd OpenTTD
+mkdir build
+cd build
+cmake ..
+make
+
+# 运行
+./openttd
+
+图形和音频资源文件通过游戏内功能下载,支持中文
+ + + + + + + +状态: +可以运行,支持GLES加速
+资料: +https://github.com/yquake2/yquake2/blob/master/doc/020_installation.md +https://github.com/yquake2/yquake2/blob/master/doc/030_configuration.md
+# 安装依赖
+sudo apt install build-essential libgl1-mesa-dev libsdl2-dev libopenal-dev libcurl4-openssl-dev
+
+# 下载代码&编译
+git clone https://github.com/yquake2/yquake2.git
+mkdir build
+cd build
+cmake ..
+make
+
+# 运行
+#(需要准备好游戏原始资源文件夹baseq2)
+cd ..
+cd release
+cp -r ~/baseq2 .
+./quake2
+
+需要将原始游戏资源文件夹baseq2放到和quake2程序同一个目录中(Steam版可用)
+分辨率和图形加速选项在游戏内设置菜单修改,不修改默认是软渲染,硬渲染设置请改为“OpenGL ES3”(参见下图)
+ + + + + + + +在RevyOS中安装包只需要在 terminal 中输入
+apt install + 包名
+
+即可安装
+以下以安装 git作为演示
+debian@lpi4a:~$ sudo apt install git
+[sudo] password for debian:
+Reading package lists... Done
+Building dependency tree... Done
+Reading state information... Done
+The following additional packages will be installed:
+ git-man liberror-perl patch
+Suggested packages:
+ gettext-base git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui
+ gitk gitweb git-cvs git-mediawiki git-svn ed diffutils-doc
+The following NEW packages will be installed:
+ git git-man liberror-perl patch
+0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
+Need to get 8605 kB of archives.
+After this operation, 39.4 MB of additional disk space will be used.
+Do you want to continue? [Y/n] y
+Get:1 https://mirror.iscas.ac.cn/revyos/revyos-base sid/main riscv64 liberror-perl all 0.17029-2 [29.0 kB]
+Get:2 https://mirror.iscas.ac.cn/revyos/revyos-base sid/main riscv64 git-man all 1:2.40.1-1 [2072 kB]
+Get:3 https://mirror.iscas.ac.cn/revyos/revyos-base sid/main riscv64 git riscv64 1:2.40.1-1 [6390 kB]
+Get:4 https://mirror.iscas.ac.cn/revyos/revyos-base sid/main riscv64 patch riscv64 2.7.6-7+b1 [114 kB]
+Fetched 8605 kB in 1s (6656 kB/s)
+Selecting previously unselected package liberror-perl.
+(Reading database ... 75688 files and directories currently installed.)
+Preparing to unpack .../liberror-perl_0.17029-2_all.deb ...
+Unpacking liberror-perl (0.17029-2) ...
+Selecting previously unselected package git-man.
+Preparing to unpack .../git-man_1%3a2.40.1-1_all.deb ...
+Unpacking git-man (1:2.40.1-1) ...
+Selecting previously unselected package git.
+Preparing to unpack .../git_1%3a2.40.1-1_riscv64.deb ...
+Unpacking git (1:2.40.1-1) ...
+Selecting previously unselected package patch.
+Preparing to unpack .../patch_2.7.6-7+b1_riscv64.deb ...
+Unpacking patch (2.7.6-7+b1) ...
+Setting up liberror-perl (0.17029-2) ...
+Setting up patch (2.7.6-7+b1) ...
+Setting up git-man (1:2.40.1-1) ...
+Setting up git (1:2.40.1-1) ...
+Processing triggers for man-db (2.11.2-2) ...
+
+
+
+
+
+
+
+ 源中已有 riscv64 的docker安装包,名为 docker.io
,可以直接使用:
sudo apt install docker.io
+
+sudo docker pull riscv64/debian:unstable
+
+如果需要不以 root 权限运行 docker, 即如果不用 sudo, 出现了下面的错误:
+debian@lpi4a:~$ docker pull riscv64/debian:unstable
+Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/create?fromImage=riscv64%2Fdebian&tag=unstable": dial unix /var/run/docker.sock: connect: permission denied
+
+
+需要执行以下命令将用户加入 docker
用户组中:
sudo usermod -aG docker $USER # 或换成需要免root运行docker的用户名
+
+重新登陆,如果出现下面的结果即可免特权运行docker
+$ id
+uid=1000(debian) gid=1000(debian) groups=1000(debian),4(adm),7(lp),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),105(netdev),106(bluetooth),112(docker),996(input) # 这里出现了 docker 用户组即可
+
+编辑 /usr/lib/systemd/system/docker.service
,在 [Service]
下加入代理,docker只读取下面三个变量
[Service]
+...
+Environment="HTTP_PROXY=http://proxy.example.com:8080/"
+Environment="HTTPS_PROXY=http://proxy.example.com:8080/"
+Environment="NO_PROXY=localhost,127.0.0.1,.example.com"
+
+添加完成后重加载 systemd units,然后重启 docker 即可
+sudo systemctl daemon-reload
+sudo systemctl restart docker
+
+
+
+
+
+
+
+ ++本页的 ROS 指 ROS 2
+
状态:可以运行
+官方资料页:https://ros.org/
+官方文档: https://docs.ros.org/
+ROS (Robot Operating System, 机器人操作系统) 提供一系列程序库和工具以帮助软件开发者创建机器人应用软件。它提供了硬件抽象、设备驱动、函数库、可视化工具、消息传递和软件包管理等诸多功能。ROS遵循BSD开源许可协议。
+假设使用来自 ros.z572.online
的源
注意下面应该使用 bookworm
sudo sh -c "echo 'deb [trusted=yes] https://ros.z572.online/main bookworm main\ndeb-src [trusted=yes] https://ros.z572.online/main bookworm main' > /etc/apt/sources.list.d/ros.list"
+sudo apt update
+sudo apt upgrade
+
+目前已经测试 ROS Jazzy 和 Humble 版本可用
+注意:两个版本可能会存在依赖冲突,请不要尝试同时安装两个版本
+Jazzy:
+apt install ros-jazzy-desktop-full
+
+Humble:
+apt install ros-humble-desktop-full
+
+sudo apt install python3-rosdep2
+
+然后删除 /etc/ros/rosdep/sources.list.d/10-debian.list
,
+并修改 etc/ros/rosdep/sources.list.d/20-default.list
为下面的内容
yaml https://raw.githubusercontent.com/revyos-ros/rosdistro/master/rosdep/base.yaml
+yaml https://raw.githubusercontent.com/revyos-ros/rosdistro/master/rosdep/python.yaml
+yaml https://raw.githubusercontent.com/revyos-ros/rosdistro/master/rosdep/ruby.yaml
+
+根据安装的 ROS 版本,选择相应的命令
+Jazzy:
+source /opt/ros/jazzy/setup.sh
+
+Humble:
+source /opt/ros/Humble/setup.sh
+
+可以将上面的内容加入 .bashrc
或者您使用的 shell profile 中。
rosdep update
+
+使用 rosdep 安装外部依赖(以 micro_ros_setup
)为例
1.设置环境变量 +请根据您安装的版本选择对应的命令
+Jazzy:
+AMENT_PACKAGE_PATH=/opt/ros/jazzy
+
+Humble:
+AMENT_PACKAGE_PATH=/opt/ros/humble
+
+2.下载源代码
+git clone https://github.com/micro-ROS/micro_ros_setup && cd micro_ros_setup
+
+3.安装依赖
+rosdep install --from-paths . -y --ignore-src
+
+colon 是一款现代的 ROS 编译工具
+sudo apt install colcon
+
+测试编译(依然以 micro_ros_setup
)为例
git clone https://github.com/micro-ROS/micro_ros_setup && cd micro_ros_setup
+colcon build
+
+ros2 pkg
命令用于管理 ROS 2 包。ros2 run
命令用于运行 ROS 2 包中的特定节点。ros2 topic
命令用于与 ROS 2 的话题交互。ros2 param
命令用于管理 ROS 2 参数。ros2 service
命令用于与 ROS 2 服务交互。ros2 node
命令用于与 ROS 2 节点交互。ros2 bag
命令用于记录和回放 ROS 2 数据。ros2 launch
命令用于启动 ROS 2 启动文件。Node(C++)
+ 运行 C++ 节点:
+bash
+ ros2 run demo_nodes_cpp talker
+ ros2 run demo_nodes_cpp listener
Node(Python)
+ 运行 Python 节点:
+bash
+ ros2 run demo_nodes_py talker
+ ros2 run demo_nodes_py listener
Add Two Ints Server
+ 测试服务端和客户端:
+bash
+ ros2 run demo_nodes_cpp add_two_ints_server
+ ros2 run demo_nodes_cpp add_two_ints_client
TF2
+ 测试静态变换、监听和监控功能:
+ 发布静态变换并监听:
+bash
+ ros2 run tf2_ros static_transform_publisher 1 1 1 0 0 0 /base_link /odom
+ ros2 run tf2_ros tf2_echo base_link odom
+ 监控变换:
+bash
+ ros2 run tf2_ros static_transform_publisher 1 1 1 0 0 0 /base_link /odom
+ ros2 run tf2_ros tf2_monitor
+ 查看变换框架图(需生成 PDF 文件):
+bash
+ ros2 run tf2_ros static_transform_publisher 1 1 1 0 0 0 /base_link /odom
+ ros2 run tf2_tools view_frames
TurtleSim
+ 需要图形界面支持:
+ 启动 turtlesim 节点:
+bash
+ ros2 run turtlesim turtlesim_node
+ 图形界面会弹出一个窗口。
+ 使用键盘控制小乌龟:
+bash
+ ros2 run turtlesim turtle_teleop_key
bash
+ ros2 run rqt_gui rqt_gui
需要使用 sudo switch-gl gl4es
再重启后使用 LIBGL_ALWAYS_SOFTWARE=true rviz2 here
启动,效果如下
使用 sudo apt install gazebo11
安装
需要使用 sudo switch-gl gl4es
再重启后使用 LIBGL_ALWAYS_SOFTWARE=true gazebo
启动,效果如下
状态:可以运行
+官方资料页:https://docs.gimp.org/2.10/en/
+GIMP 是一个多平台工具,用于创建和编辑各种图像。 GIMP 是 GNU Image Manipulation Program 的首字母缩写。 GIMP 有很多功能。它可以用作简单的绘画程序、专家级的照片修饰程序、创建数字艺术的工具、在线批处理系统、批量生产的图像渲染器、图像格式转换器等。 GIMP 是可扩展和可扩展的。它旨在通过插件和扩展来增强以执行任何操作。先进的脚本界面允许从最简单的任务到最复杂的图像处理程序的所有内容都可以轻松编写脚本。
+GIMP是 RevyOS 预安装图形处理软件,如想使用 GIMP,在terminal中输入
+gimp
+
+在等待资源加载后就会弹出 GIMP 主界面
+ +使用功能参考官方资料页
+ + + + + + +状态:可以运行
+资料:https://wiki.debian.org/I18n/ibus
+sudo apt install ibus ibus-libpinyin
+sudo reboot
+
+重启后需要手动将中文输入法添加到输入选项中:
+托盘图标->右击->Preference +
+点击选项卡Input Method->Add,打开下图窗口 +
+点击Chinese->Intelligent Pinyin->Add +
+ + + + + + +RevyOS是由 RuyiSDK 团队的 RevyOS 小队支持开发的一款针对 XuanTie 芯片生态的 Debian 优化定制发行版。
+RevyOS 是 RuyiSDK 的一部分。RuyiSDK 是一个由 PLCT Lab 所启动的开源项目,该项目旨在为 RISC-V 开发者提供一个便捷、完善的开发环境,其提供了相关最新的硬件信息、软件支持,例如在支持的设备中有提供相关支持硬件情况;软件层面提供了镜像(如 RevyOS)、工具链、包管理器等。
+RevyOS 围绕玄铁 C906、C910、C920、C908 等芯片提供了完整而全面的适配和优化支持,默认集成支持玄铁扩展指令集和 RVV 1.0 的 GCC 工具链,并搭载使用 RVV 1.0 指令集优化过的 Glibc 和 Kernel。
+目前,RevyOS 在办公、网页浏览、观看视频等方面已经能满足用户的基本使用需求。
+基于上述定制和优化的 RevyOS,在 Lichee RV,Lichee Pi 4A 等硬件平台上,能够提供优秀的性能和极佳的体验。
+RevyOS 的用户版镜像目前在 ISCAS(中国科学院软件研究所)开源镜像站进行更新。如您想获取 RevyOS 最新版镜像请访问镜像下载目录,根据所使用设备来获取对应镜像。
+支持设备 | +镜像下载(最新版本) | +刷写教程 | +SD 卡支持 | +
---|---|---|---|
Lichee Pi 4A | +20241229 | +镜像刷写 | +支持 | +
Lichee Cluster 4A | +20240720 | +镜像刷写 | ++ |
Lichee Console 4A | +20240720 | +镜像刷写 | ++ |
Lichee Book 4A | +20240720 | +镜像刷写 | ++ |
Milk-V Pioneer | +20241230 | +镜像刷写 | +支持 | +
Milk-V Meles | +20241229 | ++ | 支持 | +
Beagle-Ahead | +20231210 | ++ | + |
Huiwei book | +20240617 | ++ | + |
详见这篇文档如何启用优化 GCC
+镜像版本更新后我们会公布当前版本镜像支持内容,如您想查看镜像支持内容请点击RevyOS 版本更新日志后选择您所需要的版本进行查看。
+如果您在使用过程中遇到问题,可以进行issue 申报。
+在本 DOCS 中,我们拥有相关的使用构建与适配文档以及测试文档方便让用户对部分内容进行参考,完善的文档支持加快了用户对于系统的上手时间。
+RevyOS 有自己的 Telegram 群组:邀请链接
+现在正在招聘测试实习生,详情请看:RevyOS 小队测试实习生招聘
+ + + + + + +感谢使用 RevyOS!如果在使用过程中遇到问题或发现了 Bug,可以按照以下步骤操作:
+在提交新的 Issue 之前,建议先查看我们的已知问题记录:
+如果问题已存在,您可以选择:
+如果您想交流使用过程中的问题,可以通过以下方式联系我们:
+