本來今天想下載編譯openWRT,后來發(fā)現(xiàn)tf卡空間分配問題,明天再調(diào)整吧,看了看桌上的USB攝像頭,今天晚上就你出場了。
一開始我是猶豫的,因?yàn)?a target="_blank">RISC-V的生態(tài),不一定能部署的上相關(guān)軟件,但是JH7110,加上Imagination的GPU,再加上Debian OS,想不出會有什么不兼容的場景,最大風(fēng)險(xiǎn)可能來自CPU,有的話應(yīng)該都能解決掉,那就上吧。
一、軟件環(huán)境
(一)操作系統(tǒng)
官方的Debian鏡像(starfive-jh7110-202306-SD-minimal-desktop.img),也沒用去update了,反正也挺新的。
root@starfive:# uname -a
Linux starfive 5.15.0-starfive #1 SMP Sun Jun 11 07:48:39 UTC 2023 riscv64 GNU/Linux
就是因?yàn)槲募蠋inimal,可能需要安裝的東西會比較多,反正我心里有個(gè)數(shù)。
(二)安裝libjpeg62-turbo-dev
root@starfive:# apt install libjpeg62-turbo-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libc-dev-bin libc-devtools libc6-dev libcrypt-dev libnsl-dev libtirpc-dev
linux-libc-dev manpages manpages-dev rpcsvc-proto
Suggested packages:
glibc-doc
The following NEW packages will be installed:
libc-dev-bin libc-devtools libc6-dev libcrypt-dev libjpeg62-turbo-dev
libnsl-dev libtirpc-dev linux-libc-dev manpages manpages-dev rpcsvc-proto
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 8933 kB of archives.
After this operation, 44.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(三)安裝imagemagick
root@starfive:# apt install imagemagick
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
imagemagick-6.q16 libnetpbm11 netpbm
Suggested packages:
imagemagick-doc autotrace cups-bsd | lpr | lprng curl enscript ffmpeg gimp
gnuplot grads graphviz hp2xx html2ps libwmf-bin mplayer povray radiance
texlive-base-bin transfig ufraw-batch xdg-utils
imagemagick imagemagick-6.q16 libnetpbm11 netpbm
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
After this operation, 7693 kB of additional disk space will be used.
(四)安裝libv4l-dev
root@starfive:# apt install libv4l-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libv4l2rds0
Suggested packages:
pkg-config
The following NEW packages will be installed:
libv4l-dev libv4l2rds0
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 291 kB of archives.
After this operation, 1948 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://snapshot.debian.org/archive/debian-ports/20221225T084846Z unstable/main riscv64 libv4l2rds0 riscv64 1.22.1-5+b1 [80.4 kB]
Get:2 https://snapshot.debian.org/archive/debian-ports/20221225T084846Z unstable/main riscv64 libv4l-dev riscv64 1.22.1-5+b1 [211 kB]
Fetched 291 kB in 5s (61.7 kB/s)
(五)安裝編譯工具
發(fā)現(xiàn)gcc、git、cmake啥都沒用,果然夠minimal,逐一apt install。
root@starfive: # apt install gcc
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
gcc-12 libasan8 libcc1-0 libgcc-12-dev
Suggested packages:
gcc-multilib make autoconf automake libtool flex bison gdb gcc-doc
gcc-12-doc gcc-12-locales
The following NEW packages will be installed:
gcc gcc-12 libasan8 libcc1-0 libgcc-12-dev
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 18.6 MB of archives.
After this operation, 70.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://snapshot.debian.org/archive/debian-ports/20221225T084846Z unstable/main riscv64 libcc1-0 riscv64 12.2.0-10 [38.4 kB]
Get:2 https://snapshot.debian.org/archive/debian-ports/20221225T084846Z unstable/main riscv64 libasan8 riscv64 12.2.0-10 [2067 kB]
Get:3 https://snapshot.debian.org/archive/debian-ports/20221225T084846Z unstable/main riscv64 libgcc-12-dev riscv64 12.2.0-10 [1951 kB]
Get:4 https://snapshot.debian.org/archive/debian-ports/20221225T084846Z unstable/main riscv64 gcc-12 riscv64 12.2.0-10 [14.6 MB]
Get:5 https://snapshot.debian.org/archive/debian-ports/20221225T084846Z unstable/main riscv64 gcc riscv64 4:12.2.0-1 [5200 B]
Fetched 18.6 MB in 3min 55s (79.5 kB/s)
安裝完成后檢查下:
root@starfive:# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/12/lto-wrapper
Target: riscv64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-10' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --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-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 --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 12.2.0 (Debian 12.2.0-10)
二、源碼下載、編譯和安裝
(一)源碼下載
JH7110處理能力毋庸置疑,直接板子上編譯和安裝,源代碼直接從github上拉取。
git clone https://github.com/jacksonliam/mjpg-streamer.git
Cloning into 'mjpg-streamer'...
remote: Enumerating objects: 2964, done.
remote: Total 2964 (delta 0), reused 0 (delta 0), pack-reused 2964
Receiving objects: 100% (2964/2964), 3.48 MiB | 4.33 MiB/s, done.
Resolving deltas: 100% (1885/1885), done.
(二)源碼編譯和安裝
進(jìn)入/mjpg-streamer/mjpg-streamer-experimental 文件夾,執(zhí)行 make all。
檢查下生成的文件,
再安裝。
三、服務(wù)啟動(dòng)
(一)前期工作
首先確保網(wǎng)絡(luò)正常連接。
之后插入U(xiǎn)SB camera,OS提示已經(jīng)識別:
root@starfive: # [ 3976.150090] usb 1-1.3: new high-speed USB device number 3 using xhci_hcd
[ 3976.295340] usb 1-1.3: Found UVC 1.00 device HIK 720P Camera (2bdf:0280)
[ 3976.306997] input: HIK 720P Camera: HIK 720P Camer as /devices/platform/soc/2b000000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1 .3/1-1.3:1.0/input/input0
通過對比video大法判斷設(shè)備名,找出是/dev/video4:
root@starfive: # ls -l /dev/video*
crw-rw----+ 1 root video 81, 0 Dec 22 2022 /dev/video0
crw-rw----+ 1 root video 81, 1 Dec 22 2022 /dev/video1
crw-rw----+ 1 root video 81, 2 Dec 22 2022 /dev/video2
crw-rw----+ 1 root video 81, 3 Dec 22 2022 /dev/video3
crw-rw----+ 1 root video 81, 6 Aug 21 14:42 /dev/video4
crw-rw----+ 1 root video 81, 7 Aug 21 14:42 /dev/video5
crw-rw----+ 1 root video 81, 4 Dec 22 2022 /dev/video6
crw-rw----+ 1 root video 81, 5 Dec 22 2022 /dev/video7
(二)啟動(dòng)USB攝像頭
直接輸入 mjpg_streamer 即可啟動(dòng)服務(wù),默認(rèn)的是video0,VF2開發(fā)板的USB攝像頭是video4。在啟動(dòng)服務(wù)命令中通過“-d /dev/video4” 選項(xiàng)來指定。
y是表示YUV格式。如果沒有-y,默認(rèn)啟動(dòng)是mjpeg格式
-d指定設(shè)備
-f 制訂幀數(shù),默認(rèn)30幀
-r指定視頻大小,如320×240
-q指定畫質(zhì),默認(rèn)80對于輸出參數(shù):
-p 指定端口,一般是8080
-w 指定網(wǎng)頁目錄,設(shè)置的是/www目錄
-c設(shè)置通過密碼訪問
./mjpg_streamer -i "./input_uvc.so -d /dev/video4 -f 30 -q 90 -n" -o "./output_http.so -w ./www"
啟動(dòng)后的日志如下:
四、網(wǎng)絡(luò)攝像頭測試
(一)在線視頻查看
打開瀏覽器,訪問URL為:[VF2開發(fā)板 IP]:8080 ,得到的內(nèi)容如下:
(二)取一張圖
取一張圖的URL為`IP:8080?action=snapshot,直接給自己照相:
五、一些體會
全程下來無錯(cuò)誤,整個(gè)軟件安裝非常順利,本以為會出現(xiàn)的各種小問題一個(gè)都沒。
JH7110 CPU功能強(qiáng)大,之前在H616上也編譯過mjpg-streamer,耗時(shí)跟VF2完全不同,在VF2上簡直飛一般編譯安裝。
GPU(Imagination BXE-4-32 GPU)還沒有測試,按理來說Imagination的應(yīng)該兼容性和性能不會有什么大問題,下次有時(shí)間可以測試下。
審核編輯:湯梓紅
-
gpu
+關(guān)注
關(guān)注
28文章
4739瀏覽量
128941 -
操作系統(tǒng)
+關(guān)注
關(guān)注
37文章
6822瀏覽量
123331 -
OpenWrt
+關(guān)注
關(guān)注
10文章
130瀏覽量
39304 -
網(wǎng)絡(luò)攝像頭
+關(guān)注
關(guān)注
2文章
43瀏覽量
16040 -
RISC-V
+關(guān)注
關(guān)注
45文章
2277瀏覽量
46157
發(fā)布評論請先 登錄
相關(guān)推薦
評論