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

Linux 如何编写yocto/bitbake配方,用自己的文件替换默认的vsftpd.conf文件?,linux,yocto,recipe,vsftpd,Linux,Yocto,Recipe,Vsftpd,我想用我自己的文件替换默认的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 \

我想用我自己的文件替换默认的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.bbappend

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

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

do_install_append () {
    install -m 0755 ${WORKDIR}/vsftpd.conf ${D}${sysconfdir}
}
但是,该文件无法替换!
怎么了?

您需要做的是在自己的层中使用bbappend

vsftpd
recipe位于
meta-openembedded/meta-networking/recipes守护进程中

因此,您需要创建一个名为
vstfpd_u979;%.bbappend
%
使其对每个版本都有效)

此文件必须位于
/meta networking/recipes守护进程中。您还需要将自定义的
vsftpd.conf
放入
/meta networking/recipes守护进程/vsftpd
文件夹中

其内容应为:

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

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

meta openembedded中的示例应添加到配方中:

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

以确保您的bbappend已加载。使用
bitbake layers show appends | grep vsftpd
这非常有用:对我有用。不过有一条评论:您说bbappend必须位于“/meta-networking/recipes-daemons/vsftpd”中。我不认为它需要位于与所附加的配方路径相匹配的路径中。只有文件名必须匹配。我有一个不同的路径,它选择了bbappend。你是对的,它不是强制性的,但很容易找到它