Comparing Linux and Android for Today’s Embedded Device Development

Tuesday 5/17/22 08:05am
|
Posted By Rajan Mistry
  • Up0
  • Down0

Qualcomm products mentioned within this post are offered by
Qualcomm Technologies, Inc. and/or its subsidiaries.

There’s never a dull moment in the life of an embedded developer. They develop for different types of platforms with all sorts of software stacks, often on different OSs with vastly different architectures.

If you’ve checked out Qualcomm.com and Qualcomm Developer Network, you’ve probably noticed that many of our solutions support Android, Linux, or both. Since both OSs are prevalent in embedded device development today, it’s important to understand the strengths and best use cases for each. Let’s take a closer look.

Linux – An OS With a Rich History Spanning Many Devices

Linux, released in 1991, is an open-source OS that evolved from Unix. It was originally developed for personal computers and found its way onto many different platforms. Its underlying architecture is inherently modular and customizable, allowing developers to tailor the OS for specific needs. For example, developers can remove the GUI subsystem if the OS will be run on devices without displays to reduce both memory and processing requirements. This is why Linux has a long, proven history of powering a wide variety of embedded devices ranging from game consoles and TVs to mobile routers and industrial automation.

This figure shows a simplified diagram of the Linux stack:

Simplified Linux stack

The Kernel Space forms the core of the OS, while the User Space hosts applications built by developers. Linux can provide high performance on lower-powered devices (e.g., small proprietary IoT devices) with limited memory (given the right customizations). This makes Linux suitable for resource-constrained embedded devices where it can utilize the available processing power and peripherals.

Different versions and distributions of Linux have been developed over the years, including some tailored for embedded systems and others with customized software stacks. For example, the LAMP (Linux, Apache, MySQL, PHP/Perl/Python) stack includes components for web servers with database backends. An interesting website to check out is DistroWatch.com which provides news and information about many publicly available distributions.

Linux developers can choose from low-level languages like C/C++ to high-level languages like Java and Python. Traditionally, C has been prevalent since it was used to implement the OS. And thanks to open source, developers aren’t tied to a release roadmap (as is the case with Android), so it can be easier to push OS changes, fixes, and customizations to the broader developer community, while also benefiting from contributions by other developers.

Several of our SoCs support Linux, including our Qualcomm Robotics RB3 Development Kit, Qualcomm Robotics RB5 Development Kit, and Snapdragon 660 Startup Kit. On the software side, some of our SDKs provide Linux runtime support, like the Qualcomm Neural Processing SDK, and our open-source GStreamer plugins (see this repo on CodeAurora). Others, like our Qualcomm Hexagon DSP SDK, and Snapdragon Profiler include tools that run on Linux development machines.

Android – A Linux Variant That Grew up With Mobile

Based on a modified version of Linux, Android was primarily designed for mobile devices with touchscreens and was unveiled in 2007. It’s currently developed by the Open Handset Alliance and commercially sponsored by Google.

Today, Android is finding its way into new verticals, including automotive, medical devices, and home appliances. Not surprisingly, you’ll find that several of our mobile and multimedia-oriented hardware solutions (e.g., Snapdragon 8 Gen 1 Mobile Hardware Development Kit and TurboX SDW4100 Development Kit) specifically target Android, as well as some of our more media-oriented IoT offerings like the Qualcomm QCS8250 and Qualcomm APQ8016E application processors.

Android developers generally use a high-level development stack based on languages like Java, Kotlin, and Python, but have the option to build applications in low-level languages like C/C++. These options are also reflected in our SDKs. For example, our Hexagon DSP SDK provides a low-level C API for working with the DSP at the bare-metal level. At the same time, our Qualcomm Neural Processing SDK for AI includes both C++ and Java runtimes, and Python-based tools for pipeline operations (e.g., converting ML models to Snapdragon’s proprietary format).

This figure summarizes Android’s software stack:

Android’s software stack

Android has been optimized for low power consumption and communication over mobile networks, capabilities that are augmented by our SoC designs (e.g., heterogeneous architecture, 5G/Wi-Fi functionality, etc.), and our rich SDKs. It also includes many advanced features (e.g., gesture recognition) that developers can access through Android’s high-level APIs.

While Android’s underlying Kernel is Linux-based, the higher layers are geared towards mobile device features (e.g., Bluetooth, OpenGL ES, etc.). From a Linux perspective, Android’s software layers, starting with the Hardware Abstraction Layer (HAL), run in the User Space.

Android has an integrated connectivity manager that supports multiple wireless connectivity protocols seamlessly. It also has a built-in telephony stack that supports technologies like GSM, LTE, and VoIP.

Android’s built-in functionality requires a fair amount of memory and powerful processors. Android applications often have large memory footprints, and the OS is generally less customizable (or not customized as much as Linux in practice). This makes Android better suited for rich multimedia devices, such as those powered by Snapdragon, rather than resource-constrained embedded devices. Of course, there are exceptions, like the TurboX SDW4100 Development Kit, which was designed for building small Android-based wearables.

Linux and Android at a Glance

Linux and Android each have strengths that stem from their original design intentions and target platforms. We provide hardware and software solutions that support one or both OSs (e.g., our Qualcomm QCS610 and Qualcomm QCS410 application processors can run on both Linux and Android).

If you’re looking to choose an operating system for your next embedded development project, this table provides a few key considerations:

Key functionality and capabilities of Linux and Android at a glance.

LinuxAndroid
Target DevicesRanges from PCs to resource-constrained embedded devicesMultimedia-oriented devices with more generous amounts of RAM and processing power
Primary Communication ChannelsEthernet and Wi-FiMobile networks
Ease of UseRequires knowledge in OS customizationGenerally easy to get started developing; stack includes almost everything required to develop for most Android devices
Primary Programming LevelGenerally low-level (C/C++) with options for higher level languages (e.g., Java and Python)Generally high-level (e.g., Java) with options for lower-level languages (C/C++)
BootloaderStandard bootloaders that are customizableSimple bootloader that performs only the required tasks before letting the Kernel take control
Hardware DriversMostly open sourceMostly proprietary – may require custom development
LicenseOpen source, GPL V2.0Open source, Apache

For a more comprehensive summary of the functionality and capabilities of these two OSs, check out this article from Embedded Inventor.

For examples of working with embedded devices running Linux or Android, check out this link to our QDN Project page, which has been filtered to show Linux and Android-based projects.


Snapdragon, Qualcomm RB3 and RB5 Robotics Development Kits, Qualcomm Hexagon, Qualcomm Neural Processing SDK, Qualcomm APQ8016E, Qualcomm QCS8250, Qualcomm QCS610 and Qualcomm QCS410 are products of Qualcomm Technologies, Inc. and/or its subsidiaries.