You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

STM32MP157DK Yocto编译Busybox与i2cdetect报错求助

Yocto构建STM32MP1自定义镜像时i2cdetect编译错误解决

问题背景

按照Digikey教程基于Yocto(Dunfell版本)构建STM32MP1自定义镜像,在自定义镜像bb文件中添加IMAGE_INSTALL:append = "i2c-tools"后出现编译错误,错误日志如下:

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "stm32mp1"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1.33"
TUNE_FEATURES        = "arm vfp cortexa7 neon vfpv4 thumb callconvention-hard"
TARGET_FPU           = "hard"
meta                 
meta-poky            
meta-yocto-bsp       = "dunfell:63d05fc061006bf1a88630d6d91cdc76ea33fbf2"
meta-oe              
meta-python          = "dunfell:01358b6d705071cc0ac5aefa7670ab235709729a"
meta-st-stm32mp      = "dunfell:a8d55e2fe13d6be03222f45b3115a96938b2553a"
meta-custom          = "<unknown>:<unknown>"

WARNING: /home/raymond/Projects/yocto/poky/meta/recipes-core/busybox/busybox_1.31.1.bb:do_compile is tainted from a forced run                                                                      | ETA:  0:00:00
Initialising tasks: 100% |##########################################################################################################################################################################| Time: 0:00:01
Sstate summary: Wanted 22 Found 0 Missed 22 Current 1191 (0% match, 98% complete)
NOTE: Executing Tasks
ERROR: busybox-1.31.1-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:ptest_update_alternatives(d)
     0003:
File: '/home/raymond/Projects/yocto/poky/meta/classes/ptest.bbclass', lineno: 98, function: ptest_update_alternatives
     0094:        for alt_name, alt_link, alt_target, _ in alternatives:
     0095:            # Some alternatives are for man pages,
     0096:            # check if the alternative is in PATH
     0097:            if os.path.dirname(alt_link) in bin_paths:
 *** 0098:                os.symlink(alt_target, os.path.join(ptest_bindir, alt_name))
     0099:}
     0100:
     0101:do_configure_ptest_base[dirs] = "${B}"
     0102:do_compile_ptest_base[dirs] = "${B}"
Exception: FileExistsError: [Errno 17] File exists: '/bin/busybox.suid' -> '/home/raymond/Projects/yocto/build-mp1/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/busybox/1.31.1-r0/package/usr/lib/busybox/ptest/bin/i2cdetect'

ERROR: Logfile of failure stored in: /home/raymond/Projects/yocto/build-mp1/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/busybox/1.31.1-r0/temp/log.do_package.36688
ERROR: Task (/home/raymond/Projects/yocto/poky/meta/recipes-core/busybox/busybox_1.31.1.bb:do_package) failed with exit code '1'

解决方案

核心原因

Busybox默认包含精简版的i2cdetect工具,同时安装Busybox和i2c-tools时,Busybox的ptest功能在创建符号链接时会与i2c-tools的同名工具产生冲突。

方法1:禁用Busybox中的i2c组件

在自定义层中创建recipes-core/busybox/busybox_%.bbappend文件,添加以下内容:

PACKAGECONFIG_remove = "i2c"

该配置会移除Busybox内置的所有i2c相关工具,避免与i2c-tools的工具冲突。

方法2:禁用Busybox的ptest测试功能

如果不需要Busybox的ptest测试套件,可在build/conf/local.conf中添加:

PTEST_ENABLED = "0"

或者在Busybox的bbappend文件中添加:

PACKAGECONFIG_remove = "ptest"

方法3:清理缓存后重新构建

执行以下命令清理Busybox和i2c-tools的构建缓存,再重新编译镜像:

bitbake -c cleansstate busybox
bitbake -c cleansstate i2c-tools
bitbake <你的自定义镜像名称>

内容的提问来源于stack exchange,提问作者Raymond Anengoni Mango

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 04:14:51