Yocto:在etcdir

时间:2019-01-22 11:37:16

标签: yocto bitbake

我是Yocto的新手, 我想在/ etc中创建一个目录,然后将服务器证书复制到该目录中。我尝试在下面做,但是它没有在/ etc中创建任何目录,但是我没有得到任何编译错误:

    DESCRIPTION = "OC sample service"

SUMMARY = "Install and start a systemd service and copy server certificates"

LICENSE = "MIT"

SRC_URI = "file://service.tar.gz"

inherit systemd

S = "${WORKDIR}/service"

SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE_${PN} = "sample.service"
SYSTEMD_AUTO_ENABLE = "enable"
INSANE_SKIP_${PN} += "installed-vs-shipped"

do_configure() {
        :
}

do_compile() {
        :
}

do_install() {

        install -d ${D}${systemd_unitdir}/system

        install -m 0755 ${S}/sample.service ${D}${systemd_unitdir}/system

        mkdir -p ${D}${etcdir}/oc_certs

        install -m 0755 ${S}/certs/* ${D}${etcdir}/oc_certs

}

FILES_${PN} = "${systemd_unitdir}/system

service.tar.gz contains following

现在的问题是,sample.service已成功放置到该位置,但未创建/ etc / oc_certs。

3 个答案:

答案 0 :(得分:4)

除了LetoThe2nd的答案:${etcdir}变量通常为空。如果您想要/etc的变量,则为${sysconfdir}。因此,您的文件可能已安装到根目录。

检查bitbake -e <your_recipe>的输出并尝试找到etcdir进行验证。

也放下INSANE_SKIP_${PN} += "installed-vs-shipped"即可隐藏您要查找的错误(您将看到已安装但未附带的内容)。

还需要BTW LetoThe2nd的答案,因为您正在覆盖(而不是附加FILES_${PN},否则就不需要。${sysconfdir}已经是FILES_${PN}的一部分。

答案 1 :(得分:2)

“不工作”是一个非常糟糕的错误描述,但是最可能的问题是它没有包含在图像中。这是因为bitbakes打包机制不知道该目录,因此请添加:

FILES_${PN} += "${etcdir}/oc_certs"

如果您需要进一步的帮助,请使用准确的错误描述或相应的日志扩展问题。

答案 2 :(得分:0)

您在$ {D}之后缺少/。要创建目录,请在/ etc文件夹中说 mydir ,只需在配方的do_install()中添加以下代码即可。

do_install() {
    install -d ${D}/etc/mydir
 }
相关问题