Digia has recently announced Boot to Qt Technology Preview, a commercial offering that provides a solution for the creation of user interfaces on embedded systems. For the first version, they stripped out Android of Java, or other unnecessary parts (Zygote, SurfaceFlinger), added Qt/QML, and tested it on on ARM and x86 hardware.
Boot to Qt includes the following main features:
A light-weight UI stack for embedded Linux, based on the Qt Framework - Boot to Qt is built on an Android kernel/baselayer and offers an elegant means of developing beautiful and performant embedded devices.
Ready-made images – We have images for several different devices which include the Boot to Qt software stack, making it possible to get up and running with minimal effort from day one.
Full Qt Creator Integration – One-click deploy and run on hardware and a fully featured development environment.
Simulator – A VirtualBox based simulator which allows device development without hardware and opens up for simulating hardware input, such as GPS and connectivity.
The software stack includes most of the Qt Framework:
Qt Core, Qt Gui, Qt Network, Qt Widgets, Qt Xml
Qt QML and Qt Quick
Qt Quick Controls
Qt Graphical Effects
Boot to Qt specific additions, including virtual keyboard, brightness control and power off/reboot functionality
However, it currently excludes Qt multimedia and webkit.
The demo below shows Boot to Qt running on Nexus 7, Beagleboard-XM, and Boundary device SABRE Lite showing Qt Quick 2.0 apps, including Qt Cinematic Experience rendered at 55 to 60fps on all three platforms.
The application launcher uses 2% CPU on Freescale i.MX6, 15% of Beagleboard-XM on a 1280×800 screen, most of which is animated. On Tegra 3, CPU usage was 50%, the reason behind it was CPU frequency scaling, as the Tegra 3 just needs to run one core @ 102 Mhz to achieve 60fps in the Qt launcher.
Digia also published a diagram comparing boot times of Boot to Qt (to B2Qt Launcher) and Android (to Home Screen) showing considerable improvement. The company acknowledges Android adds lots of additional stuff, but for embedded systems you don’t need those, and you can optimize boot time.
They still expect to improve boot time, as for example, Qt 5 on Raspberry Pi can start rendering after as little as 3 seconds.
They used Android kernel and baselayer in this preview because of better drivers support, but they are also working on ready-made images and IDE integration for traditional embedded Linux, possibly with a preview coming some time this summer. The official release is expected for the end of the year.
You can find more information and/or request an evaluation on Digia’s Boot to Qt page.
CoAction Hero is a tiny board based on an ARM Cortex-M3 micro-controller (NXP LPC1759), that makes use of CoActionOS ecosystem that includes the hardware, but also an open source RTOS allowing multiple app to run concurrently, and a graphical interface to communicate with the board.
First, let’s have a look at the hardware specs:
Micro-controller – NXP LPC1759 ARM Cortex-M3 processor @ 120MHz with 64kB RAM and 512kB Flash ROM.
Storage – 1MB serial flash chip (pre-loaded with CoActionOS)
Expansion port
micro USB connector.
40 I/O pins are available on both sides of the board, and the board can be inserted in a breadboard.
You can currently connect 2 modules to the board: Bluetooth and LCD device boards.
CoActionOS RTOS will come pre-loaded on the board, and if you don’t want to, you don’t even need to know it’s there, and it’s use will be transparent. But let’s have a quick look at this real-time OS, which allows multitasking on Cortex M3 MCU, supports an unnamed filesystem, and they also provide a C/C++ library to help with hardware peripherals (GPIO, ADC, SPI, UART,…) programming.
Documentation, source code, and tutorials are available on CoActionOS website.
The desktop development environment, based on Qt 4.8 and GCC, currently runs on Windows and MacOS, with Android and iOS support coming once Qt 5.x is available for those mobile OS. Linux may also be supported at a later stage. The board connects to your computer via its micro USB port, and CoActionOS Link software allows you to browse the board’s filesystem, provides terminal access, install programs, re-flash the kernel, and monitor running processes. They recommend using Eclipse for compiling programs.
Several example projects are showcased on their kickstarter page such as driving a 1.8″ LCD, a DC Motor with PWM and PID, and an LED strip.
You can pledge as low as $29 to get the CoAction Hero board with a USB cable, and with a $99 pledge, you can add the Bluetooth and LCD expansion boards. Devkits should ship to backers in July 2013.
threewater, a Chinese developer, has just posted a very interesting demo on linux-sunxi mailing list showing a device based on AllWinner A10 boot linux within 0.85s, and if you add a Qt app, the total time is just about 1.2s.
This appears to be a custom hardware (EM6000), but we do know it’s based on AllWinner A10, comes with 512 MB RAM, and 4GB NAND Flash. On the software side, the device runs kernel 3.4 from linux-sunxi, with a customized version of uboot, a squashfs rootfs, and a Qt 4.7.4 app showing a gauge. Both the rootfs (7MB) and the kernel (2MB) have been compressed with LZO. All that boots from NAND flash for optimal speed.
The 1.2 second time includes kernel + rootfs + app time, and the total time is a bit longer, but this is still impressive. Here’s the boot log:
[1.690000 1.690000] U-Boot SPL 2013.01-05984-g2120a27-dirty (Apr 17 2013 - 14:22:02)
[0.009000 0.009000] Board: EM6000
[0.012000 0.003000] DRAM: 512MB
[1.014000 1.002000] init startup v1.1
[1.016000 0.002000] mount usr data error 2
[1.158000 0.142000] Could not read calibration: "/data/etc/pointercal"
[1.166000 0.008000] Couldnt open tslib config file: No such file or directory
[1.175000 0.009000] QWSTslibMouseHandlerPrivate: ts_config() failed with error: 'No such file or directory'
[1.187000 0.012000] Please check your tslib installation!
[1.200000 0.013000] qt show
If you just boot to the command line, it’s even faster:
[1.770000 1.770000] U-Boot SPL 2013.01-g8a69ff9-dirty (Apr 22 2013 - 13:05:36)
[0.007000 0.007000] Board: EM6000
[0.009000 0.002000] DRAM: 512MB
[0.810000 0.801000] /etc/init.d/rcS: line 6: /data/run.sh: not found
[0.835000 0.025000]
[0.843000 0.008000] login[42]: root login on 'ttyS0'
[0.851000 0.008000] [root@(none) /root]#
This is not the first time, people have implemented ultra fast boot on ARM hardware, an example is a ~400ms boot on the Beagleboard, but it’s still nice to see what can be achieved thanks to developers’ communities such as linux-sunxi.
The complete details and/or binary files are not available at this time, but if you are interested in Linux fast boot, you may considering checking Adeneo Embedded presentation at ELCE 2012 who did something very similar on Freescale i.MX51 & i.MX 6Q hardware.
You may have heard about libhybris, a library that cleverly loads Android HW adaptations and convert calls from bionic to glibc. One of the greatest achievement of this library is to allow Android GPU drivers to be used with Linux, and is notably used by Canonical, although they did not write it, for Ubuntu 14.04 which will be compatible with any recent Android smartphones or tablets.
One way to get started with libhybris is to port a device to Ubuntu Touch, but this may take a while. However, I’ve found a faster and easier way to play with libhybris thanks to Martin Brook (vgrade) who wrote a tutorial on how to use libhybris with Mer on the Cubieboard. Mer is an open source mobile Linux distribution powered by Qt/QML and HTML5, that’s born from the ashes of Meego, and is now used in the upcoming Sailfish OS.
Qt5 Cinematic Experienced Rendered at 25 fps in Cubieboard via Android GPU Drivers in Linux Thanks to libhybris
You’ll need to follow 4 main steps:
Build Android
Build a minimal Mer image
Install Libhybris
Run demos
I’ll skip the Mer image build since Martin has provided a binary image. I’ll use a build machine running Ubuntu 12.04.2 LTS. You should make sure the build environment is setup correctly, you’ve installed repo, and that it’s in your path. I’ll use the Cubieboard (1GB RAM), but you may want to try other hardware platform, or Linux distribution as the instructions should be similar.
Build Android for the Cubieboard
This is basically following the instructions provided here. First let’s code Android Jelly Bean (CyanogenMod) source code:
repo sync may take quite a while depending on your Internet connection. It took 10 hours, after several attempts over three days… Once this is done, we’ll need to configure the build for the Cubieboard:
source build/envsetup.sh
lunch
Select Cubieboard (#4), and start the build:
make -j10
The build initially failed with this error:
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1) You can add "@hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update current.txt by executing the following command:
make update-api
^^^^^^^^^^^^^^^^^^
NO. NO. STOP BEING LAZY. SERIOUSLY.
DO NOT DO THIS in CM. THIS IS A LIE. IF YOU DO THIS I WILL HATE YOU.
USE OPTION #1.
-Koush
To submit the revised current.txt to the main Android repository,
you will need approval.
******************************
So I shamelessly typed “make update-api” to automatically update current.txt, and continued the build with “make -j10″. The build may also take quite a while depending on your computer performance and available RAM. This step was much faster than repo sync in my case, as it just took about 45 minutes in total.
The Android build is now completed, but we need still to patch Bionic library, and rebuild:
cd bionic
wget http://pastie.org/pastes/7649385/download -O bionic_libhybris.patch
patch -p1 < bionic_libhybris.patch
cd ..
make -j10
Now let’s tar Android’s system directory as we’ll need to copy the will have the patched bionic library plus all the android libs (EGL, GLESv2, RIL etc):
pushd out/target/product/cubieboard/system/
tar cjvf ../../../../../cubie_android_system.tar.bz2 .
popd
Installing and Running Mer
Since we don’t build the image ourself, this step is rather easy, as we just need to download the image, and dump it to a micro SD card.
Where you need to replace <sd_device> by your actual SD card device such as “sdc”.
My 4GB microSD is slightly smaller than the image provided, so dd failed at the very end. But you can usually run the following 2 commands on the last partition (in this case ext4) in order to resize the partition, and fix any potential boot problems:
e2fsck -y /dev/sdc2
resize2fs /dev/sdc2 +3300K
Interestingly, this time those commands failed, but I still inserted the microSD in my Cubieboard, and I was able to login successfully into Mer via the serial console as root (password: mer). You should also have access a terminal on the HDMI monitor.
We don’t want X to start anymore, so let’s disable it and restart the Cubieboard:
zypper rm uxlauncher
reboot
If you’re using HDMI console, switch to VT2 (Ctrl+Alt+F2) before running the command.
Installing libhybris and Android system folder
Let’s log-in again via the serial console, or via VT2 on the HDMI monitor if this works for you, and install libhybris:
zypper ar http://repo.merproject.org/obs/home:/sage:/libhybris/latest_armv7hl/home:sage:libhybris.repo
zypper in libhybris
zypper in libhybris-tests
You may want to enlarge your terminal for the steps above, as the text goes over the window, and you have to answer some questions for the installation. The next step is to install Android’s system files to /system in the Cubieboard. Copy the files from the Linux PC to the Cubieboard:
After a reboot, Cubieboard decided to boot Android from flash, so I tried to remove and re-insert the micro SD, and noooooooooo! The micro SD socket let me down and refuses to lock the card in place, so I’ll have to replace the slot which will take me few weeks since I have to order the thing.
So I count on you to let me know what has gone wrong. Thanks
Let’s carry on as if everything worked just fine, and run the next demo:
test_glesv2
This should display a white diamond shape filled with an animated Catherine wheel.
Martin also has instructions for several other demos, but the most interesting one (we have a video), is Qt5 Cinematic Experience that you can install in the board as follows:
zypper in qt5-plugin-imageformat-jpeg
zypper in qt5-plugin-platform-eglfs
zypper in qt5-qtdeclarative-qmlscene
zypper in qt5-qtdeclarative-import-qtquick2plugin
zypper in qt5-qtdeclarative-import-window2
zypper in qt5-plugin-generic-evdev
zypper in vim
zypper in qt5-qtdeclarative-import-particles2
zypper in qt5-qtquick*
curl -O http://quitcoding.com/download/Qt5_CinematicExperience_rpi_1.0.tgz
tar -xf Qt5_CinematicExperience_rpi_1.0.tgz
cd Qt5_CinematicExperience_rpi_1.0
Now edit content/Mainview.qml with vim, and comment out the PathAnimation part.
The X server is getting old, and many developers complain it’s not an optimal solution anymore due to its (over) complexity, which was why Wayland was developed. However, it turns out Ubuntu will not use Wayland, but instead their own display server called Mir which will be used in all form factors from phones to desktops.
Mir on Android Drivers (Now and in May 2013)
Phoronix has provided a quick summary about the key aspects of Mir:
Mir is a new display server being developed at Canonical and it is not based on X.Org or Wayland.
Android graphics drivers will be supported.
Existing DRM/KMS/Mesa/GBM (the open-source Linux graphics drivers) will work. Canonical is pressuring the binary blob vendors to make their drivers compatible.
There will be support for legacy X11 applications through an integrated root-less X.Org Server.
Canonical will natively support GTK3 and Qt/QML toolkits with Mir.
Mir will be used for all form factors from Ubuntu Phones to the Ubuntu Linux desktop.
Mir should be ready for Ubuntu Phone OS by this October while it should come to other form factors (and the desktop) within one year.
Canonical has not chose Wayland because it could not fulfill their requirements completely, but due to their design, it would still be possible to add Wayland support by implementing a Wayland-specific frontend for the Mir server or by providing a client-side implementation of libwayland that talks to Mir.
Mir will also run on the free drivers software stack, but it does not run on closed source drivers now, and Phoronix reports that Canonical is in talks with closed-source vendors (NVIDIA and AMD) about supporting Mir and a unified EGL-centric driver model. From the look of it, it seems only desktop platforms will support the free Linux graphics drivers, which means other platforms such as smartphones and tablets may have to rely exclusively on the Android drivers (TBC).
There are three milestones for Mir development:
May 2013 - Finish the first step towards integrating Unity Next with Mir and provide enough facility to start iterating the actual shell development.
October 2013 – Unity Next & Mir window management are completely integrated with the rest of the system to support an Ubuntu Phone product. Desktops and laptops will have access to a legacy mode that allows to run legacy X clients against an on-demand rootless X server.
April 2014 – Complete convergence across the form factors is achieved, with Mir serving as the carrier across form factors.
That means Ubuntu 14.04 LTS will be the first release to fully take advantage of the new display server.
Sailfish OS is a new mobile operating system based on the Qt platform that will soon end-up in mobile phone near you. Until now it was possible to build the SDK yourself, but it was pretty challenging since the documentation was lacking, as Jolla, the company behind Sailfish OS, focused on development. The good news is that you don’t need to build the SDK yourself anymore, since Jolla has just released Sailfish SDK Alpha for Linux 32-bit & 64-bit, and Windows & Mac OS versions will come later.
You’ll need a computer that meet the following requirements:
A host machine running a Linux operating system
Oracle’s VirtualBox version 4.1.18 or higher pre-installed on the host machine.
About 5GB of free disk space
4GB of RAM or more is recommended
Sailfish OS UI Template
You can get started in two steps:
Install the SDK – Download the 32 bit or 64 bit Linux installer. (~650 MB), change the permissions, and run it to complete the installation
Run your first application – You can choose to start the IDE (Customized version of QtCreator) automatically right after the application, or launch it from a terminal window:
~/SailfishOS/bin/qtcreator
Go to File-> New File or Project to start a new application based on a template that gives you a quick way to create your first Sailfish OS application. Detailed steps are available here.
Sailfish OS SDK is a collection of tools for developing Sailfish OS applications:
QtCreator integrated development environment (IDE)
Mer build engine for cross compilation
The Sailfish OS Emulator
Tutorial, Design and API Documentation
Repositories for additional libraries and open source code
If you’re used to develop Qt/QML applications for Symbian phones or other platforms (it seems most new mobile operating systems such as Ubuntu for Phone, Tizen,… are now using Qt/QML), you may feel comfortable developing apps for Sailfish because it makes use of familiar building blocks: Qt Quick, Qt Mobility 1.2, Qt Webkit 2.2. The SDK also adds “Sailfish Silica” QML module for Sailfish UI components.
Lars Knoll, chief maintainer for the Qt Project, gives a presentation about Qt on embedded systems, including a demo with the Raspberry Pi at the Embedded Linux Conference Europe 2012 in Barcelona, Spain.
Abstract:
For well over 10 years, Qt has been used in many types of embedded devices, ranging from high-end medical systems, through mobile phones and smartphones, all the way to simple devices like coffee makers. This presentation will show some of the work that has been put in Qt throughout the years to support embedded devices, some of the challenges that the development team faced in order to bring a fully-featured desktop toolkit to resource-limited devices, along with solutions they came up with. Time permitting, the presenter will also show Qt demos running on an embedded device.
This session is intended for embedded application developers looking to make use of the capabilities of recent hardware, as well as decision makers looking for technology to enable their product solutions. The presenter is the Qt Chief Maintainer, having worked on and off embedded device development for a decade.
Here are the key sections of the talk:
Qt Introduction
A bit of Qt Embedded history – QWS, Qt Palmtop, Qtopia… used in industrial applications, VoIP phones,
Qt Quick – QML language, easy to bind and extend with C++
Project Lighthouse & Qt5
EGLFS & Wayland - For graphics support. EGLFS: Great option for single process UIs if EGL and OpenGL is available. Wayland: Best solution for multi process environment, integrates with other frameworks
Qt Raspberry Pi Demo
Qt on Android
Presentation slides are not available for this talk, but you can download some other similar “Qt on Embedded Systems” slides for a speech by Lars given at Qt Developers Day Europe 2012.