Yocto enabling multiple systemd services with one recipe file

Keywords´╝Ü linux system yocto systemd bitbake


I've taken over a project which uses Yocto to generate a customized Linux image.

I'm modifying a .bb recipe file which already creates and enables a systemd service. I need to create another systemd service and enable it from the same recipe file. Is this possible?

Below shows the bottom of the recipe file. app2.service is the service which is already enabled in the image. I wish to add update.service also. I have already appended the line : ${systemd_unitdir}/system/update.service to FILES_${PN} as shown

FILES_${PN} += "${sysconfdir} \
           ${systemd_unitdir}/system/app2.service \
           ${systemd_unitdir}/system/update.service \
inherit systemd

SYSTEMD_SERVICE_${PN} = "app2.service"

However, I believe the SYSTEMD_SERVICE_${PN} is what enables the service. Can I append the update.service with += to SYSTEMD_SERVICE_${PN} also in the same way?

I've looked online for an answer but it's not clear if I can enable multiple services like this.