编译u-boot报错,参考Error in standalone u-boot compilation for QorIQ T1042,standalone compilation of u-boot for T1040 using QORIQ SDK1.7,只能使用32bit工具链。编译应用tools/env时,找不到string.h。
fatal error: string.h: No such file or directory
#include
^
compilation terminated.
手动添加头文件路径到sysroot,仍无法编译,报错,发现是在arch/powerpc/config.mk里面设置了这个标志,
powerpc-fsl-linux-gcc: error: unrecognized command line option '-melf32ppclinux'
scripts/Makefile.host:108: recipe for target 'tools/env/fw_printenv' failed
grep
arch/powerpc/config.mk:20:PLATFORM_LDFLAGS += -m32 -melf32ppclinux
在env的Makefile里干掉这个,
# fw_printenv is supposed to run on the target system, which means it should be
# built with cross tools. Although it may look weird, we only replace "HOSTCC"
# with "CC" here for the maximum code reuse of scripts/Makefile.host.
#HOSTCC = powerpc-fsl-linux-gcc -m32 -mhard-float -mcpu=e6500 --sysroot=/home/zc/program/QorIQ-SDK-V2.0-20160527-yocto/fsl-qoriq/2.0/ppc/sysroots/ppce6500-fsl-linux
HOSTCC = powerpc64-fsl-linux-gcc -mhard-float -m64 -mcpu=e6500 --sysroot=/home/zc/program/QorIQ-SDK-V2.0-20160527-yocto/fsl-qoriq/2.0/ppc64/sysroots/ppc64e6500-fsl-linux
需要重新设置CC,不知道为什么CC被改变了,应该是被Makefile字符串切割了只剩powerpc-fsl-linux-gcc,导致找不到头文件等等错误,可以看到env的Makefile调用Makefile.host,在line108行执行env的编译操作。