Creating an Asteroid App
The app creation process of AsteroidOS needs a Software Development Kit generated by OpenEmbedded. You can either grab a prebuilt SDK here (this is a self-contained script) and install it on your system or you can build it yourself as follow.
If you’ve already got an OpenEmbedded build directory via the ‘Building AsteroidOS’ page, cd to that directory. Else, create one with:
git clone https://github.com/AsteroidOS/asteroid cd asteroid/
Then, build the cross compilation toolchain with:
. ./prepare-build.sh dory bitbake meta-toolchain-qt5
If you downloaded a prebuilt SDK, run the downloaded script. If you followed the previous steps, this will have generated the same installation script in tmp-glibc/deploy/sdk/, you can run it as follow:
This script will install the cross compiler and ARM libraries in /usr/local/oecore-x86_64 by default, along with a script that needs to be sourced before every build. If you want to build a simple project via the terminal, this can be done like that:
source /usr/local/oecore-x86_64/environment-setup-armv7ve-neon-oe-linux-gnueabi qmake make
Before running QtCreator you must run the previously mentioned script:
source /usr/local/oecore-x86_64/environment-setup-armv7ve-neon-oe-linux-gnueabi qtcreator
This can be done automatically by prepending “source /usr/local/oecore-x86_64/environment-setup-armv7ve-neon-oe-linux-gnueabi” before #!/bin/sh in /usr/bin/qtcreator.sh
Now that you are in QtCreator go to ‘Tools->Options->Build & Run‘ and
- In the Compilers tab add the following g++: /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++
- In the Qt Versions tab add the following qmake: /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/qt5/qmake
- In the Kits tab add a kit with the previously chosen Qt5 version and compiler, set the sysroot to /usr/local/oecore-x86_64/sysroots/armv7a-vfp-neon-oe-linux-gnueabi/ and let the other variables empty.
TODO: try to setup ‘Tools->Options->Devices‘ for automatic app installation over SSH.
Asteroid-Stopwatch can act as a cool QML demo app available to make the first step into AsteroidOS development easier. You can clone it, build it, install it and then modify it to follow your needs:
git clone https://github.com/AsteroidOS/asteroid-stopwatch cd asteroid-stopwatch/ source /usr/local/oecore-x86_64/environment-setup-armv7ve-neon-oe-linux-gnueabi qmake make adb push asteroid-stopwatch /usr/bin/ adb push asteroid-stopwatch.desktop /usr/share/applications/
If it wasn’t already installed, a new icon should have already appeared on asteroid-launcher, try to run it and you should get a QtQuick Controls Calendar component.
You can start by modifying occurrences of “asteroid-calendar” to your app’s name. Then you can change the *.desktop file which describes the icon on the apps launcher. Then modify main.qml to describe your UI. To get started with QML development you can read the official tutorial.
If you want to start your app from the command line, open a shell with adb shell, connect to the standard user and use invoker:
su ceres invoker --type=qtcomponents-qt5 /usr/bin/asteroid-stopwatch
If you want to disable screen locking for easier development you can enable the demo mode of mce with:
mcetool -D on