简体   繁体   English

Yocto bitbake.bbappend 未安装文件

[英]Yocto bitbake .bbappend not installing file

I am trying to add a json to /etc on a device.我正在尝试将 json 添加到设备上的 /etc 中。 Have read many SO answers and not found a solution.已阅读许多 SO 答案并没有找到解决方案。 The new json is called audio_config.json, it is under files/ in the same directory as the.bbappend.新的 json 被称为 audio_config.json,它与 .bbappend 在同一目录下的 files/ 下。 Am using append because this file is needed only on one device model while the main recipe is on many models.我正在使用 append 因为这个文件只需要在一台设备 model 上,而主要配方在许多型号上。

Doing this:这样做:

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://audio_config.json"

do_install_append() {
   install -d ${D}${sysconfdir}
   install -m 644 ${B}/audio_config.json ${D}${sysconfdir}
}

Gets an error saying that the json is not in the work directory.收到一条错误消息,指出 json 不在工作目录中。 The same thing happens if I use ${WORKDIR} instead of ${B}.如果我使用 ${WORKDIR} 而不是 ${B},也会发生同样的事情。 Other recipes in this tree follow this same model, not sure what the problem is.此树中的其他配方遵循相同的 model,不确定问题出在哪里。

If I use ${THISDIR} then it says that the json is not located in the base recipe directory - which it's not supposed to be.如果我使用 ${THISDIR} 那么它说 json 不在基本配方目录中 - 它不应该是。

From SO posts I have tried从我尝试过的SO帖子中

FILES_${PN}-audio_config.json = "${sysconfdir}/audio_config.json"

But that seems to have no effect.但这似乎没有效果。

TIA!蒂亚!

According to users and documentation, what I had above should have worked.根据用户和文档,我上面的内容应该有效。 But it didn't.但事实并非如此。 What did work was this:起作用的是:

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

do_install_append() {
   install -d ${D}${sysconfdir}
   install -m 644 ${AUDIO_CONFIG_FILES}/audio_config.json ${D}${sysconfdir}
}

Using a variable for immediate expansion of $THISDIR set the local path correctly and the install occurs.使用变量立即扩展 $THISDIR 正确设置本地路径并进行安装。

In do_unpack() the file is copied to ${WORKDIR} , not ${B} (build dir) and not ${S} (sources dir).do_unpack()中,文件被复制到${WORKDIR} ,而不是${B} (构建目录)而不是${S} (源目录)。 This recipe works for me with Yocto Dunfell:这个食谱适用于 Yocto Dunfell:

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://audio_config.json"

do_install_append() {
   install -d ${D}${sysconfdir}
   install -m 644 ${WORKDIR}/audio_config.json ${D}${sysconfdir}
}

Note the different source path argument in the second call to install .请注意第二次install调用中不同的源路径参数。

I'm guessing that there was a yocto/bitbake bug that affected you.我猜是有一个 yocto/bitbake 错误影响了你。

You were right to add the FILES_${PN} to add the file to the image.您添加 FILES_${PN} 以将文件添加到图像是正确的。 But do not add any suffix to it, just append your file to the variable:但不要给它添加任何后缀,只需将 append 你的文件添加到变量中:

FILES_${PN} += "${sysconfdir}/audio_config.json"

Also, you should use the ${WORKDIR} in your install.此外,您应该在安装中使用${WORKDIR}

install -m 644 ${WORKDIR}/audio_config.json ${D}${sysconfdir}

Also check the work directory of your package to get some logs and see the files actually retrieved for an easier debugging.还要检查 package 的工作目录以获取一些日志并查看实际检索到的文件,以便于调试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM