bbappend file for replacing a file
Asked Answered
L

2

10

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.

Learnt answered 27/9, 2017 at 6:20 Comment(0)
M
8

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.

Mathura answered 27/9, 2017 at 10:56 Comment(13)
I need to replace the wpa_supplicant.conf with my own configuration (what i want to do is connect my intel-edison to WiFi automatically) . That's why I really need to replace the one that is already generating from the layer 'meta-intel-edison' with the one I have created.Learnt
Yes, you replace the wpa_supplicant.conf file using a bbappend in your own layer. Do not create an extra recipe, unless you have some other requirements.Mathura
Thank you. I did that and now my file is overwite in the right place. :)Learnt
Do you think you can help me with some other problem I have?Learnt
I'm trying to make a link to the wpa_supplicant.service. My version is: do_install_append() { ln -s '$/lib/systemd/system/wpa_supplicant.service' '${D}${sysconfdir}/systemd/system/multi-user.target.wants/wpa_supplicant.service' } After I bitbake the .bbappend and the image and flash it on my board there is no link in /etc/.../system/multi-user.target.wants for 'wpa_supplicant.service'. Do you have any idea what I can do more? Thank you.Learnt
Well, you want to enable wpa_supplicant.service? Then the easiest way would be to add SYSTEMD_AUTO_ENABLE = "ensable" to your .bbappend. As you can see in the original recipe, it's disabled per default.Mathura
Unfortunately, it's not working. I made the bbapend with the line that you gave you me and removed the link, and also this both of them, but the wpa_supplicant.service is not starting. FILESEXTRAPATHS_prepend := "${THISDIR}/files:" SYSTEMD_AUTO_ENABLE = "ensable"Learnt
do_install_append() { if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then ln -sf '$/lib/systemd/system/wpa_supplicant.service' '${D}${sysconfdir}/systemd/system/multi-user.target.wants/wpa_supplicant.service' fi } Is this right? Or should i do something more?Learnt
Did you spell enable correctly? As this is how many other recipes are working... And for you manual linking why do you have $/lib/systemd? You should preferably use ${systemd_system_unitdir} instead of most directories in your path.Mathura
Thank you very much for all the help you gave me. I did the changes. FILESEXTRAPATHS_prepend := "${THISDIR}/files:" SYSTEMD_AUTO_ENABLE = "enable" do_install_append() { if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then ln -sf '${systemd_system_unitdir}/wpa_supplicant.service' '${D}${sysconfdir}/systemd/system/multi-user.target.wants/wpa_supplicant.service' fi }Learnt
My bbappend file looks now like this. It's still not working. If you have any other idea it would be so nice...Learnt
You shouldn't need your do_install_append. Using ` SYSTEMD_AUTO_ENABLE = "enable"` should be enough. Just adding that one to my own bbappend, gave me /etc/systemd/system/multi-user.target.wants/wpa_supplicant.service. Well, to be honest, I also had SYSTEMD_SERVICE_${PN} = "wpa_supplicant.service".Mathura
I was having a file in /files. I deleted it and now it's working. Thank you very much. Have a very nice day!Learnt
C
1

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.

Charissacharisse answered 18/3, 2021 at 17:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.