官方文档里有输出调试信息的方法。包含两种,一种是调用python的,一种是bash的。
另外,在python 函数里,调用python的log输出;在bash 函数里调用bash的log输出;不然会出错。
输出log的语句直接写在bb脚本里,但不在可被执行的python或bash函数里,会报错。
Python举例:
bsp_number = "FF002201BAA"
bb.warn(bsp_number)
33.12 Recipe Logging Mechanisms
Yocto 项目提供了多个日志函数,用于生成调试输出以及报告错误和警告。对于 Python 函数,以下日志函数可用。所有这些函数都会将日志记录到 ${T}/log.do_task,如果设置正确,还可以记录到标准输出 (stdout):
The Yocto Project provides several logging functions for producing debugging output and reporting errors and warnings. For Python functions, the following logging functions are available. All of these functions log to ${T}/log.do_task, and can also log to standard output (stdout) with the right settings:
* bb.plain(msg): 将 msg 原样写入日志,同时记录到 stdout。
* bb.note(msg): 将 "NOTE: msg "写入日志。如果使用"-v "调用 BitBake,也会将日志记录到 stdout。
* bb.debug(level,msg): 将 "DEBUG: msg "写入日志。如果日志级别大于或等于级别,也会将日志写入 stdout。更多信息请参阅《BitBake 用户手册》中的 "用法和语法 "选项。(1 Overview — Bitbake dev documentation)
* bb.warn(msg): 向日志写入 "WARNING: msg",同时将日志记录到 stdout。
* bb.error(msg): 向日志写入 "ERROR: msg",同时记录到标准输出(stdout)。
注意:
调用此函数不会导致任务失败。
* bb.fatal(msg): 此日志函数与 bb.error(msg) 类似,但也会导致调用任务失败。
注意
bb.

最低0.47元/天 解锁文章
1385

被折叠的 条评论
为什么被折叠?



