I am trying to start a service on boot, however I am having issues building. This is my tree structure in my custom layer
michael@michael-VirtualBox:~/Documents/simple_daemon/sources/meta-simpledaemon$ tree
.
├── conf
│ └── layer.conf
├── COPYING.MIT
├── README
└── recipes-example
├── example
│ └── example_0.1.bb
└── simpledaemon
├── files
│ └── simpledaemon.service
└── simpledaemon_git.bb
In my local.conf I have added the following to the end:
IMAGE_INSTALL_append = " bbexample "
IMAGE_INSTALL_append = " simpledaemon "
IMAGE_INSTALL_append = " packagegroup-core-ssh-openssh "
IMAGE_INSTALL_append = " openssh-sftp-server "
DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
My .bb
file is as follows:
# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)
# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
# your responsibility to verify that the values are complete and correct.
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=ca119cf6dcda0f0883a416a3e7f94cc2"
SRC_URI = "git://github.com/MichaelBMiner/simpledaemon;protocol=https"
# Modify these as desired
PV = "1.0+git${SRCPV}"
SRCREV = "a37a89df4d53bca97c12c8908cbe8552032417b4"
inherit systemd
S = "${WORKDIR}/git"
SYSTEMD_SERVICE_${PN} = "simpledaemon.service"
do_compile () {
${CC} ${LDFLAGS} simpledaemon.c -o simpledaemon
}
do_install () {
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/simpledaemon ${D}${bindir}
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/simpledaemon.service ${D}${systemd_unitdir}/system sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_unitdir}/system/simpledaemon.service
}
# NOTE: if this software is not capable of being built in a separate build directory
# from the source, you should replace autotools with autotools-brokensep in the
# inherit line
inherit autotools
# Specify any options you want to pass to the configure script using EXTRA_OECONF:
EXTRA_OECONF = ""
My simpledaemon.service is as follows:
[Unit]
Description=Example service
[Service]
Type=forking
ExecStart=@BINDIR@/simple-service
[Install]
WantedBy=multi-user.target
I got all of this information from the book Embedded Linux Development Using Yocto Project Cookbook Second Edition.
All of my builds have been successful until I attempt to add this new service. This book makes no mention of an init shell script for systemd services. I am also pulling code from GitHub rather than code in my build directory (you can look at the repo).
When I run bitbake
I am given the error Didn't find service unit 'simpledaemon.service', specified in SYSTEMD_SERVICE_simpledaemon.
. This tells me it is a path error that I can only assume arises from my GitHub structure. Can anyone shine some light on this?