yocto:do_validate_branches() 在 linux-yocto-custom 中使用 SRCREV="${AUTOREV}" 失败

yocto: do_validate_branches() failure using SRCREV="${AUTOREV}" in a linux-yocto-custom

我正在设置 yocto v1.7.1 "dizzy" 以从签入我的本地 git 存储库的自定义 Linux 内核版本构建自定义 Linux 图像。

构建过程在 do_validate_branches() 期间失败,并显示以下错误消息。

DEBUG: Executing shell function do_validate_branches
usage: git cat-file (-t|-s|-e|-p|<type>|--textconv) <object>
   or: git cat-file (--batch|--batch-check) < <list_of_objects>

<type> can be one of: blob, tree, commit, tag
    -t                    show object type
    -s                    show object size
    -e                    exit with zero when there's no error
    -p                    pretty-print object's content
    --textconv            for blob objects, run textconv on object's content
    --batch[=<format>]    show info and content of objects fed from the standard input
    --batch-check[=<format>]
                          show info about objects fed from the standard input

ERROR:  is not a valid commit ID.
ERROR: The kernel source tree may be out of sync
WARNING: exit code 1 from a shell command.
ERROR: Function failed: do_validate_branches (log file is located at etc..)

查看为 do_validate_branches 生成的代码,问题似乎是因为它正在调用 git cat-file -t ${machine_srcrev},但 ${machine_srcrev} 是一个空字符串。此外,这似乎是因为我在 linux-yocto-custom.bb

中使用了以下内容
SRCREV="${AUTOREV}"

因为当我用修订号替换它时我不再遇到问题,例如...

SRCREV="7035c2a67d964acbb5d917f470bcda42691a3d9c"

问题是我实际上想要这个配方从分支的 HEAD 构建,所以放置一个特定的修订似乎不是我所追求的,SRCREV="${AUTOREV}" 似乎是我真正想要的想。但是如上所述,这使得 ${SRCREV_machine} 是一个空字符串,而不是 AUTOINC 我认为它应该评估为。

任何人都可以告诉我如何让食谱既跟随头部又不必不断更新食谱以包含正确的 SRCREV 并让它通过 do_validate_branches() 吗?我在这里错过了什么?

编辑:更多信息...

如果我按如下方式修改我的 kernel-yocto.bbclass,问题似乎也得到解决... @285

-    machine_srcrev="${SRCREV_machine}" 
+    machine_srcrev="${@ get_machine_branch(d, "${SRCREV}" )}"

我对我的更改的理解是我正在明确地从我的机器分支中重新获取 $SRCREV。原文似乎认为已经存储在 ${SRCREV_machine} 中。尽管原始结果为空字符串,而我的更改结果为 AUTOINC.

虽然我仍然认为我一定遗漏了一些东西,因为我不需要编辑基础 类。但我总是更倾向于认为我遗漏了什么,而不是这是一个错误。也许我应该将其发布到某处的 yocto 邮件列表中。

在 yocto 邮件列表上进行了一些小讨论之后... http://thread.gmane.org/gmane.linux.embedded.yocto.general/24316

总结:

目前看来do_validate_branches()中的逻辑还不够充分

特别是 SRCREV_machine 在到达 do_validate_branches() 时似乎没有正确设置,至少在我使用 linux 的情况下是这样-yocto-custom.bb 并尝试使用 SRCREV="${AUTOREV}" 跟踪源分支的头部。目前正在查看和修改,希望 v1.8 发布。

一个好的解决方法是在 linux-yocto-custom.bb 中设置 SRCREV_machine。特别是,您可以在设置 SRCREV 变量后直接将其设置为与行中的 SRCREV 变量相同的值。这样看起来...

SRCREV="${AUTOREV}"
SRCREV_machine="${AUTOREV}"    # or SRCREV_machine="${SRCREV}"

请记住,最终当您锁定正在构建的源版本并将 "${AUTOREV}" 替换为特定修订版时,此问题就会消失。

因此,当您构建的源代码仍在进行中时,此解决方法仅对开发构建是必要的,因此您想使用 "${AUTOREV}" 来跟踪移动头。