first commit
This commit is contained in:
commit
d2e9facc40
383
README.md
Normal file
383
README.md
Normal file
@ -0,0 +1,383 @@
|
|||||||
|
# RK1808 Docker 服务部署说明
|
||||||
|
|
||||||
|
## 项目说明
|
||||||
|
|
||||||
|
本项目运行于 RK1808 边缘计算设备,通过 Docker 容器运行目标识别服务。
|
||||||
|
|
||||||
|
当前部署方案适用于:
|
||||||
|
|
||||||
|
* RK1808
|
||||||
|
* Debian 12 Bookworm
|
||||||
|
* Linux Kernel 4.4.194
|
||||||
|
* ARM64(aarch64)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 部署流程
|
||||||
|
|
||||||
|
部署分为两步:
|
||||||
|
|
||||||
|
## 第一步:初始化宿主机
|
||||||
|
|
||||||
|
执行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash init_host.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
主要完成以下工作:
|
||||||
|
|
||||||
|
### Docker 安装
|
||||||
|
|
||||||
|
* 安装 Docker Engine
|
||||||
|
* 安装 Buildx
|
||||||
|
* 安装 Compose 插件
|
||||||
|
* 配置 Docker 开机启动
|
||||||
|
|
||||||
|
### Docker 镜像加速
|
||||||
|
|
||||||
|
配置:
|
||||||
|
|
||||||
|
```text
|
||||||
|
https://docker.1panel.live/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Docker 存储驱动修复
|
||||||
|
|
||||||
|
强制使用:
|
||||||
|
|
||||||
|
```text
|
||||||
|
overlay2
|
||||||
|
```
|
||||||
|
|
||||||
|
关闭:
|
||||||
|
|
||||||
|
```text
|
||||||
|
containerd-snapshotter
|
||||||
|
```
|
||||||
|
|
||||||
|
避免 Docker 29.x 在 Linux Kernel 4.4 上出现构建失败。
|
||||||
|
|
||||||
|
### FFmpeg 运行库检查
|
||||||
|
|
||||||
|
检查以下依赖:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/lib/libavformat.so.58
|
||||||
|
/lib/libavcodec.so.58
|
||||||
|
/lib/libavutil.so.56
|
||||||
|
/lib/libswresample.so.3
|
||||||
|
/lib/libswscale.so.5
|
||||||
|
```
|
||||||
|
|
||||||
|
自动检查:
|
||||||
|
|
||||||
|
```text
|
||||||
|
libswscale.so.5
|
||||||
|
```
|
||||||
|
|
||||||
|
软链接是否存在。
|
||||||
|
|
||||||
|
### RK1808 NPU 驱动检查
|
||||||
|
|
||||||
|
检查:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/dev/galcore
|
||||||
|
/dev/rga
|
||||||
|
/dev/vpu_service
|
||||||
|
/dev/dri/card0
|
||||||
|
/lib/npu
|
||||||
|
```
|
||||||
|
|
||||||
|
若:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/dev/galcore
|
||||||
|
```
|
||||||
|
|
||||||
|
不存在,则自动加载:
|
||||||
|
|
||||||
|
```text
|
||||||
|
galcore.ko
|
||||||
|
```
|
||||||
|
|
||||||
|
并写入:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/etc/modules-load.d/galcore.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
实现开机自动加载。
|
||||||
|
|
||||||
|
### 最终输出
|
||||||
|
|
||||||
|
脚本结束后会输出:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Docker状态
|
||||||
|
Docker镜像加速状态
|
||||||
|
Docker存储驱动状态
|
||||||
|
FFmpeg依赖状态
|
||||||
|
NPU驱动状态
|
||||||
|
设备节点状态
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 第二步:部署项目
|
||||||
|
|
||||||
|
执行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash deploy_fire_leave.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
主要完成以下工作:
|
||||||
|
|
||||||
|
### 项目文件检查
|
||||||
|
|
||||||
|
检查:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Dockerfile
|
||||||
|
start.sh
|
||||||
|
rundocker.sh
|
||||||
|
mp4-merge_0.1.11-1_arm64.deb
|
||||||
|
models/yolov5
|
||||||
|
```
|
||||||
|
|
||||||
|
### YOLOv5 动态库检查
|
||||||
|
|
||||||
|
检查:
|
||||||
|
|
||||||
|
```text
|
||||||
|
libavformat
|
||||||
|
libavcodec
|
||||||
|
libavutil
|
||||||
|
libswresample
|
||||||
|
libswscale
|
||||||
|
```
|
||||||
|
|
||||||
|
是否缺失。
|
||||||
|
|
||||||
|
### NPU环境检查
|
||||||
|
|
||||||
|
检查:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/dev/galcore
|
||||||
|
/dev/rga
|
||||||
|
/dev/vpu_service
|
||||||
|
/dev/dri/card0
|
||||||
|
/lib/npu
|
||||||
|
```
|
||||||
|
|
||||||
|
是否正常。
|
||||||
|
|
||||||
|
### Docker 镜像构建
|
||||||
|
|
||||||
|
执行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t fire_leave:latest .
|
||||||
|
```
|
||||||
|
|
||||||
|
### 启动脚本检查
|
||||||
|
|
||||||
|
检查:
|
||||||
|
|
||||||
|
```text
|
||||||
|
rundocker.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
是否存在并具有执行权限。
|
||||||
|
|
||||||
|
### 最终输出
|
||||||
|
|
||||||
|
脚本结束后会输出:
|
||||||
|
|
||||||
|
```text
|
||||||
|
项目文件状态
|
||||||
|
动态库状态
|
||||||
|
设备节点状态
|
||||||
|
Docker镜像状态
|
||||||
|
启动脚本状态
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 启动服务
|
||||||
|
|
||||||
|
执行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./rundocker.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 历史问题记录
|
||||||
|
|
||||||
|
## 问题1:libswscale.so.5 缺失
|
||||||
|
|
||||||
|
现象:
|
||||||
|
|
||||||
|
```text
|
||||||
|
error while loading shared libraries:
|
||||||
|
libswscale.so.5
|
||||||
|
```
|
||||||
|
|
||||||
|
原因:
|
||||||
|
|
||||||
|
系统存在:
|
||||||
|
|
||||||
|
```text
|
||||||
|
libswscale.so.5.7.100
|
||||||
|
```
|
||||||
|
|
||||||
|
但缺少:
|
||||||
|
|
||||||
|
```text
|
||||||
|
libswscale.so.5
|
||||||
|
```
|
||||||
|
|
||||||
|
解决:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ln -sf /usr/lib/libswscale.so.5.7.100 /usr/lib/libswscale.so.5
|
||||||
|
ldconfig
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 问题2:Docker 29.x 构建失败
|
||||||
|
|
||||||
|
现象:
|
||||||
|
|
||||||
|
```text
|
||||||
|
failed to get xattr
|
||||||
|
operation not supported
|
||||||
|
```
|
||||||
|
|
||||||
|
原因:
|
||||||
|
|
||||||
|
Docker 29 默认启用了:
|
||||||
|
|
||||||
|
```text
|
||||||
|
containerd-snapshotter
|
||||||
|
```
|
||||||
|
|
||||||
|
而 RK1808 当前内核:
|
||||||
|
|
||||||
|
```text
|
||||||
|
4.4.194
|
||||||
|
```
|
||||||
|
|
||||||
|
兼容性较差。
|
||||||
|
|
||||||
|
错误配置:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Storage Driver: overlayfs
|
||||||
|
driver-type: io.containerd.snapshotter.v1
|
||||||
|
```
|
||||||
|
|
||||||
|
解决:
|
||||||
|
|
||||||
|
强制使用:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"features": {
|
||||||
|
"containerd-snapshotter": false
|
||||||
|
},
|
||||||
|
"storage-driver": "overlay2"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
最终状态:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Storage Driver: overlay2
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 问题3:/dev/galcore 不存在
|
||||||
|
|
||||||
|
现象:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/dev/galcore
|
||||||
|
不存在
|
||||||
|
```
|
||||||
|
|
||||||
|
原因:
|
||||||
|
|
||||||
|
系统启动后未自动加载:
|
||||||
|
|
||||||
|
```text
|
||||||
|
galcore.ko
|
||||||
|
```
|
||||||
|
|
||||||
|
解决:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
insmod /lib/modules/$(uname -r)/galcore.ko
|
||||||
|
```
|
||||||
|
|
||||||
|
写入:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "galcore" > /etc/modules-load.d/galcore.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
实现开机自动加载。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 当前验证环境
|
||||||
|
|
||||||
|
```text
|
||||||
|
系统:
|
||||||
|
Debian GNU/Linux 12 (bookworm)
|
||||||
|
|
||||||
|
架构:
|
||||||
|
aarch64
|
||||||
|
|
||||||
|
内核:
|
||||||
|
4.4.194
|
||||||
|
|
||||||
|
Docker:
|
||||||
|
29.5.2
|
||||||
|
|
||||||
|
Storage Driver:
|
||||||
|
overlay2
|
||||||
|
|
||||||
|
Cgroup:
|
||||||
|
v1
|
||||||
|
|
||||||
|
NPU驱动:
|
||||||
|
Galcore 6.4.6.5.351518
|
||||||
|
|
||||||
|
镜像:
|
||||||
|
fire_leave:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 后续批量部署建议
|
||||||
|
|
||||||
|
新设备部署仅需:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash init_host.sh
|
||||||
|
|
||||||
|
bash deploy_fire_leave.sh
|
||||||
|
|
||||||
|
./rundocker.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
无需再次手动排查 Docker、FFmpeg、NPU 驱动等环境问题。
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user