Search code examples
embedded-linuxyoctobitbake

Patch bitbake to use custom `wpa_supplicant.conf`


I have a wpa_supplicant.conf that I want to use at first boot. I tried to patch poky's recipe as follows. This is my wpa_supplicant_2.6.bbappend:

FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
SRC_URI_append = " file://wpa_supplicant.conf"

I have the conf file stored relative to the bbappend in wpa_supplicant/wpa_supplicant.conf. Still the original poky conf file is always added to the image.

How can I inject my config file?

(I'm on branch warrior)

NOTE/EDIT: For quick and efficient problem solving I recommend also discussing issues in the IRC channel (as also happened in this case). Super helpful people there!


Solution

  • First, the recipe is called wpa-supplicant and not wpa_supplicant so you need to name the bbappend wpa-supplicant_2.6.bbapend and not wpa_supplicant_2.6.bbappend. Remember, no underscore, no uppercase letter in recipe or package name.

    One can check that a bbappend is parsed by using bitbake-layers show-appends wpa-supplicant. You'd have seen that your bbappend was not taken into account.

    Then, one should usually use FILESEXTRAPATHS_prepend := because you want your path to be traversed before all the other ones. FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

    Finally, since the recipe is named wpa-supplicant and not wpa_supplicant, ${PN} will be wpa-supplicant, thus you need to put your file in wpa-supplicant/ and not wpa_supplicant.

    To check in which order paths are traversed for files, one can run bitbake -e wpa-supplicant | grep -e "^FILESPATH=", the paths are traversed from leftmost to rightmost. The first file which matches the full path will be taken.

    After discussing on IRC with you, I can add that we also figured out that wpa_supplicant.conf is installed in the documentation directory but wpa_supplicant.conf-sane is the one that will be used as wpa_supplicant.conf in the final image for the target. So one would need to name the wpa_supplicant.conf file as wpa_supplicant.conf-sane in order for it to replace the wpa_supplicant.conf file in the final image.

    c.f. https://git.yoctoproject.org/cgit.cgi/poky/tree/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.6.bb?h=thud#n88 and https://git.yoctoproject.org/cgit.cgi/poky/tree/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.6.bb?h=thud#n91