Using VolksPC OS to run Linux applications over Android

The Best of Both Worlds

© Lead Image © anyaberkut, 123RF.com

© Lead Image © anyaberkut, 123RF.com

Article from Issue 223/2019
Author(s):

Linux desktop users can now use an estimated two million Android apps that were previously unavailable on Linux with VolksPC OS.

Open source enthusiasts have spent years waiting for the Linux desktop revolution. The Linux environment now supports hundreds of useful, stable, and secure desktop tools that are available for no cost, but Linux still has not displaced Windows or macOS in the race for desktop marketshare.

Android, however, which uses the Linux kernel, has actually become mainstream and is competing quite well. In fact, if you combine desktop, laptop, tablet, and mobile usage, Android has reached 38 percent of marketshare, narrowly overtaking Windows as the most popular operating system in the world.

Android runs on ARM chips that support low-power and low-cost computers. The Android option is therefore quite economical, but what about all that free software you've become accustomed to on your Linux system? Do you need to give up your Linux desktop just because you're running an Android tablet?

The answer is no. A handful of solutions provide options for running desktop Linux applications over Android. This article introduces one of those solutions: VolksPC OS [1].

VolksPC OS, developed by a company of the same name, is designed to let you run a Debian Linux desktop on top of Android with the following features:

  • Full support for running Android applications.
  • Multi-windowed Linux desktop applications that work well with a keyboard and mouse.
  • Instantaneous switching between Android and the Linux desktop.
  • Quick launch of Android applications from the Linux desktop.
  • Installing applications from Google Play and Debian repository.

Some Linux-over-Android solutions depend on the Android layer for hardware access and are therefore hardware neutral, running on most or all Android systems. VolksPC OS takes a different approach. The X client within VolksPC OS addresses the hardware drivers directly, which means VolksPC can operate much faster than many of the alternatives. On the other hand, direct hardware access means that the VolksPC developers must actively port it to the hardware systems on which it will run.

VolksPC sells its own ARM-based mini PC that runs Android and the Debian Buster Xfce desktop. You can also use VolksPC OS with the popular ODROID-C2 single-board computer (SBC). The company has also ported VolksPC OS to several other ARM single-board systems and Android TV boxes. In this article, I refer to Debian as the distro used with VolksPC, but you can also use Fedora, Ubuntu, and other Linux alternatives.

Around 95 percent of the VolksPC software is open source, but the installer app and some graphics libraries included with the solution are proprietary. You can download the ODROID-C2 software from the VolksPC website for $14.99 or purchase the Model-S905X mini PC (with VolksPC OS included) for $99.

All modifications to open source software are available in source code form through the VolksPC website per the terms of the GPL.

Benefits of Running Android with Debian

Android offers many advantages, such as:

  • A large number of available applications and games; none of which will be ported to Linux desktop.
  • Very good support for touch interface.
  • Hardware accelerated multimedia.
  • A large number of ARM SoC's with Android implementation.
  • Runs on an enhanced Linux kernel.
  • Most phones already ship with Android.

However there are some limitations when using Android with large displays:

  • Each application uses the whole screen.
  • Cannot view multiple applications at the same time.
  • No support for desktop-style word processing, email, etc. with keyboard and mouse input.

Linux desktop distributions such as Debian have very good support for legacy desktop-style applications, such as LibreOffice, the Firefox browser, and the Thunderbird email client. These applications also work very well with keyboard and mouse inputs.

Currently shipping phone hardware has enough resources to easily run the Debian desktop. In fact, VolksPC provides such a solution for the popular ODROID-C2 SBC, which is based on a quad-core Cortex A53 running at 1.5GHz. Indeed most phones that ship today are way more powerful. Another important hardware feature on the newer phones is the availability of USB-C port, which when connected to a hub can provide both HDMI output and USB keyboard and mouse input. In other words, your phone can be converted to a desktop or even a laptop (e.g., the Samsung DeX platform).

Consumers already use their cell phones as their primary computing device. The ability to run the Debian desktop on their phones would address those computing scenarios that work better with a large screen driven by a physical keyboard and mouse.

Implementation and Performance

Android and the Debian desktop share the same kernel, so even if the userspace libraries are different, both applications can run simultaneously. The biggest difficulty in integrating the two systems is in the graphics technology. Android uses SurfaceFlinger and Debian uses X windows for drawing graphics.

VolksPC OS runs the Debian desktop using the Android Linux kernel and the Android init program. The Debian distribution is installed using VolksPC Installer (Figure 1) and appears to the rest of Android as a part of the VolksPC Installer files. The /data partition is where application data is stored in Android and is mounted read/write during system boot. The Debian root filesystem resides as a single 3GB file at /data/org.volkspc.installer/files/linuxfs.img and includes all the Debian installed applications and configuration. Android init scripts will mount this file and start Debian during system boot. VolksPC Installer allows you to manage the installation.

Figure 1: Android VolksPC Installer.

VolksPC Installer manages the Linux desktop with these options:

  1. Install VolksPC distribution. This will install the Debian distribution on Android. The installer first looks for the installation zip file, volkspcimg.zip, on either a microSD card, USB stick, or internal eMMC.
  2. Remove VolksPC distribution. This will remove the distribution from internal eMMC. You will need to log out of Debian before you can uninstall. Android factory reset will also remove Debian and Linux user data.
  3. Increase VolksPC image size. The root filesystem is distributed as a single file, linuxfs.img, emulating a disk and is of a fixed size. However, this image can get full if the user installs a lot of Debian applications. This option allows a user to increase the VolksPC image size in 1GB increments.

The Linux desktop uses the X Window System (Figure 2) to implement graphics. This is a client-server approach where the X server controls the display and is responsible for drawing graphics on the screen. Applications, on the other hand, are X clients that exchange messages with the X server via the X windows protocol. Applications are typically written through high-level toolkits such as GTK, QT, Tcl/Tk, etc.

Figure 2: The X Window System.

Figure 2 shows an application communicating with the X server in a Linux desktop environment. Most of the complexity of X windows is due to the client-server architecture. Design aspects that make X windows complex and slow are:

  • The client and server have to format commands and responses (aka, the X11 protocol).
  • Synchronous and round-trip requests are inefficient.
  • Frequent context switching between the application and the X server degrades performance.
  • Graphics rendering can only start after the X server starts running.
  • The X server implementation is not multithreaded.

There are efforts within the open source community to move to a new display server technology, such as Wayland, which to date is still a work in progress.

Since in most use cases, the application needs to draw graphics on the client's machine, it makes sense to implement graphics processing as a driver. VolksPC implements core graphics functions as a kernel module. A modified userspace X11 library communicates directly with the kernel driver (Figure 3).

Figure 3: VolksPC X11 compatible graphics.

The advantages of this design are:

  • Low latency and no penalty for round-trip requests
  • No buffering and formatting of requests and responses
  • No context switch overhead
  • Direct rendering of all graphics by the client
  • No changes required for existing Xlib applications
  • Two to 30 times faster than the standard X Window System.

With support from the kernel module, Debian applications can directly render to the frame buffer without going through Android's SurfaceFlinger. This is a simple and fast solution. Besides providing Xlib API support to Debian applications, the VolksPC kernel module provides the following additional features:

  • Monitors keyboard shortcuts (LeftAlt + LeftMeta) and facilitates switching between Android and Debian display.
  • State of Android graphics and Debian graphics is maintained.
  • At any given time, only Debian or Android occupies the whole screen and switching is instantaneous.
  • Applications are unaware of which desktop is currently being displayed on the screen.
  • Provides a simple API for switching between Android and the Debian desktop.

Android application performance with VolksPC OS is identical to running standalone Android, whereas Debian GUI applications run faster than under X windows.

Besides application graphics rendering, there are many driver and configuration issues that needs to be addressed to make a completely functional Debian desktop. These include:

  • Support for a Bluetooth keyboard is handled by the kernel module.
  • Audio for a Debian application is handled by the Linux ALSA driver.
  • External drives mounted by Android are visible to the Debian desktop. This allows for easy sharing of files between Android and Debian.
  • During startup, Android's time zone and language settings are used to configure Debian's time zone and keyboard.
  • Android applications appear as icons on the Debian desktop and can be launched from Debian.

Hardkernel [2], the manufacturer of ODROID-C2, makes several ARM boards for which they provide both Android and Ubuntu distributions along with Linux kernel sources. VolksPC is ported to the ODROID-C2 board [3], which is based on an Amlogic S905, quad-core Cortex-A53 running at 1.5Ghz. This board is slightly faster than Raspberry Pi 3 B+ and more importantly comes with an Android Marshmallow port. The official ODROID-C2 Ubuntu 16.0.4.2 distribution is based on the MATE desktop 1.12.1 running a AARCH64 user space. The VolksPC distribution is based on Debian Jessie ARMHF. We also installed LXTask and GtkPerf to compare performance between VolksPC OS and Ubuntu [4] running on ODROID-C2 (see Table 1).

Table 1

VolksPC OS and Ubuntu Performance

 

Ubuntu 16.0.4.2 AARCH64, Mate 1.12.1

VolksPC OS Debian 8.8 ARMHF, Xfce 4.10

Linux Kernel Version

3.14.79

3.14.29

LXTask

After complete boot up shows 392MB used from the available 1717MB

After complete boot up shows 390MB used from the available 1717MB

GtkPerf

Took 13.89 seconds for 100 iterations

Took 7.89 seconds for 100 iterations

The memory usage is roughly the same except that with VolksPC OS I have also booted Android. The GtkPerf benchmark runs 176 percent faster on VolksPC OS. Also the client-server X11 runs on two cores when running the GtkPerf benchmark: one core running the GtkPerf client and another core running the X11 server. In the case of VolksPC OS, graphics are rendered directly on one core. It is important to understand that X11 performs reasonably well when commands are streamed from an X11 client to an X11 server as is mostly the case with GtkPerf or x11perf benchmarks. Unfortunately, X11 architecture becomes an issue when you try to get information or events from the server. On the same ODROID-C2 system, the x11perf -prop command to get an X property from the X11 server runs 30 times faster with VolksPC OS.

So VolksPC OS provides a smoother graphics experience for the Linux desktop while also providing user access to an estimated two million Android applications.

The Debian Stretch version of VolksPC OS has already been released for ODROID-C2 and a preliminary port of Debian Buster is being tested internally.

The Future of VolksPC OS

Android supports GPU and OpenGL ES applications, but Debian on VolksPC OS can only support 3D graphics if used with the Mesa open source OpenGL implementation. Unfortunately, most of Android's graphics implementation is proprietary. Still it is not a serious issue as most Debian applications only need 2D rendering, and as shown, VolksPC OS is much faster in this area. However, 3D rendering is important for games. VolksPC OS will support this if GPU vendors provide easy access to their graphics drivers and supporting libraries. Also Linux games require OpenGL, but most ARM SoCs only support OpenGL ES. Lack of 3D and video acceleration in Debian is not a show stopper, since VolksPC OS provides complete support for all the graphics and video acceleration on Android. Consequently, VolksPC offers an interim solution where Android applications are good for HD video playback and 3D graphics-rich games, while Debian applications are good for programming tools, scientific applications, word processing, and email.

Infos

  1. VolksPC OS: https://www.volkspc.org
  2. Hardkernel: http://www.hardkernel.com
  3. VolksPC OS running on ODROID-C2: https://www.youtube.com/watch?v=tTW7OyTFkGQ
  4. VolksPC OS vs Ubuntu on ODROID-C2: https://www.youtube.com/watch?v=5jmvYryz2hw

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Workspace: Linux on Android

    If you want to install Linux on an Android device, you have several options. We examine some of the possibilities.

  • 2010 LinuxQuestions.org Members Choice Award Winners

    "The polls are closed and the results are in. We had a record number of votes cast for the tenth straight year. Congratulations should go to each and every nominee. We once again had some extremely close races," says Jeremy Garcia today as he announces the 2010 LinuxQuestions.org Members Choice Award Winners.

  • New Android Security

    Google says the upcoming Android L release will be far more secure than its predecessors.

  • Ubuntu for Android

    Canonical announces Ubuntu for Android.

  • Android in a Box

    Need Android apps in a separate window on the Linux desktop? Anbox is the answer. Unlike common Android emulators, the software relies on LXC containers and kernel namespaces. We tested the pre-alpha version.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News