Yocto编译Lichee Pi镜像时U-Boot 2020.01编译失败求助
解决u-boot-1_2020.01-r0编译时
yylloc重复定义的问题 先排查主机flex版本:这个冲突是新版本flex(2.6.x及以上)的特性导致的,新版flex生成的lexer代码会自动定义
yylloc,而旧版u-boot的dtc模块手动声明了该符号,引发重复定义。执行flex --version确认版本,如果是2.6+,按以下方法处理:方法一:降级flex到2.5.x版本
- 以Debian/Ubuntu系统为例:
sudo apt remove flex sudo apt install flex=2.5.35-10ubuntu1
- 以Debian/Ubuntu系统为例:
方法二:给u-boot打补丁修复符号冲突
- 在你的Yocto自定义层中创建
recipes-bsp/u-boot/u-boot_2020.01.bbappend文件 - 制作补丁文件
0001-fix-yylloc-duplicate-definition.patch,内容示例:diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y index xxxxxxx..yyyyyyy 100644 --- a/scripts/dtc/dtc-parser.y +++ b/scripts/dtc/dtc-parser.y @@ -17,7 +17,7 @@ #include "dtc-parser.tab.h" #include "data.h" -YYLTYPE yylloc; +static YYLTYPE yylloc; void yyerror(const char *fmt, ...) { - 在bbappend文件中添加补丁引用:
SRC_URI += "file://0001-fix-yylloc-duplicate-definition.patch"
- 在你的Yocto自定义层中创建
方法三:临时指定旧版flex路径(不全局修改)
- 下载编译旧版flex到本地目录,构建前临时替换PATH:
export PATH=/your/local/flex-2.5.35/bin:$PATH bitbake u-boot
- 下载编译旧版flex到本地目录,构建前临时替换PATH:
清理缓存重新构建
执行以下命令清理u-boot的编译状态后重新编译:bitbake -c cleansstate u-boot bitbake core-image-base
内容的提问来源于stack exchange,提问作者Ali
相关产品推荐
相关产品推荐

