Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. With the bbappend file I want to overwrite a file from intel-edison board. More exactly, the wpa_supplicant.conf from /etc/wpa_supplicant/. This wpa_supplicant.conf is already created from another layer (meta-intel-edison-distro). I can write my file in /etc/ so my recipe and my bbappend file are working. 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:

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.

like image 596
aa86 Avatar asked Sep 27 '17 06:09

aa86


2 Answers

You shouldn't rewrite the wpa_supplicant.conf from another recipe, as the files will clash.

Instead, rename your abc-efg_01.bbapend to wpa-supplicant_%.bbappend, and it should work.

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.

like image 79
Anders Avatar answered Oct 20 '22 01:10

Anders


Install extra files for p910nd with bbappend file:

layout of p910nd directory

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

Content of the bbappend file

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.

like image 37
Iceberg Avatar answered Oct 20 '22 00:10

Iceberg