BY CHRISTOPHER HALLINAN
Technical Marketing Engineer
Mentor Graphics
L inux has become the de facto standard operating system in embedded designs for consumer devices, automotive systems, military and aerospace designs, medical equipment, networking, and many others. There are likely a number of devices in the modern home that run Linux, such as digital TVs and DVRs, set-top boxes, and smart appliances. It is not uncommon for business travelers to have multiple Linux-powered devices in their laptop bag. The Android smartphone has given credence to the Linux operating system as a powerful mobile OS.
One of the most significant challenges facing embedded Linux device manufacturers is time to market. Competitive pressures and unrelenting consumer demand have shrunk development cycles to mere months, in some cases. In a fast-paced development environment, early choices usually have big impact on the overall success of the project. Investing early in competent development tools helps successful companies maintain a competitive edge.
Deploying products based on Linux and open-source software presents a wide range of choices and challenges. A large collection of software must be integrated — a set of standard runtime libraries along with many core application packages and their supporting libraries. Developers need to select the correct version of the Linux kernel and then develop support for their unique design features.
Selecting a cross-toolchain
Early in the development cycle, a cross-toolchain and associated binary utilities must be selected and successfully integrated to produce a quality product (see Fig. 1 ). This choice is complicated by the fact that modern processors often have specialized acceleration hardware that can be exploited by the compiler and libraries if properly configured and built within this environment.
Fig. 1: The right development tools influence not only software and corresponding applications, but also on how effectively the hardware is used.
The ARM NEON is one good example of specialized hardware acceleration that requires compiler support. The NEON architectural feature is found in some Cortex-A series cores and accelerates tasks such as video encoding and decoding, 3D graphics, speech, and image processing. In order to take advantage of NEON acceleration, the compiler and embedded libraries must be configured to emit the specialized machine instructions for these features.
The kernel and boot loader
Once the tools and development environment are assembled and validated, the process of compiling the many software packages, including the kernel and boot loader, can start. These packages, together with the Linux kernel, make up the base platform Linux operating system image.
When all the software for a platform is compiled, the binary and other output files must be assembled into the proper format(s) for booting the platform. Each embedded platform has its own unique image formats and requirements for booting. This often involves, at a minimum, a root file system image compatible with the root device, and boot images in the proper format and location required by the particulars of the boot loader.
Building the applications
The challenge now becomes transforming this into a product by creating application software that defines and differentiates it. This may involve developing Linux device drivers to support the unique hardware device(s). It certainly involves code that defines the product’s functionality.
A typical embedded Linux device contains hundreds of software packages with multiple files including binary executable or library files, configuration and control files, initialization and startup scripts, and possibly documentation. A simple embedded Linux system without graphics may contain software from 150 packages pulled from over 100 source code repositories. A more full-featured embedded Linux system with graphics and web-centric features might contain many hundreds of software packages pulled from over 300 open-source repositories scattered around the globe (see Fig. 2 ).
Fig. 2: Integrating hundreds of different applications requires a comprehensive development system that can pull it all together into a functioning whole.
A simple build system for all the packages could have little more than a cross-compiler and a makefile. With this a developer must have the knowledge and expertise to know what to build, how to build it, and what dependencies are involved. The build systems represent hundreds to thousands of hours of development effort and are virtually always difficult to modify and maintain.
‘No-cost’ Linux images
There is a dizzying array of choices for sourcing all of these components. Board vendors often have no-cost Linux operating system images that come on the board. Semiconductor manufacturers also provide no-cost Linux images for their processor chips. These are usually fixed and difficult to customize, and come with no support of any kind.
Prebuilt Linux operating system images can be found online for popular commercial off-the-shelf boards. These usually work for the default board configurations, but suffer the same drawbacks as other free offerings — extremely difficult to customize and if modifications are made they are no longer supported. A build system capable of building embedded Linux operating system images is required to achieve any level of customization beyond the trivial.
The enormous challenge of customization has given birth to over 40 embedded Linux build systems. Most have faded into obscurity, but a few are in use today. The Yocto Project (www.yoctoproject.org) provides by far the most powerful build system framework dedicated to embedded Linux.
The Yocto Project
The Yocto Project is a collaboration among software, semiconductor, and other hardware companies providing templates, tools, and methods for custom embedded Linux systems. It is relatively easy to build a working embedded Linux system using the Yocto Project, provided developers use the standard configurations available for a few well-known hardware platforms. Doing any kind of serious customization, however, requires substantial knowledge and expertise.
The Yocto Project framework is designed to facilitate integration of disparate software elements into a coherent set of platform images capable of booting a specific board (see Fig. 3 ). This framework also facilitates integration of kernel patches and configuration changes.
Fig. 3: The Yocto Project framework facilitates integration of software elements into a coherent set of platform images.
It is not particularly difficult for someone with good Unix/ Linux skills to make the changes necessary to add a kernel patch or modify a kernel configuration. The challenge is in determining what changes to make.
The challenge of differentiation
Product manufacturers strive to produce differentiated products with compelling features for their customers. The challenge is to limit the cost of development for the nondifferentiating elements (Linux operating system and its supporting software) while maintaining maximum investment in the core competency of the company’s products – the key differentiating features. Building the customized Linux operating system image for a unique hardware design can be technically challenging and resource intensive and the company’s staff may not have the in-depth Linux and hardware expertise to cost effectively develop the software.
Custom hardware usually requires specialized support from the operating system, either device drivers or custom application software, or more commonly, elements of both. Writing device drivers in any operating system is never trivial. It requires technical competency in the OS itself. Technology from the Yocto Project provides a framework for building custom embedded Linux systems, but it will not teach the developer how to write a Linux device driver. Many companies choose to work with a software vendor who has proven and deep experience in open-source software and tools.
Getting support
Knowing how and where to obtain technical support is one of the more challenging aspects of successfully employing Linux and open source. Traditional vendors of embedded Linux bound their support around fixed templates. Once those templates are modified (which is virtually always necessary with a custom Linux product) support costs can rapidly escalate. Understanding the support policy of commercial embedded Linux vendors is critical to containing costs.
There are a number of Linux solutions available including a package from Mentor Graphics that provides a complete suite of development, debug, and analysis tools and a build system based on technology from the Yocto Project. Mentor Embedded Linux addresses support challenges by expanding the support circle to include modifications made by the developer. ■
Learn more about Mentor Graphics