202408830测试RK3588的rockit/VI的编译
2024/8/30 14:58
前言
环境介绍:
1.编译环境
Ubuntu 20.04.6 LTS
rootroot@rootroot-desktop:~$
rootroot@rootroot-desktop:~$ cat /etc/issue
Ubuntu 20.04.6 LTS \n \l
rootroot@rootroot-desktop:~$
2.SDK版本:rk3568_linux_5.10
内核版本:linux-5.10.198
Y:\repo_rk3588_20240508\kernel\.config
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 5.10.198 Kernel Configuration
#
3.单板:
友善之臂的NanoPi T6
香橙派Orange Pi5 Plus
一、编译rockit组件包
使用5.10版本编译buildroot,需要将虚拟机内存调整到8GB以上,因为默认编译采用多线程,导致内存不足出现个别包无法编译导致固件无法编译完成。
rockit组件包在5.10版本在编译buildroot系统的时候是自动编译的,并且会安装到编译的系统里面。固件烧录后在单板直接测试即可。此处跳过系统,单领出来编译。
系统编译完成后存放默认路径
【RK3568的位置,RK3588默认不编译rockit?】
/home/zfeng/rk3568_linux_5.10/buildroot/output/rockchip_rk3568/build/rockit/
进入原来SDK组件存放路径:
rootroot@rootroot-desktop:~$ cd ~/repo_rk3588_20240508/external/rockit/
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit$ ll
total 28
drwxrwxr-x 5 rootroot rootroot 4096 8月 29 17:29 ./
drwxrwxr-x 27 rootroot rootroot 4096 8月 29 17:29 ../
-rw-rw-r-- 1 rootroot rootroot 541 8月 29 17:29 CMakeLists.txt
lrwxrwxrwx 1 rootroot rootroot 40 8月 29 17:29 .git -> ../../.repo/projects/external/rockit.git
drwxrwxr-x 4 rootroot rootroot 4096 8月 29 17:29 lib/
drwxrwxr-x 5 rootroot rootroot 4096 8月 29 17:29 mpi/
-rwxrwxr-x 1 rootroot rootroot 1762 8月 29 17:29 README.md*
drwxrwxr-x 4 rootroot rootroot 4096 8月 29 17:29 tgi/
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit$
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit$
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit$ touch toolchainfile.cmake
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit$
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit$ cat toolchainfile.cmake
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit$
rockit采用cmake,我们需要指定交叉编译器路径
编译rockit不能使用SDK默认编译kernel的交叉编译,需要采用编译buildroot的,而编译buildroot的编译器SDK并没有存放,需要编译过buildroot之后才可以用。
buildroot编译器路径为
/home/rootroot/repo_rk3588_20240508/buildroot/output/rockchip_rk3588/host/bin/aarch64-buildroot-linux-gnu-gcc
在rockit里面新建toolchainfile.cmake,添加下面内容,指定cmake交叉编译器
# Example toolchain.cmake content
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
# 指定交叉编译器路径
string(REPLACE "/share/buildroot" "" RELOCATED_HOST_DIR /home/rootroot/repo_rk3588_20240508/buildroot/output/rockchip_rk3588/host/share/buildroot)
set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/bin/aarch64-buildroot-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/bin/aarch64-buildroot-linux-gnu-g++")
# 设置目标系统根目录
set(CMAKE_FIND_ROOT_PATH /home/rootroot/repo_rk3588_20240508/buildroot/output/rockchip_rk3588/target/)
# 配置 CMake 查找程序和库文件的方式
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
新建build文件夹
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit$
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit$ mkdir build
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit$ ll
total 40
drwxrwxr-x 6 rootroot rootroot 4096 8月 30 14:54 ./
drwxrwxr-x 27 rootroot rootroot 4096 8月 30 14:50 ../
drwxrwxr-x 2 rootroot rootroot 4096 8月 30 14:54 build/
-rw-rw-r-- 1 rootroot rootroot 541 8月 29 17:29 CMakeLists.txt
lrwxrwxrwx 1 rootroot rootroot 40 8月 29 17:29 .git -> ../../.repo/projects/external/rockit.git
drwxrwxr-x 4 rootroot rootroot 4096 8月 29 17:29 lib/
drwxrwxr-x 5 rootroot rootroot 4096 8月 29 17:29 mpi/
-rwxrwxr-x 1 rootroot rootroot 1762 8月 29 17:29 README.md*
drwxrwxr-x 4 rootroot rootroot 4096 8月 29 17:29 tgi/
-rw-rw-r-- 1 rootroot rootroot 992 8月 30 14:54 toolchainfile.cmake
-rwx------ 1 rootroot rootroot 736 8月 30 14:51 'toolchainfile - 副本.cmake'*
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit$ cd build/
进入build文件夹,执行cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchainfile.cmake
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build$
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchainfile.cmake
-- The C compiler identification is GNU 12.3.0
-- The CXX compiler identification is GNU 12.3.0
-- Check for working C compiler: /home/rootroot/repo_rk3588_20240508/buildroot/output/rockchip_rk3588/host/bin/aarch64-buildroot-linux-gnu-gcc
-- Check for working C compiler: /home/rootroot/repo_rk3588_20240508/buildroot/output/rockchip_rk3588/host/bin/aarch64-buildroot-linux-gnu-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/rootroot/repo_rk3588_20240508/buildroot/output/rockchip_rk3588/host/bin/aarch64-buildroot-linux-gnu-g++
-- Check for working CXX compiler: /home/rootroot/repo_rk3588_20240508/buildroot/output/rockchip_rk3588/host/bin/aarch64-buildroot-linux-gnu-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Build rockit mpi
-- Build WITH linker libs for Linux
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rootroot/repo_rk3588_20240508/external/rockit/build
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build$ ll
total 48
drwxrwxr-x 4 rootroot rootroot 4096 8月 30 14:55 ./
drwxrwxr-x 6 rootroot rootroot 4096 8月 30 14:54 ../
-rw-rw-r-- 1 rootroot rootroot 15022 8月 30 14:55 CMakeCache.txt
drwxrwxr-x 4 rootroot rootroot 4096 8月 30 14:55 CMakeFiles/
-rw-rw-r-- 1 rootroot rootroot 1745 8月 30 14:55 cmake_install.cmake
-rw-rw-r-- 1 rootroot rootroot 10905 8月 30 14:55 Makefile
drwxrwxr-x 5 rootroot rootroot 4096 8月 30 14:55 mpi/
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build$
等命令执行完再执行make即可:
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build$
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build$ make
Scanning dependencies of target rt_test_comm
[ 3%] Building CXX object mpi/example/common/CMakeFiles/rt_test_comm.dir/test_comm_argparse.cpp.o
[ 6%] Building CXX object mpi/example/common/CMakeFiles/rt_test_comm.dir/test_comm_utils.cpp.o
[ 10%] Building CXX object mpi/example/common/CMakeFiles/rt_test_comm.dir/test_comm_bmp.cpp.o
[ 13%] Building CXX object mpi/example/common/CMakeFiles/rt_test_comm.dir/test_comm_imgproc.cpp.o
[ 17%] Building CXX object mpi/example/common/CMakeFiles/rt_test_comm.dir/test_comm_sys.cpp.o
[ 20%] Building CXX object mpi/example/common/CMakeFiles/rt_test_comm.dir/test_comm_vdec.cpp.o
[ 24%] Building CXX object mpi/example/common/CMakeFiles/rt_test_comm.dir/test_comm_vo.cpp.o
[ 27%] Building CXX object mpi/example/common/CMakeFiles/rt_test_comm.dir/test_comm_ao.cpp.o
[ 31%] Building CXX object mpi/example/common/CMakeFiles/rt_test_comm.dir/tmedia/test_comm_tmd.cpp.o
[ 34%] Building CXX object mpi/example/common/CMakeFiles/rt_test_comm.dir/test_mod_vpss.cpp.o
[ 37%] Linking CXX static library librt_test_comm.a
[ 37%] Built target rt_test_comm
Scanning dependencies of target rk_mpi_adec_test
[ 41%] Building CXX object mpi/example/mod/CMakeFiles/rk_mpi_adec_test.dir/test_mpi_adec.cpp.o
[ 44%] Linking CXX executable rk_mpi_adec_test
[ 44%] Built target rk_mpi_adec_test
Scanning dependencies of target rk_mpi_mb_test
[ 48%] Building CXX object mpi/example/mod/CMakeFiles/rk_mpi_mb_test.dir/test_mpi_mb.cpp.o
[ 51%] Linking CXX executable rk_mpi_mb_test
[ 51%] Built target rk_mpi_mb_test
Scanning dependencies of target rk_mpi_vdec_test
[ 55%] Building CXX object mpi/example/mod/CMakeFiles/rk_mpi_vdec_test.dir/test_mpi_vdec.cpp.o
[ 58%] Linking CXX executable rk_mpi_vdec_test
[ 58%] Built target rk_mpi_vdec_test
Scanning dependencies of target rk_mpi_ai_test
[ 62%] Building CXX object mpi/example/mod/CMakeFiles/rk_mpi_ai_test.dir/test_mpi_ai.cpp.o
[ 65%] Linking CXX executable rk_mpi_ai_test
[ 65%] Built target rk_mpi_ai_test
Scanning dependencies of target rk_mpi_aenc_test
[ 68%] Building CXX object mpi/example/mod/CMakeFiles/rk_mpi_aenc_test.dir/test_mpi_aenc.cpp.o
[ 72%] Linking CXX executable rk_mpi_aenc_test
[ 72%] Built target rk_mpi_aenc_test
Scanning dependencies of target rk_mpi_sys_test
[ 75%] Building CXX object mpi/example/mod/CMakeFiles/rk_mpi_sys_test.dir/test_mpi_sys.cpp.o
[ 79%] Linking CXX executable rk_mpi_sys_test
[ 79%] Built target rk_mpi_sys_test
Scanning dependencies of target rk_mpi_vo_test
[ 82%] Building CXX object mpi/example/mod/CMakeFiles/rk_mpi_vo_test.dir/test_mpi_vo.cpp.o
[ 86%] Linking CXX executable rk_mpi_vo_test
[ 86%] Built target rk_mpi_vo_test
Scanning dependencies of target rk_mpi_mmz_test
[ 89%] Building CXX object mpi/example/mod/CMakeFiles/rk_mpi_mmz_test.dir/test_mpi_mmz.cpp.o
[ 93%] Linking CXX executable rk_mpi_mmz_test
[ 93%] Built target rk_mpi_mmz_test
Scanning dependencies of target rk_mpi_avio_test
[ 96%] Building CXX object mpi/example/mod/CMakeFiles/rk_mpi_avio_test.dir/sys/test_sys_avio.cpp.o
[100%] Linking CXX executable rk_mpi_avio_test
[100%] Built target rk_mpi_avio_test
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build$
最后将编译完成的可执行文件放到开发板即可,可执行文件路径为
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build/mpi/example$ cd mod/
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build/mpi/example/mod$ ll
total 428
drwxrwxr-x 3 rootroot rootroot 4096 8月 30 14:55 ./
drwxrwxr-x 5 rootroot rootroot 4096 8月 30 14:55 ../
drwxrwxr-x 11 rootroot rootroot 4096 8月 30 14:55 CMakeFiles/
-rw-rw-r-- 1 rootroot rootroot 11712 8月 30 14:55 cmake_install.cmake
-rw-rw-r-- 1 rootroot rootroot 23121 8月 30 14:55 Makefile
-rwxrwxr-x 1 rootroot rootroot 32800 8月 30 14:55 rk_mpi_adec_test*
-rwxrwxr-x 1 rootroot rootroot 28624 8月 30 14:55 rk_mpi_aenc_test*
-rwxrwxr-x 1 rootroot rootroot 59976 8月 30 14:55 rk_mpi_ai_test*
-rwxrwxr-x 1 rootroot rootroot 23720 8月 30 14:55 rk_mpi_avio_test*
-rwxrwxr-x 1 rootroot rootroot 52768 8月 30 14:55 rk_mpi_mb_test*
-rwxrwxr-x 1 rootroot rootroot 24080 8月 30 14:55 rk_mpi_mmz_test*
-rwxrwxr-x 1 rootroot rootroot 28592 8月 30 14:55 rk_mpi_sys_test*
-rwxrwxr-x 1 rootroot rootroot 38176 8月 30 14:55 rk_mpi_vdec_test*
-rwxrwxr-x 1 rootroot rootroot 88184 8月 30 14:55 rk_mpi_vo_test*
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build/mpi/example/mod$
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build/mpi/example/mod$ pwd
/home/rootroot/repo_rk3588_20240508/external/rockit/build/mpi/example/mod
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build/mpi/example/mod$
rootroot@rootroot-desktop:~/repo_rk3588_20240508/external/rockit/build/mpi/example/mod$
二、测试:由于RK3588的rockit/VI默认不打开/关闭rk_mpi_vi_test。本文就不安排测试了!
参考资料:
https://blog.csdn.net/zfenggo/article/details/138923252
rk3568 rockit编译测试