我如何编写 yocto/bitbake 配方来用我自己的文件替换默认的 vsftpd.conf 文件?

How do I write a yocto/bitbake recipe to replace the default vsftpd.conf file with my own file?

我想用我自己的文件替换默认的 vsftpd.conf 文件! 我的 bitbake 文件如下所示:

bbexample_1.0.bb

DESCRIPTION = "Configuration and extra files for TX28"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

S = "${WORKDIR}"

SRC_URI += " \
    file://ld.so.conf \
    file://nginx/nginx.conf \
    file://init.d/myscript.sh"

inherit allarch

do_install () {
    install -d ${D}${sysconfdir}
    install -d ${D}${sysconfdir}/nginx
    install -d ${D}${sysconfdir}/init.d
    rm -f ${D}${sysconfdir}/ld.so.conf
    install -m 0755 ${WORKDIR}/ld.so.conf ${D}${sysconfdir}
    install -m 0755 ${WORKDIR}/nginx/nginx.conf ${D}${sysconfdir}/nginx/
    install -m 0755 ${WORKDIR}/init.d/myscript.sh ${D}${sysconfdir}/init.d/
}

bbexample_1.0.bb附加

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"

SRC_URI += " \
    file://vsftpd.conf"

do_install_append () {
    install -m 0755 ${WORKDIR}/vsftpd.conf ${D}${sysconfdir}
}

但是,无法替换文件! 怎么了?

你需要做的是在你自己的图层中使用一个bbappend,

vsftpd 食谱位于 meta-openembedded/meta-networking/recipes-daemons

因此您需要创建一个名为 vstfpd_%.bbappend 的文件(% 使其对每个版本都有效)

此文件必须位于 <your-layer>/meta-networking/recipes-daemons。您还需要将自定义 vsftpd.conf 放入 <your-layer>/meta-networking/recipes-daemons/vsftpd 文件夹

其内容应为:

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

do_install_append(){
    install -m 644 ${WORKDIR}/vsftpd.conf ${D}${sysconfdir}
}

示例来自 meta-openembedded here

你应该添加到你的食谱中:

FILES_${PN} += " file you installed"