Hi for all!
I solved the problem with autorun Qt app on iMX8M with xwayland.
A lot of thanks to Takashi Kashiwagi for his experiments.
My way to resolve the problem was:
I have my app (/opt/app)
I made an autorun.sh script (/opt/autorun.sh)
#!/bin/sh
sleep 5
/opt/app
exit 0
I made environment file (/opt/root_env)
LANG=C.UTF-8
EDITOR=vi
XDG_SESSION_ID=c2
HUSHLOGIN=FALSE
USER=root
PWD=/home/root
HOME=/home/root
XDG_SESSION_TYPE=tty
SHELL=/bin/sh
TERM=xterm
XDG_SESSION_CLASS=user
SHLVL=1
QT_QPA_PLATFORM=wayland
LOGNAME=root
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus
XDG_RUNTIME_DIR=/run/user/0
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
PS1=\u@\h:\w\$
_=/usr/bin/env
I made service file (/etc/systemd/system/autorun.service)
[Unit]
Description=Test Qt Application
After=multi-user.target local-fs.target weston.service
[Service]
User=root
Restart=no
Type=simple
EnvironmentFile=/opt/root_env
ExecStart=/opt/autorun.sh
StandardOutput=console
[Install]
WantedBy=multi-user.target weston.service
And at the end of all I edit rc.local file (/etc/rc.local)
#!/bin/sh -e
#
systemctl enable autorun.service
exit 0
The boot after this nothing happen, because autorun.service was not active during the boot, but the second time and others were succesfull!