参考文档:uboot_v2016 版本中fw_printenv的编译问题_arm-poky-linux-gnueabi/5.3.0/real-ld: cannot find -优快云博客
最近研究fail-safe的嵌入式软件升级方案,需要在linux环境下修改uboot中的环境变量,所以需要交叉编译uboot中的/tool/env代码,编译过程中遇到了很多问题,最终完美解决了。我的交叉编译工具用的是freescal的imx6平台提供的arm-poky-linux-gnueabi-gcc套件,该套件是由yocto平台生成的。
1.按照网上的教程,设置完交叉编译的环境变量后,执行make env (由于全局的环境变量已经设置了CROSS_COMPILE,所以此处没有传递此参数。),但编译没有通过,错误如下:
tools/env/../../lib/aes.c:28:20: fatal error: string.h: No such file or directory
找不到string.h,该文件在交叉编译工具链的/usr/inlucde目录下,原因肯定是头文件搜索路径设置有问题。于是分析/tool/env下的makefile文件,发现里面有这样的内容 :
Although it may look weird, we only replace “HOSTCC”
with “CC” here for the maximum code reuse of scripts/