[yocto] trouble getting systemd oneshot to run

Greg Wilson-Lindberg GWilson at sakuraus.com
Wed Mar 14 12:05:36 PDT 2018


I'm building yocto for a raspberry pi3 from Qt's b2qt version.


I'm running into two problems, I've got all of the files copying to the correct locations but the .service is not running at startup. I used connman-conf.bb as the template for my .bb file:


SUMMARY="recipe to create CAN bus startup service"

LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

inherit systemd

SRC_URI = "file://can_start.sh \
           file://canstart.service \
"

S = "${WORKDIR}"

PACKAGE_ARCH = "${MACHINE_ARCH}"

FILES_${PN} = "${datadir}/*"

do_install () {
    if test -e ${WORKDIR}/can_start.sh &&
       test -e ${WORKDIR}/canstart.service; then
        install -d ${D}${datadir}/canstart
        install -m 0755 ${WORKDIR}/can_start.sh ${D}${datadir}/canstart
        install -d ${D}${systemd_system_unitdir}
        install -m 0644 ${WORKDIR}/canstart.service ${D}${systemd_system_unitdir}
        sed -i -e 's|@SCRIPTDIR@|${datadir}/canstart|g' ${D}${systemd_system_unitdir}/canstart.service
    fi
}

SYSTEMD_SERVICE_${PN} = "canstart.service"



Service file:




[Unit]
Description=Startup CAN bus interface

[Service]
Type=oneshot
ExecStart=@SCRIPTDIR@/can_start.sh

[Install]
WantedBy=network.target



>From looking at the connman-conf sample I'm setting everything up correctly and the service should default to running on startup but it is not.

The second 'problem' is really just perplexing, if I dump the variables S contains a path to a directory in my root not "${WORKDIR}".


Any and all help with this would be greatly appreciated.


Regards,

Greg Wilson-Lindberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20180314/6dfa8c5d/attachment.html>


More information about the yocto mailing list