Declaration of VAR

and some other stuff

Boot to Qt with custom app

2017-03-08 10:27:38 +0100

2017-03-08 10:27:38 +0100 | Comments

So, you have Boot to Qt image and your device boots into default Qt’s demo launcher. But now you want to deploy your application to the device and boot to it instead of demo launcher.

Here’s how to do that.

Theory

Well, everything is already described in the official documentation. But I’ll give you some additional information and screenshots of the process.

The way system picks what to run right after the start is that first it checks for the link /usr/bin/b2qt, and if it exists, then it starts whatever app is linked there instead of the demo launcher. So, if you want to boot to your application, you need to deploy it to the device and then create a link /usr/bin/b2qt pointing to it. And that’s what is happening underneath in the article I mentioned in the beginning - it’s Qt Creator who does all this for you.

Here’s a directory listing before the procedure:

root@b2qt-raspberrypi3:~# ls -l /usr/bin/b2qt
ls: cannot access '/usr/bin/b2qt': No such file or directory

So, by default it simply does not exits. And here’s a directory listing after the procedure:

root@b2qt-raspberrypi3:~# ls -l /usr/bin/b2qt
lrwxrwxrwx 1 root root 14 Mar  8  2017 /usr/bin/b2qt -> /opt/someapp/bin/someapp

As you can see, your application someapp is deployed to /opt/someapp/bin/ and link /usr/bin/b2qt to it is created.

Possible problems

I saw some complains about this not working while performing it on Windows host machines, but for me it worked just fine, as you’ll see from the screenshots.

Another source of problems could be doing this not for actual devices, but for device emulator. At least I heard about issues with VMware virtual machines. Cannot confirm of deny - I haven’t try doing it that way.

Practice

It’s pretty easy to do from Qt Creator (considering you’ve already set it up for your device).

Open your project, cross-compile it for your target device (Raspberry Pi 3, for example) and go to Run Settings under the Projects tab:

After that go back to Edit and right-click on the project. Choose Deploy:

Now you can reboot your device and it will boot to your application instead of default Qt’s demo launcher.

If you want to reset your device back to default boot settings, execute this (of course, without adb shell if you’re doing it via SSH):

adb shell appcontroller --remove-default

If you want to execute some script on startup, here’s an article about that.