Autorun application in x-window-manager at Linux startup

I’m currently launching my Qt application from within x-window-manager (following the suggestion from How to Autorun Application at the Start up in Linux) and wonder if there is another way to launch the application even “earlier” in the Linux bootup sequence? I’ve heard about launching application before the “init” in other Linux boot optimization articles (non Toradex) but I’m a newbie with Linux boot, so I just wonder if starting the Qt app in x-window-manager is the “earliest” that an app can be launched in the Toradex case.

hi @mlai

Could your provide the hardware version of your module? What is your application? What is your target time for launching your Qt Application? Which optimization techniques did you know?

I currently only have the Apalis evk with the Apalis iMX6 running on it. It’s a Qt application that we need to start up when we power up the evk. Target time is around 10 to 15 seconds. Already took out the boot loader user wait and suppressed the kernel console messages so it is 8 seconds from power reset the evk to login prompt show up in the console.

Dear @mlai, find the following post and webinars regarding boot time optimization with Qt that you may find useful:

Regarding your question, I’m afraid that is very dependant on the modules you are running. For instance, you may not run X at all, and just render some graphics in the screen directly through the frame buffer.

Best regards, Alvaro.

Thanks for the links!

I watched the videos but they did not cover how to start the Qt application before the Init; there was a mention of that but no example shown in the video. Does that mean launching the Qt app in x-window-manager is the earliest I can do in the user space bootup sequence?

Short answer: No. You could run it directly from Systemd.

Long(er) answer: I would consider that systemd is one of the first (if not the first) userspace artifact launched (or where userspace is managed), where actually X and lxsession are launched from. You could launch your application before X does within systemd if you don’t need X/LXDE at all, delaying them or not launching them if you don’t need them at all.

A quick look to ps aux, can show the boot process in a very rough way (finished processes won’t show there), while journalctl -b will give you all the kernel and systemd logs for the current boot.

Here we also mentioned how one of our images launches an app from systemd right after X:, but again, from the moment the frame buffer is detected and offered by systemd-udev, you can start using it.

However, if you don’t want to get into the hassle of using Wayland instead of X/avoid using X/use the framebuffer directly, I would say the x-window-manager script is very optimized.

Hope this answers you. Take into account that Linux is very flexible and you can pretty much remove anything you don’t need and adapt the booting sequence to do what you need asap. The only thing you need to take care of is that any dependency is available when you want to launch your application.

Thanks buddy! I’ll stick with x-window-manager for now.