Yocto startup scripts systemd
From embeddedTS Manuals
To have a custom headless application start up at boot a systemd service needs to be created. Create the file /etc/systemd/system/yourapp.service
with contents similar to below:
[Unit]
Description=Run an application on the i.MX6
[Service]
Type=simple
ExecStart=/usr/local/bin/your_app_or_script
[Install]
WantedBy=multi-user.target
If an application depends on networking, the systemd script will want to have After=network.target
in the Unit section. Once this file is in place, it can be added to automatic startup with the following:
# Enable the application to be started on boot up
systemctl enable yourapp.service
# Start the application now, but will not affect automatic startup
systemctl start yourapp.service
Note: | See the systemd documentation for in depth documentation on services. |
To set up a graphical application startup, modify the /usr/bin/mini-x-session
file
At the end of the script replace matchbox-terminal
with the desired application (absolute path may need to be specified):
matchbox-terminal &
exec matchbox-window-manager
The exec statement must be last in the script in order to take over this script's PID for correct operation.