如何在Yocto中为BeagleBone Black的U-Boot链接cryptoauthlib
在Yocto中为BeagleBone Black的U-Boot集成cryptoauthlib库遇到的问题
背景
- 正在Yocto项目中为BeagleBone Black集成Microchip的cryptoauthlib库(用于ATECC608B等TPM设备),库已成功下载编译,
build_bbb/tmp/work/beaglebone../目录下存在cryptoauthlib1和u-boot文件夹。
尝试操作与问题
修改U-Boot源码引入头文件失败
在u-boot/1_../git/arch/arm/lib/bootm.c中添加头文件引用:#include "cryptoauthlib.h" #include "secure_boot.h"编译报错,无法找到头文件,不清楚如何将cryptoauthlib库关联到U-Boot编译流程中。
用户空间编译正常,但U-Boot编译找不到头文件
- 用户空间编译测试程序的命令(可正常运行):
gcc helloworld.c -L/home/cryptoauthlib/lib/ -lcryptoauth -I/home/cryptoauthlib/lib -I/home/cryptoauthlib/app/secure_boot/ - 尝试在
arch/arm/lib/Makefile中添加CFLAGS:ccflags-y += -I${STAGING_DIR_TARGET}/usr/include/cryptoauthlib/ ccflags-y += -I${STAGING_DIR_TARGET}/usr/include/cryptoauthlib/app/secure_boot/ - 已确认
recipe-sysroot目录下存在cryptoauthlib文件夹,包含cryptoauthlib.h和app/secure_boot/secure_boot.h文件,但执行bitbake u-boot时仍提示找不到secure_boot.h;修改头文件引用为#include "app/secure_boot/secure_boot.h"后依然报错。
- 用户空间编译测试程序的命令(可正常运行):
修改u-boot.inc的尝试无效
尝试在u-boot.inc中添加编译参数:EXTRA_OEMAKE += "CFLAGS ='-i${WORKDIR}/.."或
EXTRA_OEMAKE +="INCLUDE_PATH='-I${WORKDIR}/.."执行
bitbake u-boot时连cryptoauthlib.h都无法找到。
cryptoauthlib1.bb的do_install内容
do_install() { install -d ${D}${libdir} install -m 0644 ${WORKDIR}/build/libcryptoauth.so ${D}${libdir} ln -sf libcryptoauth.so ${D}${libdir}/libcryptoauth.so.${PV} install -d ${D}${includedir}/cryptoauthlib/ cp -r ${WORKDIR}/git/lib/*.h ${D}${includedir}/cryptoauthlib/ install -d ${D}${includedir}/cryptoauthlib/app/secure_boot/ install -m 0644 ${WORKDIR}/git/app/secure_boot/*.h ${D}${includedir}/cryptoauthlib/app/secure_boot/ }
最终编译错误信息
/home/testing1/Desktop/jeffy/build_bbb/tmp/work/beaglebone_yocto-poky-linux-gnueabi/u-boot/1_2019.07-r0/git/arch/arm/lib/bootm.c:36:10: fatal error: secure_boot/secure_boot.h: No such file or directory 36 | #include <secure_boot.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make -f /home/testing1/Desktop/jeffy/build_bbb/tmp/work/beaglebone_yocto-poky-linux-gnueabi/u-boot/1_2019.07-r0/git/scripts/Makefile.build obj=drivers/block
内容的提问来源于stack exchange,提问作者Jeffy George
相关产品推荐
相关产品推荐

