- 沙箱 S600(rdk-sandbox 会话制)K3s v1.31.14+k3s1 全链路闭环:板上现编 64 模块全数装载(含官方签名),节点 s600-sbx-board Ready,flannel vxlan UP,nginx 双副本 + ClusterIP 集群内访问通过,整机 reboot 后模块自载、 k3s 自启、节点回归 Ready、工作负载自动恢复 - 「同串不同体」实测事故:vermagic 与办公室基板逐字符一致的别板 .ko 直接 装载两次打崩内核(ip_set_net_init/nfnl_queue_net_init pernet Oops, pstore 留痕);根因为同版本串不同构建(CONFIG_IPV6=m 等差异致结构体 布局错位)。结论:vermagic 一致只是必要条件,非同镜像板一律现编 - kmods-src 补 3 处源码遗漏(沙箱板复现暴露): * udp/ + ip6_udp_tunnel.c(IPv6=m 内核 vxlan 硬依赖,缺则 Unknown symbol) * misc/ + xt_multiport.c(k3s kube-router 硬依赖,缺则启动 Fatalf 循环) * misc/ + xt_statistic.c(SOP §6 记载的统计匹配,源码未随库收录) - 文档:README 同串不同体警示 + 板卡登记新增 S600-沙箱;nashp 说明新增 §6 复现记录与踩坑点 5;编译 SOP §4.2 增补;K3s SOP xt_multiport 前提 与境内镜像源 registries.yaml 配置
Docker 一键安装脚本
支持平台
| 硬件平台 | BPU 架构 | RDK OS 版本要求 | MiniBoot 版本要求 |
|---|---|---|---|
| RDK S100 / RDK S100P | Nash-e / Nash-m | >= 4.0.4-Beta | >= 4.0.4-20251015222314 |
| RDK X5 / RDK X5 Module | Bayes-e | >= 3.3.3 | >= Sep-03-2025 |
| RDK S600 | Nash-p | >= 5.1.0 | 无特殊要求 |
安装脚本自动检测系统 Ubuntu 版本(22.04 / 24.04)并适配,RDK S600 的 RDK OS V5.1.0 基于 Ubuntu 24.04。
安装
脚本路径 RDK_Docker_Tools/install_docker/install_docker.sh,该脚本会在 RDK 板端一键安装 Docker 软件,配置好网络相关配置。
- 安装到使用过程无需重启。
- 安装过程中 eth0 网络配置不会做任何修改,ssh 不会挂掉。
- 请使用 root 用户安装。
- 请确保板卡能正常访问互联网,
/目录有 2GB 可用空间。
bash install_docker/install_docker.sh
预期输出
============================================================
Docker 一键安装脚本 (Ubuntu 24.04 rdk os noble ARM64/x86_64)
============================================================
[INFO] 检测 Ubuntu 版本...
[OK] Ubuntu 基础版本: 24.04 (rdk os noble) ✓
[INFO] 检查系统架构...
[OK] 架构: aarch64 (ARM64) ✓
[INFO] 检查运行权限...
[OK] 当前为 root 用户 ✓
[INFO] 检查 eth0 网络接口...
[OK] eth0 状态: UP, IP: 10.112.10.98/24
[INFO] 注意: 本脚本不会修改 eth0 的任何配置
[INFO] 检查 Docker 是否已安装...
[INFO] 检查依赖命令...
...
[OK] Docker 安装完毕 ✓
[INFO] 配置 Docker 镜像加速源...
[OK] 镜像加速配置完毕 ✓
[INFO] 启动 Docker 服务...
[OK] Docker 服务已通过 systemd 启动 ✓
...
============================================================
[OK] Docker 安装完成!
============================================================
测试
bash install_docker/test_docker.sh
预期输出
============================================================
Docker 功能测试脚本
============================================================
[INFO] 检查 Docker 服务状态...
[OK] Docker 服务正常 ✓
------------------------------------------------------------
[INFO] [1/5] 测试 docker pull...
------------------------------------------------------------
[OK] docker pull 成功 ✓
------------------------------------------------------------
[INFO] [2/5] 测试 docker run...
------------------------------------------------------------
[OK] docker run 成功 ✓
------------------------------------------------------------
[INFO] [3/5] 测试 docker commit...
------------------------------------------------------------
[OK] docker commit 成功 -> hello-world-committed:test ✓
------------------------------------------------------------
[INFO] [4/5] 测试 docker export...
------------------------------------------------------------
[OK] docker export 成功 ✓
------------------------------------------------------------
[INFO] [5/5] 测试 docker save & load...
------------------------------------------------------------
[OK] docker save 成功 ✓
[OK] docker load 成功, 镜像已恢复 ✓
============================================================
[OK] 全部测试通过!
============================================================
BPU 模型性能测试工具
工具说明
基于 hrt_model_exec perf 命令,对指定的 .hbm 或 .bin 模型文件,分别在线程数 1、2、3、4 下进行性能测试,输出每个线程数对应的平均延迟和 FPS,并将结果保存为 JSON 文件。
| 硬件平台 | BPU 架构 | 镜像名称 |
|---|---|---|
| RDK S100 / RDK S100P | Nash-e / Nash-m | hrt_perf_nashem:<yymmdd_HHMMSS> |
| RDK X5 / RDK X5 Module | Bayes-e | hrt_perf_bayese:<yymmdd_HHMMSS> |
| RDK S600 | Nash-p | hrt_perf_nashp:<yymmdd_HHMMSS> |
目录结构
examples/bpu_model_perf/
├── nashem/ # S100: Dockerfile + build.sh + run.sh + test.sh + workspace/ + example_fs/
├── bayese/ # X5: 同上
└── nashp/ # S600: 同上 (base 为 ubuntu:24.04)
│ ├── input/
│ │ ├── task.json # 输入协议文件
│ │ └── *.hbm # 模型文件(放在此处)
│ └── output/
│ └── result.json # 运行后自动生成
├── example_fs_bayese/ # RDK X5 示例输入输出
│ ├── input/
│ │ ├── task.json # 输入协议文件
│ │ └── *.hbm / *.bin # 模型文件(放在此处)
│ └── output/
│ └── result.json # 运行后自动生成
└── example_fs_nashp/ # RDK S600 示例输入输出
├── input/
│ ├── task.json # 输入协议文件
│ └── *.hbm # 模型文件(放在此处)
└── output/
└── result.json # 运行后自动生成
预打包版本
# RDK X5 / RDK X5 module
docker pull ccr-29eug8s3-pub.cnc.bj.baidubce.com/public/hrt_perf_bayese:<yymmdd_HHMMSS>
# RDK S100 / RDK S100P
docker pull ccr-29eug8s3-pub.cnc.bj.baidubce.com/public/hrt_perf_nashem:<yymmdd_HHMMSS>
RDK S600 暂无预打包镜像,需在 S600 板端通过 docker_build_nashp.sh 自行构建。
RDK S100 系列使用方法(Nash-e / Nash-m)
第一步:构建镜像(只需构建一次,之后可直接交付镜像)
cd examples/bpu_model_perf/<nashem|bayese|nashp>
bash build.sh
构建脚本会自动从板子上找到 hrt_model_exec(which hrt_model_exec)并打包进镜像,无需手动操作。
第二步:准备输入
将模型文件(.hbm)放入 example_fs/input/,并编辑 example_fs/input/task.json:
{
"model_relative_path": "your_model.hbm",
"frame_count": 200
}
第三步:运行
bash run.sh
运行脚本将 example_fs/input 挂载为容器内 /workspace/input,example_fs/output 挂载为 /workspace/output。
预期输出
============================================================
task.json content:
{
"model_relative_path": "yolo11n_detect_nashe_640x640_nv12.hbm",
"frame_count": 200
}
============================================================
[OK] 1 model(s) validated, frame_count=200
[Benchmarking] yolo11n_detect_nashe_640x640_nv12.hbm (/workspace/input/yolo11n_detect_nashe_640x640_nv12.hbm)
thread_num=1 ... FPS=625.20 avg_latency=1.538ms
thread_num=2 ... FPS=1133.43 avg_latency=1.703ms
thread_num=3 ... FPS=1171.23 avg_latency=2.482ms
thread_num=4 ... FPS=1167.98 avg_latency=3.322ms
================================================================================
+---------------------------------------+-----------+------------------+------------+
| Model | Threads | Avg Latency(ms) | FPS |
+---------------------------------------+-----------+------------------+------------+
| yolo11n_detect_nashe_640x640_nv12.hbm | 1 | 1.538 | 625.20 |
| | 2 | 1.703 | 1133.43 |
| | 3 | 2.482 | 1171.23 |
| | 4 | 3.322 | 1167.98 |
+---------------------------------------+-----------+------------------+------------+
Results saved to: /workspace/output/result.json
RDK X5 系列使用方法(Bayes-e)
第一步:构建镜像
cd examples/bpu_model_perf/<nashem|bayese|nashp>
bash build.sh
第二步:准备输入
将模型文件(.hbm 或 .bin)放入 example_fs_bayese/input/,并编辑 example_fs_bayese/input/task.json:
{
"model_relative_path": "your_model.hbm",
"frame_count": 200
}
第三步:运行
bash run.sh
RDK S600 使用方法(Nash-p)
RDK S600 的 RDK OS V5.1.0 基于 Ubuntu 24.04 (glibc 2.39),因此镜像 base 为 ubuntu:24.04(22.04 基底的 glibc 2.35 无法运行 S600 宿主机上的 BPU 工具链)。
第一步:构建镜像(只需构建一次,之后可直接交付镜像)
cd examples/bpu_model_perf/<nashem|bayese|nashp>
bash build.sh
构建脚本会自动从板子上找到 hrt_model_exec(which hrt_model_exec)并打包进镜像,无需手动操作。
第二步:准备输入
将模型文件(.hbm)放入 example_fs_nashp/input/,并编辑 example_fs_nashp/input/task.json:
{
"model_relative_path": "your_model.hbm",
"frame_count": 200
}
第三步:运行
bash run.sh
运行脚本将 example_fs_nashp/input 挂载为容器内 /workspace/input,example_fs_nashp/output 挂载为 /workspace/output,并默认向容器注入评测 L2 Cache 环境变量 HB_DNN_USER_DEFINED_L2M_SIZES=6:6:6:6(宿主机已设置该变量时使用宿主机的值)。
交互式进入容器
镜像内置了 hrt_model_exec 等 BPU 工具,可以交互式进入容器手动调试模型。
RDK S100(Nash-e / Nash-m)
cd examples/bpu_model_perf/<nashem|bayese|nashp>
bash test.sh
RDK X5(Bayes-e)
cd examples/bpu_model_perf/<nashem|bayese|nashp>
bash test.sh
RDK S600(Nash-p)
cd examples/bpu_model_perf/<nashem|bayese|nashp>
bash test.sh
进入容器后可直接使用 hrt_model_exec,例如:
# 查看帮助
hrt_model_exec --help
# 手动跑 perf
hrt_model_exec perf --model_file /workspace/input/xxx.hbm --thread_num 2 --frame_count 200
# 手动跑推理
hrt_model_exec infer --model_file /workspace/input/xxx.hbm --input_file input.jpg
容器以
--privileged模式启动,宿主机的/usr/hobot、/opt/hobot等目录均已挂载,库文件与板子上完全一致。退出容器后自动删除(--rm)。
task.json 协议说明
支持两种格式:
单模型
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model_relative_path |
string | 是 | 模型文件名,相对于 input 目录,后缀必须为 .hbm 或 .bin |
frame_count |
int | 否 | 测试帧数,默认 200 |
{
"model_relative_path": "model.hbm",
"frame_count": 200
}
多模型
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
models |
list | 是 | 模型列表 |
models[].path |
string | 是 | 模型文件名,相对于 input 目录 |
models[].name |
string | 否 | 显示名称,默认取文件名 |
frame_count |
int | 否 | 测试帧数,默认 200 |
{
"models": [
{"name": "model_a", "path": "model_a.hbm"},
{"name": "model_b", "path": "model_b.bin"}
],
"frame_count": 200
}
注意:
model_relative_path和models不能同时出现。
输出结果说明
结果保存在 output/result.json,结构如下:
[
{
"model_name": "model.hbm",
"model_path": "/workspace/input/model.hbm",
"perf_results": [
{
"thread_num": 1,
"frame_count": 200,
"run_time_ms": 320.18,
"total_latency_ms": 307.53,
"avg_latency_ms": 1.538,
"fps": 625.197,
"raw_output": "...",
"returncode": 0
}
]
}
]
CoreMark-PRO CPU 性能测试工具
工具说明
基于 CoreMark-PRO 标准 CPU 性能测试套件,对 ARM 处理器进行全面性能测试。测试包含 9 个典型工作负载,自动检测 CPU 核心数并在 1 到最大核心数之间进行多线程性能测试,最终输出 CoreMark-PRO 综合得分。
| 硬件平台 | 架构 | 镜像名称 |
|---|---|---|
| 所有 ARM 平台 | ARMv8 / aarch64 | coremark_pro_rdk_arm:latest |
CoreMark-PRO 包含以下 9 个工作负载:
- cjpeg-rose7-preset - JPEG 压缩
- core - 增强版 CoreMark
- linear_alg-mid-100x100-sp - 线性代数(单精度浮点)
- loops-all-mid-10k-sp - Livermore Loops(单精度浮点)
- nnet_test - 神经网络
- parser-125k - XML 解析
- radix2-big-64k - FFT(双精度浮点)
- sha-test - SHA-256 哈希
- zip-test - ZIP 压缩
目录结构
examples/coremark/any/
├── Dockerfile build.sh run.sh test.sh
├── workspace/
│ ├── coremark_perf.py # 性能测试主脚本
│ └── entrypoint.sh # 容器入口脚本
├── coremark-pro/ # CoreMark-PRO 源代码
│ └── builds/linux64/gcc64/bin/ # 预编译的二进制文件
└── example_fs/
└── output/ # 默认输出目录
└── result.json # 运行后自动生成
使用方法
第一步:构建镜像(只需构建一次)
cd examples/coremark/any
bash docker_build.sh
第二步:运行
bash docker_run.sh
运行脚本将 example_fs/output 挂载为容器内 /workspace/output。
预期输出
==========================================
CoreMark-PRO CPU Performance Benchmark
==========================================
==========================================================================================
System Information
==========================================================================================
Hostname: xxxxxxxx
Platform: Linux-6.1.83-aarch64-with-glibc2.35
Architecture: aarch64
CPU Model: aarch64
CPU Count: 8 logical, 8 physical
CPU Frequency: 1800 MHz
Memory Total: 5768 MB
Memory Used: 48.2%
Timestamp: 2026-03-20 11:37:11
==========================================================================================
[Benchmark] Running CoreMark-PRO with thread counts: [1, 2, 3, 4, 5, 6, 7, 8]
[Benchmark] Total workloads: 9
--- Running with 1 thread(s) ---
[1 threads] cjpeg-rose7-preset ... 59.88 iter/s
[1 threads] core ... 0.46 iter/s
[1 threads] linear_alg-mid-100x100-sp ... 24.74 iter/s
...
==========================================================================================
CoreMark-PRO Workload Results
==========================================================================================
Workload T=1 T=2 T=3 T=4 ... Scaling
------------------------------------------------------------------------------------------
cjpeg-rose7-preset 59.88 117.65 169.49 232.56 ... 7.26
core 0.46 0.91 1.37 1.82 ... 6.07
...
==========================================================================================
==========================================================================================
CoreMark-PRO Score Summary
==========================================================================================
Threads CoreMark-PRO Score
------------------------------------------------------------------------------------------
1 1390.51
2 2684.16
...
8 7027.42
------------------------------------------------------------------------------------------
Final CoreMark-PRO Score 7027.42
==========================================================================================
[OK] Results saved to: /workspace/output/result.json
[OK] CoreMark-PRO Score: 7027.42
输出结果说明
结果保存在 example_fs/output/result.json,结构如下:
{
"system_info": {
"cpu": {
"cpu_count": 8,
"cpu_count_physical": 8,
"cpu_freq_mhz": 1800.0,
"cpu_model": "aarch64",
"architecture": "aarch64"
},
"memory": {
"total_mb": 5768,
"available_mb": 2985,
"percent_used": 48.2
},
"system": {
"hostname": "rdk-board",
"platform": "Linux-6.1.83-aarch64",
"timestamp": "2026-03-20 11:37:11"
}
},
"benchmark_config": {
"workloads": ["cjpeg-rose7-preset", "core", ...],
"thread_counts": [1, 2, 3, 4, 5, 6, 7, 8],
"max_threads": 8
},
"results": [
{
"workload": "cjpeg-rose7-preset",
"thread_num": 1,
"iter_per_sec": 59.88,
"returncode": 0,
"elapsed_time_sec": 0.17
}
],
"coremark_pro_score": 7027.42
}
| 字段 | 说明 |
|---|---|
system_info |
系统信息(CPU、内存、平台等) |
benchmark_config |
测试配置(workload 列表、线程数等) |
results |
每个 workload 在不同线程数下的性能数据 |
coremark_pro_score |
最终 CoreMark-PRO 综合得分 |
/app 案例基础镜像(app_base)
app_base 工具说明
覆盖板卡 /app 目录全部案例的基础镜像与运行框架。镜像内只包含通用开发运行环境(工具链、python、调试工具),板卡专属的库、工具、模型、案例全部由运行脚本从宿主机只读挂载进容器,保证容器环境与板上固件版本永远一致。
| 硬件平台 | BPU 架构 | 镜像 base | 镜像名称 |
|---|---|---|---|
| RDK S600 | Nash-p | ubuntu:24.04 | app_base_nashp:v1.0.0 |
| RDK S100 / RDK S100P | Nash-e / Nash-m | ubuntu:22.04 | app_base_nashem:v1.0.0 |
| RDK X5 / RDK X5 Module | Bayes-e | ubuntu:22.04 | app_base_bayese:v1.0.0 |
镜像特点:
- 案例精确可分开执行:BPU、GPU、VPU、VDSP/DSP、相机 VIO、IPC 外设、共享内存等硬件单元各有独立的设备透传集合,互不混入。
- 日常使用体验:容器内 PATH 已包含
/usr/hobot/bin(hrt_model_exec、hbtop等命令直接可用),LD_LIBRARY_PATH、CPATH、LIBRARY_PATH按板卡环境配置,/app案例无需改 Makefile 即可在容器内编译运行,板卡 python 包(hbm_runtime 等)可直接 import。
app_base 目录结构
examples/
├── common/app_base_common.sh # 公共库: 板型检测/挂载构建/按单元设备集
├── app_base/any/ # 基础镜像 Dockerfile + build.sh + shell.sh + bench.sh
│ └── output/<family>/ # 三板测试报告与基准产物
├── <bpu|gpu|vpu|dsp|hbmem|mcu>/any/ # 硬件单元案例: Dockerfile + build.sh + run.sh + selftest.sh
app_base 使用方法
在目标板卡上构建(自动识别板型并选择 base):
cd examples/app_base/any
bash build.sh
按硬件单元交互式进入容器:
cd examples/app_base/any
bash shell.sh bpu # BPU 推理
bash shell.sh gpu # GPU (OpenCL/GLES)
bash shell.sh vpu # 视频编解码
bash shell.sh dsp # DSP (S600/S100 为 VDSP, X5 为 aDSP)
bash shell.sh vio # 相机/ISP 通路
bash shell.sh mcu # MCU 协处理器 (经 IPCF, i2c/spi/uart/gpio/can)
bash shell.sh hbmem # 共享内存
bash shell.sh all # 特权模式全量透传
app_base 基准对比
cd examples/app_base/any
bash bench.sh all # 或指定单元: bpu gpu vpu vdsp hbmem
对 /app 下的代表性案例(BPU 推理、OpenCL、VPU 编码、VDSP、共享内存),在宿主机与容器内分别编译运行并对比。容器侧日志由容器经挂载直接写入 examples 目录(穿透),与宿主侧日志并列保存。测试结论见 examples/app_base/any/output/<板型>/report.md。
板端运行时镜像(runtime,全内置)
runtime 工具说明
examples/runtime/ 制作全内置的板端运行时镜像 rdk_runtime_<family>,与
app_base 的"通用镜像 + 运行时挂载宿主目录"路线相反:TROS/ROS/hobot 栈通过与宿主机
相同的 apt 源(d-robotics 专属源 + tuna ros2 源)安装进镜像,/app 全量案例与
hbm_runtime/Hobot.GPIO 硬件 python 包从目标板拷贝(附 sha256 清单可回验一致性),
运行时仅透传设备节点,不 bind-mount 任何宿主目录。
| family | 板卡 | BASE | d-robotics suite | ROS |
|---|---|---|---|---|
| nashem | S100 / S100P | ubuntu:22.04 | ubuntu-rdk-s100-beta (jammy) | humble |
| nashp | RDK S600 | ubuntu:24.04 | ubuntu-rdk-s600-beta (noble) | jazzy |
runtime 使用方法
在目标板上执行(构建即以该板真实运行环境为基准):
cd examples/runtime
bash build.sh # 组装上下文并构建 (默认锁宿主机 apt 版本, 源内无该版本时用 --no-pin)
bash verify.sh # 零挂载容器内自测 (BPU 推理/TROS/python/APP 一致性, 必须全绿)
bash run.sh # 交互式进容器 (已加载 TROS 环境); -d 为 sshd 常驻 (2222->22)
设计说明与已知边界见 examples/runtime/README.md。