简体   繁体   English

bbappend 用于替换文件的文件

[英]bbappend file for replacing a file

I created a new layer in yocto: meta-abc, a recipe: abc-efg_0.1.bb and an .bbapend: abc-efg_01.bbapend file.我在 yocto 中创建了一个新层:meta-abc,一个配方:abc-efg_0.1.bb 和一个 .bbapend:abc-efg_01.bbapend 文件。 With the bbappend file I want to overwrite a file from intel-edison board.使用 bbappend 文件,我想覆盖来自 intel-edison board 的文件。 More exactly, the wpa_supplicant.conf from /etc/wpa_supplicant/.更准确地说,来自 /etc/wpa_supplicant/ 的 wpa_supplicant.conf。 This wpa_supplicant.conf is already created from another layer (meta-intel-edison-distro).这个 wpa_supplicant.conf 已经从另一个层(meta-intel-edison-distro)创建。 I can write my file in /etc/ so my recipe and my bbappend file are working.我可以在 /etc/ 中写入我的文件,所以我的配方和我的 bbappend 文件正在工作。 I can bitbake my recipe, but when I try to creat the image I receive the message:我可以对我的食谱进行烘焙,但是当我尝试创建图像时,我收到了以下消息:

" * check_data_file_clashes: Package abc-efg wants to install file /home/atr-int/Desktop/Yocto/yocto-edison/build_edison/tmp/work/edison-poky-linux/edison-image/1.0-r0/rootfs/etc/wpa_supplicant/wpa_supplicant.conf But that file is already provided by package * wpa-supplicant * opkg_install_cmd: Cannot install package abc-etc. " Here is my bbappend file content: " * check_data_file_clashes:包abc-efg要安装文件/home/atr-int/Desktop/Yocto/yocto-edison/build_edison/tmp/work/edison-poky-linux/edison-image/1.0-r0/rootfs/etc /wpa_supplicant/wpa_supplicant.conf 但该文件已由包 * wpa-supplicant * opkg_install_cmd: 无法安装包 abc-etc 提供。”这是我的 bbappend 文件内容:

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

SRC_URI += "file://wpa_supplicant.conf"

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

Can anyone give my any tip ?任何人都可以给我任何提示吗? Thank you.谢谢。

You shouldn't rewrite the wpa_supplicant.conf from another recipe, as the files will clash.您不应该从另一个配方重写wpa_supplicant.conf ,因为文件会发生冲突。

Instead, rename your abc-efg_01.bbapend to wpa-supplicant_%.bbappend , and it should work.相反,将您的abc-efg_01.bbapend重命名为wpa-supplicant_%.bbappend ,它应该可以工作。

If for some reason you need to have wpa_supplicant.conf in abc-efg , you need to add a wpa-supplicant_%.bbappend in which you'll need to remove wpa_supplicant.conf .如果由于某种原因您需要在abc-efgwpa_supplicant.conf ,则需要添加一个wpa-supplicant_%.bbappend ,您需要在其中删除wpa_supplicant.conf

Install extra files for p910nd with bbappend file:使用 bbappend 文件为 p910nd 安装额外的文件:

layout of p910nd directory p910nd 目录的布局

.
├── files
│   ├── p910nd.conf
│   └── p910nd.init
└── p910nd_0.97.bbappend

Content of the bbappend file bbappend 文件的内容

SUMMARY = "install init script"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://p910nd.init"
SRC_URI += "file://p910nd.conf"

RDEPENDS_${PN} += "bash"

do_install_append() {
         install -D -m 0644 ${WORKDIR}/p910nd.conf ${D}${sysconfdir}/default/p910nd
         install -D -m 0755 ${WORKDIR}/p910nd.init ${D}/etc/init.d/p910nd
}

In my test, do_install_append will also overwrite the file if the it is already installed in the destination.在我的测试中,如果文件已安装在目标中,do_install_append 也会覆盖该文件。

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

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