Colibri IMX6 - Custom Console - Automatic service enable

Hi

I have built a custom colibri-imx6 console image.

I would like to have my helloworld program to autostart as a service. I followed this procedure for creating a simple service. How to autorun application at startup - Toradex Community

When I deploy the new custom image the autostartup.service file does not automatically start; but the file exits in /etc/systemd/system.

root@colibri-imx6:~# systemctl status autostartup.service

● autostartup.service - My autostartup service

Loaded: loaded (/etc/systemd/system/autostartup.service; disabled; vendor preset: enabled)

Active: inactive (dead)

How would I deploy this service during image creation so I can have the service enable and automatically start without any running any manual commands?

Look forward to hearing from you.

Thanks

May be you can create a custom recipe for deploying your service.

e.g. template for custom recipe to deploy the service file:

oe-core/stuff/meta-toradex/recipes-support/custom-recipe/custom-recipe.bb

inherit systemd

SRC_URI += "file://filiname.service"
               
FILES_${PN} += " ${systemd_unitdir}/system "

SYSTEMD_SERVICE_${PN} = "filename.service"

do_install_append() {
    install -d ${D}${systemd_unitdir}/system
    install -m 0644 ${WORKDIR}/filename.service ${D}${systemd_unitdir}/system
}

Add ‘IMAGE_INSTALL_append=custom-recipe’ to local .conf and build the console image.