Skip to content

Startup Applications

Two approaches to auto-start a custom application on Engicam boards running Weston/Wayland.


Approach 1 — Weston Startup Script

Engicam images include a launcher script at:

/usr/local/weston-start-at-startup/start_up_demo_launcher.sh

Edit this file and replace the default demo command with your application:

#!/bin/sh
export QT_QPA_PLATFORM="wayland"
export XDG_RUNTIME_DIR="/run/user/root"
cd /root
./my_app

Remove the Weston Panel (Optional)

To hide the taskbar from the Weston desktop, edit /etc/xdg/weston/weston.ini:

[shell]
panel-position=none

Using a systemd service is more robust: the application restarts automatically on crash and integrates with the boot process.

Create the Service File

/etc/systemd/system/my-app.service:

[Unit]
Description=My Application
After=weston.service
Requires=weston.service

[Service]
Type=simple
Restart=always
Environment="XDG_RUNTIME_DIR=/run/user/0"
WorkingDirectory=/usr/bin
ExecStart=/usr/bin/my-app -platform wayland

[Install]
WantedBy=multi-user.target

Enable and start it:

systemctl daemon-reload
systemctl enable my-app.service
systemctl start my-app.service

Approach 2b — Yocto Recipe (Deploy via BSP)

For production images, bundle the service directly into the BSP with a Yocto recipe.

Recipe Example (my-app_1.0.bb)

DESCRIPTION = "My Application"
LICENSE = "CLOSED"

DEPENDS += "qtbase qtdeclarative"
RDEPENDS:${PN} = "qtdeclarative-qmlplugins"

SRC_URI = "file://my-app.tar.gz \
           file://my-app.service"

inherit qmake5 systemd

FILES:${PN} += "/usr/bin/my-app \
                /lib/systemd/system/my-app.service"

do_install:append() {
    install -d ${D}${bindir}
    install -m 0755 ${S}/my-app ${D}${bindir}/
    install -d ${D}${systemd_system_unitdir}
    install -m 0644 ${WORKDIR}/my-app.service ${D}${systemd_system_unitdir}/
}

SYSTEMD_SERVICE:${PN} = "my-app.service"
REQUIRED_DISTRO_FEATURES = "systemd"

Service File (my-app.service)

[Unit]
Description=My Application

[Service]
Restart=always
Environment="XDG_RUNTIME_DIR=/run/user/0"
WorkingDirectory=/usr/bin
ExecStart=/usr/bin/my-app -platform linuxfb

[Install]
WantedBy=multi-user.target