[yocto] Enable wpa_supplicant at wlan0.service on boot with systemd

Conor Slater slaterc at gmail.com
Wed Nov 14 01:11:10 PST 2018


Dear All,

I'm trying to start wpa_supplicant with wlan0 as the interface on boot
using systemd.

I've created the following .bbappend for wpa_supplicant to install the new
configuration and enable the wpa_supplicant at wlan0.service. This doesn't
enable the service and somehow breaks being able the start the
wpa_supplicant at wlan0.service.

Has anybody else figured out how to get this to work?

$ cat wpa-supplicant_2.%.bbppend:

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

SRC_URI_append = " file://wpa_supplicant-wlan0.conf"

inherit systemd

SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE_${PN} += " wpa_supplicant at wlan0.service"
SYSTEMD_AUTO_ENABLE = "enable"

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

As a workaround, I created a .bbappend to manually create the symlink for
systemd which does enable the service. Although, I would like to know if
there is a better way of doing this.

$ cat wpa-supplicant_2.%.bbppend:

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

SRC_URI_append = " file://wpa_supplicant-wlan0.conf"

do_install_append () {
    install -d ${D}${sysconfdir}/wpa_supplicant
    install -m 0644 ${WORKDIR}/wpa_supplicant-wlan0.conf
${D}/${sysconfdir}/wpa_supplicant/
    install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants
    ln -s ../../../../lib/systemd/system/wpa_supplicant at .service
${D}${sysconfdir}/systemd/system/multi-user.target.wants/wpa_supplicant at wlan0.service
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20181114/1aa96785/attachment.html>


More information about the yocto mailing list