Yocto:在 etcdir 中创建一个新目录
Yocto: Create a New Directory in etcdir
我是 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
现在的问题是,sample.service 已成功放置到该位置,但未创建 /etc/oc_certs。
"Not working" 是一个相当糟糕的错误描述,但最可能的问题是它没有包含在图像中。这是因为 bitbakes 打包机制不知道那个目录,所以添加它:
FILES_${PN} += "${etcdir}/oc_certs"
如果您需要进一步的帮助,请用准确的错误描述和相应的日志扩展您的问题。
除了 LetoThe2nd 的回答:${etcdir}
变量通常为空。如果你想要 /etc
的变量,它是 ${sysconfdir}
。所以你的文件可能安装到根目录。
检查 bitbake -e <your_recipe>
的输出并尝试找到 etcdir
进行验证。
同时删除 INSANE_SKIP_${PN} += "installed-vs-shipped"
,它隐藏了您试图查找的错误(您将看到安装在何处但未发货的内容)。
顺便说一句,还需要 LetoThe2nd 的回答,因为您正在覆盖(而不是附加 FILES_${PN}
,否则就不需要了。${sysconfdir}
已经是 FILES_${PN}
的一部分。
您在 ${D} 之后缺少 /。要在你的 /etc 文件夹中创建一个目录,比如 mydir,只需在你的食谱的 do_install() 中添加以下代码。
do_install() {
install -d ${D}/etc/mydir
}
我是 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
现在的问题是,sample.service 已成功放置到该位置,但未创建 /etc/oc_certs。
"Not working" 是一个相当糟糕的错误描述,但最可能的问题是它没有包含在图像中。这是因为 bitbakes 打包机制不知道那个目录,所以添加它:
FILES_${PN} += "${etcdir}/oc_certs"
如果您需要进一步的帮助,请用准确的错误描述和相应的日志扩展您的问题。
除了 LetoThe2nd 的回答:${etcdir}
变量通常为空。如果你想要 /etc
的变量,它是 ${sysconfdir}
。所以你的文件可能安装到根目录。
检查 bitbake -e <your_recipe>
的输出并尝试找到 etcdir
进行验证。
同时删除 INSANE_SKIP_${PN} += "installed-vs-shipped"
,它隐藏了您试图查找的错误(您将看到安装在何处但未发货的内容)。
顺便说一句,还需要 LetoThe2nd 的回答,因为您正在覆盖(而不是附加 FILES_${PN}
,否则就不需要了。${sysconfdir}
已经是 FILES_${PN}
的一部分。
您在 ${D} 之后缺少 /。要在你的 /etc 文件夹中创建一个目录,比如 mydir,只需在你的食谱的 do_install() 中添加以下代码。
do_install() {
install -d ${D}/etc/mydir
}