在bitbake recipe 打印消息

1. bb.debug

python go_do_unpack() {
src_uri = (d.getVar('SRC_URI') or "").split()
bb.debug("****************************************src_uri value: %s" % src_uri)

}

不要用tab键加空格

以下是转载别人的:

1、第一是Python形式,该形式可在console上打印出来: bb.plain, bb.note, bb.warn, bb.error, bb.fatal, bb.debug
举例如下:
xxx.bb或xxx.bbapend

python do_listtasks() {
    bb.debug(2, "Starting to figure out the task list")
    if noteworthy_condition:
        bb.note("There are 47 tasks to run")
    bb.debug(2, "Got to point xyz")
    if warning_trigger:
        bb.warn("Detected warning_trigger, this might be a problem later.")
    if recoverable_error:
        bb.error("Hit recoverable_error, you really need to fix this!")
    if fatal_error:
        bb.fatal("fatal_error detected, unable to print the task list")
    bb.plain("The tasks present are abc")
    bb.debug(2, "Finished figuring out the tasklist")
}

2、第二种是bash形式,该形式会在temp目录下的log中包含,需要inherit logging(base.bbclass会包含,通常不需要特意添加): bbplain, bbnote, bbwarn, bberror, bbfatal, bbdebug
举例如下:
xxx.bb或xxx.bbapend

do_configure_prepend() {
    builddir=`readlink -f ${WORKDIR}/../../../../.. | awk -F "/" '{ print $NF }'`
    bbplain "xxxxxxxxxxxxx.................. WORKDIR = ${WORKDIR}" /*此条会打印到前台,同时会打印到temp目录下的log文件里面*/
    bbplain "xxxxxxxxxxxxx.................. bbplain = ${builddir}"
    # bb.plain "xxxxxxxxxxxxx.................. bb.plain = ${builddir}"
    echo "hjkjkhkhjkhkjhjkhkjh" /*此条不会打印到前台,会打印到对应的temp目录下的log里面*/
}

附:
//${S}指出source code存放的位置
S:
build/tmp/work/aarch64-poky-linux/avs-demo/1.0-r0/git

//{D}指存放编译后生成binary的地址
D:
/build/tmp/work/aarch64-poky-linux/avs-demo/1.0-r0/image

//${bindir}指文件系统的 /usr/bin

SB:
/build/tmp/work/aarch64-poky-linux/avs-demo/1.0-r0/build

STAGING_LIBDIR:
/build/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/avs-demo/1.0-r0/recipe-sysroot/

WORKDIR:
64bit对应的目录
/build/tmp/work/aarch64-poky-linux/avs-demo/1.0-r0
32bit 对应的目录
/build/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/avs-demo/1.0-r0

install -d 指建立一个folder
install -m 指把文件收集到指定目录下,并修改权限

 

 

posted @ 2023-10-08 15:05  我家有只江小白  阅读(97)  评论(0编辑  收藏  举报