python - 使用 yocto 为 Raspberry pi 3 构建图像时出现解析错误

标签 python linux raspberry-pi yocto

我正在尝试通过引用 this 使用 yocto 为 Raspberry pi 3 构建图像,在运行 bitbake 命令时出现以下错误。

在错误日志中,它说执行 python 函数时出错,但没有关于错误的详细信息,我可以看到异常 “异常:TypeError:getVar() 至少需要 3 个参数(给定 2 个)” 。但是在 yocto 的很多地方我都可以看到 getVar 只接受两个参数。

你能指导解决这个问题吗?我可以在很多地方看到 d.getVar(),你能告诉我这里的 d 是什么吗,我在 yocto 文档中进行了搜索,但没有找到任何解释什么是 d 的信息。

ERROR: /home/ubuntu/raspberryYocto/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.9.bb: Error executing a python function in <code>:

The stack trace of python calls that resulted in this exception/failure was: File: '<code>', lineno: 17, function: <module>
     0013:__anon_146__home_ubuntu_raspberryYocto_poky_meta_classes_siteinfo_bbclass(d)
     0014:__anon_381__home_ubuntu_raspberryYocto_poky_meta_classes_kernel_yocto_bbclass(d)
     0015:__anon_6__home_ubuntu_raspberryYocto_poky_meta_recipes_kernel_linux_linux_dtb_inc(d)
     0016:__anon_148__home_ubuntu_raspberryYocto_meta_raspberrypi_recipes_kernel_linux_linux_rpi_inc(d)  *** 0017:__anon_39__home_ubuntu_raspberryYocto_meta_raspberrypi_recipes_kernel_linux_linux_raspberrypi_inc(d) File: '/home/ubuntu/raspberryYocto/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc', lineno: 38, function:
__anon_39__home_ubuntu_raspberryYocto_meta_raspberrypi_recipes_kernel_linux_linux_raspberrypi_inc
     0034:# See http://www.yoctoproject.org/docs/current/bitbake-user-manual/bitbake-user-manual.html#anonymous-python-functions
     0035:python __anonymous () {
     0036:    kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
     0037:    kerneldt = get_dts(d, d.getVar('LINUX_VERSION', True))  *** 0038:    d.setVar("KERNEL_DEVICETREE", kerneldt)
     0039:}
     0040:
     0041:do_kernel_configme_prepend() {
     0042:    install -m 0644 ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} ${WORKDIR}/defconfig || die "No default configuration for ${MACHINE} / ${KERNEL_DEFCONFIG} available." File: '/home/ubuntu/raspberryYocto/meta-raspberrypi/classes/linux-raspberrypi-base.bbclass', lineno: 6, function: get_dts
     0002:
     0003:def get_dts(d, ver=None):
     0004:    import re
     0005:  *** 0006:    staging_dir = d.getVar("STAGING_KERNEL_BUILDDIR")
     0007:    dts = d.getVar("KERNEL_DEVICETREE")
     0008:
     0009:    # d.getVar() might return 'None' as a normal string
     0010:    # leading to 'is None' check isn't enough. Exception: TypeError: getVar() takes at least 3 arguments (2 given)

ERROR: Failed to parse recipe: /home/ubuntu/raspberryYocto/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.9.bb ERROR: /home/ubuntu/raspberryYocto/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.4.bb: Error executing a python function in <code>:

The stack trace of python calls that resulted in this exception/failure was: File: '<code>', lineno: 17, function: <module>
     0013:__anon_146__home_ubuntu_raspberryYocto_poky_meta_classes_siteinfo_bbclass(d)
     0014:__anon_381__home_ubuntu_raspberryYocto_poky_meta_classes_kernel_yocto_bbclass(d)
     0015:__anon_6__home_ubuntu_raspberryYocto_poky_meta_recipes_kernel_linux_linux_dtb_inc(d)
     0016:__anon_148__home_ubuntu_raspberryYocto_meta_raspberrypi_recipes_kernel_linux_linux_rpi_inc(d)  *** 0017:__anon_39__home_ubuntu_raspberryYocto_meta_raspberrypi_recipes_kernel_linux_linux_raspberrypi_inc(d) File: '/home/ubuntu/raspberryYocto/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc', lineno: 38, function:
__anon_39__home_ubuntu_raspberryYocto_meta_raspberrypi_recipes_kernel_linux_linux_raspberrypi_inc
     0034:# See http://www.yoctoproject.org/docs/current/bitbake-user-manual/bitbake-user-manual.html#anonymous-python-functions
     0035:python __anonymous () {
     0036:    kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
     0037:    kerneldt = get_dts(d, d.getVar('LINUX_VERSION', True))  *** 0038:    d.setVar("KERNEL_DEVICETREE", kerneldt)
     0039:}
     0040:
     0041:do_kernel_configme_prepend() {
     0042:    install -m 0644 ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} ${WORKDIR}/defconfig || die "No default configuration for ${MACHINE} / ${KERNEL_DEFCONFIG} available." File: '/home/ubuntu/raspberryYocto/meta-raspberrypi/classes/linux-raspberrypi-base.bbclass', lineno: 6, function: get_dts
     0002:
     0003:def get_dts(d, ver=None):
     0004:    import re
     0005:  *** 0006:    staging_dir = d.getVar("STAGING_KERNEL_BUILDDIR")
     0007:    dts = d.getVar("KERNEL_DEVICETREE")
     0008:
     0009:    # d.getVar() might return 'None' as a normal string
     0010:    # leading to 'is None' check isn't enough. Exception: TypeError: getVar() takes at least 3 arguments (2 given)

ERROR: /home/ubuntu/raspberryYocto/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_dev.bb: Error executing a python function in <code>:

The stack trace of python calls that resulted in this exception/failure was: File: '<code>', lineno: 17, function: <module>
     0013:__anon_146__home_ubuntu_raspberryYocto_poky_meta_classes_siteinfo_bbclass(d)
     0014:__anon_381__home_ubuntu_raspberryYocto_poky_meta_classes_kernel_yocto_bbclass(d)
     0015:__anon_6__home_ubuntu_raspberryYocto_poky_meta_recipes_kernel_linux_linux_dtb_inc(d)
     0016:__anon_148__home_ubuntu_raspberryYocto_meta_raspberrypi_recipes_kernel_linux_linux_rpi_inc(d)  *** 0017:__anon_39__home_ubuntu_raspberryYocto_meta_raspberrypi_recipes_kernel_linux_linux_raspberrypi_inc(d) File: '/home/ubuntu/raspberryYocto/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc', lineno: 38, function:
__anon_39__home_ubuntu_raspberryYocto_meta_raspberrypi_recipes_kernel_linux_linux_raspberrypi_inc
     0034:# See http://www.yoctoproject.org/docs/current/bitbake-user-manual/bitbake-user-manual.html#anonymous-python-functions
     0035:python __anonymous () {
     0036:    kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
     0037:    kerneldt = get_dts(d, d.getVar('LINUX_VERSION', True))  *** 0038:    d.setVar("KERNEL_DEVICETREE", kerneldt)
     0039:}
     0040:
     0041:do_kernel_configme_prepend() {
     0042:    install -m 0644 ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} ${WORKDIR}/defconfig || die "No default configuration for ${MACHINE} / ${KERNEL_DEFCONFIG} available." File: '/home/ubuntu/raspberryYocto/meta-raspberrypi/classes/linux-raspberrypi-base.bbclass', lineno: 6, function: get_dts
     0002:
     0003:def get_dts(d, ver=None):
     0004:    import re
     0005:  *** 0006:    staging_dir = d.getVar("STAGING_KERNEL_BUILDDIR")
     0007:    dts = d.getVar("KERNEL_DEVICETREE")
     0008:
     0009:    # d.getVar() might return 'None' as a normal string
     0010:    # leading to 'is None' check isn't enough. Exception: TypeError: getVar() takes at least 3 arguments (2 given)

最佳答案

我遇到了同样的问题,并通过切换到 meta-raspberrypi 层上的 morty 分支来解决,该分支与我的 poky 环境的分支相同。

关于python - 使用 yocto 为 Raspberry pi 3 构建图像时出现解析错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42364579/

相关文章:

python - 如何在单个 Python 单元测试中处理多个断言?

python - AWS Cloudformation,使用 Python 3 从键获取值的最佳方式

python - 从局域网访问sql数据库

python - 为什么pymysql(0.9.2)调用存储过程,有时获取输出参数为None?

python - 正则表达式 grep,在 function() 中查找 $string 和 $string

linux - 来自 ssh 的嵌套 ssh 隧道命令不起作用

linux - 如何从 Linux 中的日志文件中删除特定事件日志

python - pydispatch 模块已安装但仍然找不到

python - 使用 Raspberry Pi 和 Python 控制连续伺服电机

python - 多维数组快速排序