The app creation process of AsteroidOS needs a Software Development Kit generated by OpenEmbedded. You can either grab a prebuilt SDK for the nightlies here or for the latests stable release here 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-armv7vehf-neon-oe-linux-gnueabi qmake make
Before running QtCreator you must run the previously mentioned script:
source /usr/local/oecore-x86_64/environment-setup-armv7vehf-neon-oe-linux-gnueabi qtcreator
This can be done automatically by prepending “source /usr/local/oecore-x86_64/environment-setup-armv7vehf-neon-oe-linux-gnueabi” before #!/bin/sh in /usr/bin/qtcreator.sh
Now that you are in QtCreator go to ‘Tools->Options->Devices‘
- Add a new Generic Linux Device.
- Name it "AsteroidOS Watch".
- Choose 192.168.2.15 as IP address.
- Use root as user.
- Choose Password authentication and leave the password field empty.
Under the 'Build & Run'
- In the Compilers tab add the following GCC (C++): /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ and GCC (C): /usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc
- 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 defined device, Qt5 version and compilers, set the sysroot to /usr/local/oecore-x86_64/sysroots/armv7a-vfp-neon-oe-linux-gnueabi/ and let the other variables empty.
Asteroid-Stopwatch can act as a cool QML demo app to make your first steps 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/ ./i18n/generate-desktop.sh . asteroid-stopwatch.desktop source /usr/local/oecore-x86_64/environment-setup-armv7vehf-neon-oe-linux-gnueabi qtcreator asteroid-stopwatch.pro
Try to build and deploy the app. If it wasn’t already installed, a new icon should have already appeared on asteroid-launcher.
You can start by modifying occurrences of “asteroid-stopwatch” 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 SSH, connect to ceres and use invoker:
invoker --type=qtcomponents-qt5 /usr/bin/asteroid-stopwatch
TODO: Document the integration of this invoker command as a run step in the Qt Creator configuration.
If you want to disable screen locking for easier development you can enable the demo mode of mce as root with:
mcetool -D on