首页 > 解决方案 > 文件未从 Yocto 中的图像配方复制到 WORKDIR 中

问题描述

我正在尝试将一个简单的文件安装到目标 rootfs 的 /etc 目录中。我正在建设core-image-sato。“raxy_test”文件(在下面的配方中)甚至没有被复制到 WORKDIR 中。

我做错什么了吗?

我可以对普通食谱做同样的事情,但不能对图像食谱做同样的事情。

普通配方和图像配方有什么区别?

DESCRIPTION = "Image with Sato, a mobile environment and visual style for \                                                                                                                    
mobile devices. The image supports X11 with a Sato theme, Pimlico \
applications, and contains terminal, editor, and file manager."

IMAGE_FEATURES += "splash package-management x11-base x11-sato ssh-server-dropbear hwcodecs"

LICENSE = "MIT"

inherit core-image

TOOLCHAIN_HOST_TASK_append = " nativesdk-intltool nativesdk-glib-2.0"
TOOLCHAIN_HOST_TASK_remove_task-populate-sdk-ext = " nativesdk-intltool nativesdk-glib-2.0"

LICENSE="CLOSED"
LIC_FILES_CHKSUM="" 

SRC_URI = "\
          file://raxy_test \
          "   
do_install() {
    install -d ${D}${sysconfdir}
    install -m 0755 raxy_test ${D}${sysconfdir}
}

我希望“raxy_test”文件出现在 WORKDIR 以及目标的 /etc 目录中。

任何帮助将不胜感激,谢谢...!!!

标签: yocto

解决方案


多件事:

  • 您使用图像配方 ( core-image-sato) 在图像中添加文件。您应该为此修改使用单独的配方;
  • install不正确(未使用WORKDIR ) ;
  • 您不填充包(FILES_${PN}不存在)。

myrecipe.bb对于单独的配方,请在 recipes-* 子目录中创建一个文件(例如或任何您想要的文件)(您需要将其放置在与其他配方相同的文件夹级别!)。我没有测试它,但我认为这可以作为一个基础:

DESCRIPTION = "My recipe"
LICENSE="CLOSED"

PR = "r0"
PV = "0.1"

SRC_URI = " file://raxy_test "

 # Create package specific skeleton
do_install() {
    install -d ${D}${sysconfdir}
    install -m 0755 ${WORKDIR}/raxy_test ${D}${sysconfdir}/raxy_test
}

# Populate packages
FILES_${PN} = "${sysconfdir}"

您会注意到一些事情发生了变化:

install必须包含 ${WORKDIR} 路径:

install -m 0755 ${WORKDIR}/raxy_test ${D}${sysconfdir}

我们需要填充包:

FILES_${PN} = "${sysconfdir}"

这会将文件添加${sysconfdir}到包${PN}中(默认情况下是配方名称)。


推荐阅读