openUBMC调试工具安装指导

busybox

busybox号称linux的瑞士军刀,功能多体积少。

openubmc镜像中自带的busybox功能做了裁剪,没有telnet、i2c tools等工具,社区conan脚本仓 增加了busybox工具构建脚本,内置了telnet服务拉起功能,开发者可以按以下步骤构建和使用自定义busybox。

步骤一:构建busybox包

自定义的busybox带了一些不安全协议和功能(telnet、tftp等),未推送到社区conan仓,需要开发者单独构建,构建命令:

# 克隆conan_index仓
git clone https://gitcode.com/openUBMC/conan_index.git
# 进入源码目录
cd conan_index/recipes/busybox/all
# 构建busybox/1.34.0@openUBMC.release/stable
conan create . busybox/1.34.0@openUBMC.release/stable -pr profile.ini

伙伴可以将busybox推送到自己的conan仓:

# ` [openubmc_dev]`需要替换成自己的conan仓名(conan remote list可查询)
conan upload  busybox/1.34.0@openUBMC.release/stable -r [openubmc_dev]  -pr profile.ini

步骤二:集成busybox

在manifest.yml增加debug_dependencies调试依赖,调试依赖仅在个人构建(bingo buildbingo build -t personal)时生效。

配置示例:

debug_dependencies:
  - conan: busybox/1.34.0@openUBMC.release/stable

步骤三:使用busybox

telnet连接:自定义的busybox自带了telnet服务,可以在开发机上执行telnet [ip_addr] 23连接服务器。

其它功能:默认将busybox打包到环境上的/opt/debug/busybox,执行命令的范式是/opt/debug/busybox [function name],如:

# 查看帮助,`Currently defined functions:`章节显示了支持的功能
/opt/debug/busybox --help
# 调用工具示例:调用i2cget
/opt/debug/busybox i2cget --help

变更日志

  1. 2025.04.25: 修复 telnetd服务启动失败问题,需要更新conan_index代码,重新构建busybox包
3 个赞

自定义的busybox带了一些不安全协议和功能(telnet、tftp等),未推送到社区conan仓,需要开发者单独构建,构建命令:

# 克隆conan_index仓
git clone https://gitcode.com/openUBMC/conan_index.git
# 进入源码目录
cd conan_index/recipes/busybox/all
# 构建busybox/1.34.0@openUBMC.release/stable
conan create . busybox/1.34.0@openUBMC.release/stable

使用高可用组件版本,

执行conan create 报错

networking/tc.c: In function ‘cbq_print_opt’:
networking/tc.c:236:20: error: ‘TCA_CBQ_MAX’ undeclared (first use in this function); did you mean ‘TCA_CBS_MAX’?
236 | struct rtattr *tb[TCA_CBQ_MAX+1];
| ^~~~~~~~~~~
| TCA_CBS_MAX
networking/tc.c:236:20: note: each undeclared identifier is reported only once for each function it appears in
networking/tc.c:249:9: error: ‘TCA_CBQ_RATE’ undeclared (first use in this function); did you mean ‘TCA_TBF_RATE64’?
249 | if (tb[TCA_CBQ_RATE]) {
| ^~~~~~~~~~~~
| TCA_TBF_RATE64
networking/tc.c:255:9: error: ‘TCA_CBQ_LSSOPT’ undeclared (first use in this function)
255 | if (tb[TCA_CBQ_LSSOPT]) {
| ^~~~~~~~~~~~~~
networking/tc.c:256:48: error: dereferencing pointer to incomplete type ‘struct tc_cbq_lssopt’
256 | if (RTA_PAYLOAD(tb[TCA_CBQ_LSSOPT]) < sizeof(*lss))
| ^~~~

系统版本

cat /proc/version

Linux version 5.15.133.1-microsoft-standard-WSL2 (root@1c602f52c2e4) (gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.37) #1 SMP Thu Oct 5 21:02:42 UTC 2023

1 个赞

conan create . busybox/1.34.0@openUBMC.release/stable --pr profile.ini
来调用对应的交叉编译器

3 个赞


本来是这么处理的,感觉还是楼主的方法好啊

顺便问下,是调用的截图红框里的文件吧?其他几个什么时候会用到啊?

1 个赞

profile.dt.ini是dt模式用的,使用x86主机的编译器;profile.luajit.ini和profile.ini用产品模式用的,使用/opt/hcc_arm64le交叉编译工具链

1 个赞

文档已更新,使用-pr profile.ini指定交叉编译器。

1 个赞

debug_dependencies参数在bingo build时不生效,可以看到没有生成/opt/debug目录,实际验证也是没有生效的


1 个赞
  1. 请执行bingo -v查看bingo版本,当前bmcgo不支持debug_dependencies
1 个赞

image

1 个赞

该/usr/local/bin/bingo实际上是bmcgo带出来的命令,非openUBMC社区提供的bingo。

临时解决方案:

  1. 执行pip show conan,在回显中获取Location字段的值xxx
  2. 执行 vi xxx/bmcgo/tasks/task_build_conan.py (其中xxx为步骤1获取的Location值), 在脚本最后删除and not self.config.partner_mode行,保存并退出。
1 个赞

感谢,已验证该临时方案可行

1 个赞

conan2编译busybox:

cd conan_index/recipes2/busybox/all; 
conan create . -pr profile.ini --version 1.34.1 --user=openubmc --channel=stable