Yocto 查找定义任务的配方或 class

Yocto find the recipe or class that defines a task

我是 yocto 菜鸟,试图破译设备树是如何从 Xilinx 硬件定义 (.hdf) 文件构建的。但我的问题更笼统。

有没有yocto方法可以找到任务的来源? 给定任务名称是否可以找到任务源代码所在的位置? (大概在食谱或 class)

例如,编译设备树 blob 的 meta-xilinx-bsp 层中的配方调用的 Python 任务 do_create_yaml 的源代码在哪里?

bitbake -e device-tree

将为 do_create_yaml 转储 python 源代码(其中包含大量输出)但我如何才能找到它的来源?

设备树是 Linux 内核的一部分。在 Yocto 中,这是根据 KERNEL_DEVICETREE 变量值编译的,该变量值定义为 Linux 内核配方或机器配置的一部分。

例如,对于定义为 here

的 cubieboard7
KERNEL_DEVICETREE = "s700_cb7_linux.dtb"

指示编译使用thisdts文件进行编译。这是由 yocto 使用各种 classes 完成的。

our example中,我们在inherit kernel.bbclass中依次inherits kernel-devicetree.bbclass,在这个class中(从kernel-devicetree.bbclass复制),

do_compile_append() {
        for dtbf in ${KERNEL_DEVICETREE}; do
                dtb=`normalize_dtb "$dtbf"`
                oe_runmake $dtb
        done
}

do_install_append() {
        for dtbf in ${KERNEL_DEVICETREE}; do
                dtb=`normalize_dtb "$dtbf"`
                dtb_ext=${dtb##*.}
                dtb_base_name=`basename $dtb .$dtb_ext`
                dtb_path=`get_real_dtb_path_in_kernel "$dtb"`
                install -m 0644 $dtb_path ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext
        done
}

do_deploy_append() {
        for dtbf in ${KERNEL_DEVICETREE}; do
                dtb=`normalize_dtb "$dtbf"`

这会将任务附加到编译、安装和部署任务。所以定义 KERNEL_DEVICETREE 启用 dtb 的自动构建。

我发现数据存储包含任务的文件名作为 VarFlag, 来自 devpyshell

pydevshell> d.getVarFlags("do_create_yaml")

给予

{'filename': '.....yocto/sources/core/../meta-xilinx-tools/classes/xsctyaml.bbclass', 'lineno': '61', 'func': 1, 'task': 1, 'python': '1', 'deps':   ['do_prepare_recipe_sysroot']}

因此,对于我问题中的示例,do_create_yaml 任务的活动定义在 xsctyaml.bbclass 中。