[yocto] Issue creating systemd service recipe

Matt Madison matt at madison.systems
Sat Jun 11 10:29:32 PDT 2016


On Sat, Jun 11, 2016 at 4:20 AM, Alexis Lothoré
<alexis.lothore at gmail.com> wrote:
> 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
> }

Instead of ${D}${sysconfdir}/systemd/system, install the service file
into ${D}${systemd_system_unitdir}.

-Matt

> ==============================================================
> 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
>
> --
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>



More information about the yocto mailing list