[yocto] Issue creating systemd service recipe

Alexis Lothoré alexis.lothore at gmail.com
Sat Jun 11 04:20:02 PDT 2016


Hello,
I am currently trying to set up an Iot showcase platform using lowpan-tools
on raspberry.
To do so, I added systemd and I am now trying to create a recipe installing
my lowpan configuration script and lowpan.service. I used
connman-init-systemd.bb in meta-eca as a template to my recipe, which looks
like the following (lowpan-init-systemd.bb):

==========================================================
SUMMARY = "Configuration files to set up Lowpan interface"
DESCRIPTION = "Used to configure a lowpan interface with systemd when
driver is loaded"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI += "\
        file://COPYING \
        file://init.sh \
        file://lowpan.service \
"
S = "${WORKDIR}"

inherit systemd

SYSTEMD_PACKAGES = "${PN}"

SYSTEMD_SERVICE_${PN} = " lowpan.service"

FILES_${PN} += " lowpan.service \
                 /opt/lowpan/init.sh \
"


do_install () {
    install -d ${D}{sysconfdir}/systemd/system
    install -d ${D}/opt/lowpan
    install -m 0755 ${WORKDIR}/lowpan.service
${D}{sysconfdir}/systemd/system
    install -m 0755 ${WORKDIR}/init.sh ${D}/opt/lowpan
}
==============================================================
and the service file, located in "files" :
==============================================================
[Unit]
Description=Lowpan interface configuration
Wants=sys-subsystem-net-devices-wpan0.device
After=sys-subsystem-net-devices-wpan0.device

[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/opt/lowpan/init.sh

[Install]
WantedBy=multi-user.target
==============================================================

I chose to inherit systemd to be sure that my service is not only installed
but also enabled at first boot.
However, when I try to bitbake this recipe only (or the whole image, which
has a IMAGE_INSTALL_append = "lowpan-tools lowpan-init-systemd"), I get the
following error at some point :


*lowpan-init-systemd-1.0-r0 do_package: Function failed:
SYSTEMD_SERVICE_lowpan-init-systemd value lowpan.service does not exist*
Thinking it was due to file location, (trying to read systemd.bbclass, I
think the class does not find my service file) I tried adding ${S},
${WORKDIR} or so before lowpan.service in SYSTEMD_SERVICE, but it changed
nothing.
Can someone explain me what I am doing wrong in this case ?

-- 
Alexis Lothoré
Élève-Ingénieur à l'INSA de Toulouse
5A Automatique-Electronique : Systèmes Embarqués Critiques
06.51.59.81.45
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20160611/6fb89115/attachment.html>


More information about the yocto mailing list