Readying Linux for today's embedded devices -

Readying Linux for today’s embedded devices

Linux is making rapid strides into the embedded world. There are several factors that are driving this trend. Many devices such as netbooks, set-top boxes, mobile devices, assorted gadgets, media players, etc, are Linux powered. Cutting down Linux's boot time is one of the final hurdles that's left to be conquered.

Drivers for embedded Linux

Till some years ago, proprietary operating systems ruled the embedded world. Linux was popular on the server side (running the websites, enterprise applications, etc). It has been trying to compete with Microsoft for the desktop market too, but till now hasn't seen much success on this front. It was written off as a niche player, mostly in the server market.

In the last three to four years, however, there has been a change in the market. Linux is getting adopted in embedded devices and the trend is accelerating. The reasons for the shift to Linux are many:

1. Linux as an operating system is quite mature now. The 2.6 version of the kernel is feature rich and supports kernel pre-emption and threading.

2. There's rich support of drivers for the common devices and peripherals. It's quite easy to find the drivers for common peripherals like WLAN, Bluetooth, infrared, I2C, GPIO, etc. This reduces the development time.

3. There's good ecosystem support of developers, forums, mailing lists and service companies who offer porting, performance tuning and testing services.

4. Last but not the least is the fact that the OS is completely open source and is royalty free.

Rough edges in embedded Linux

When Linux is ported to an embedded or handheld device, it has to be modified to suit the low memory, low horsepower and low resource environments of the embedded world. The task of removing unwanted components, configuring the kernel to use minimal resources and reducing the size is a complex one.

There is also a legacy issue in Linux that impacts user experience: The boot and shutdown operations are carryovers of the original System V UNIX system and they were not written with short boot time or smaller memory in mind. To get Linux adopted for the embedded world, it is required to modify the sources to reduce the boot time. He user experience will be affected if devices like mobile phones take a long time to boot.

There is a dire need to change this structure to make Linux boot and shutdown faster. The rest of the article looks at different approaches, comparison between them, and the work being done in this area.

Virtualization approach

Since 2006, the x86 (as well as x86-64) breed of processors also started featuring hardware-assisted virtualisation and over the years has become quite popular on laptops and netbooks. In this approach, the hardware feature of x86 architecture (dubbed Intel VT or AMD-V) is used.

A thin hypervisor is first started. The hypervisor is typically based on Linux, and it boots in 5 to 6 seconds flat. It is a bare-metal virtualiser which brings up four or five popular applications like a browser, IM client, email client, Skype and so on. Meanwhile, the boot loader of Windows (or any other full-fledged OS) is started in the background. If the user wants to go to “Windows mode”, she can press a key and switch between Windows and fast-boot environment.

The popular products in the category include Splashtop from DeviceVM and Hyperspace from Phoenix technologies. Products that use these technologies include HP’s QuickWeb series of laptops, Asus Expressgate, Acer and so on.

Optimization approach

When the virtualization-based solution is not posible, the only other option left is to optimise the Linux boot and shutdown code to reduce the time.

In the original System V UNIX system, the boot and shutdowns are handled by user-level scripts in located in the /etc/rc/ directories. These scripts poll for devices, create nodes for the devices, start services and the code is written in shell scripts. They spawn many processes and take a big toll in memory and performance. One method is to start many of the unconnected services in parallel. The other approach is to remove the scripts and rewrite them as a single application.

Moving from gLibc to uLibc also helps as it is a leaner library. Many unwanted modules and BUS snoops can be cut down to reduce time. For example, if the embedded system does not have any IDE, the IDE probe code can be removed completely. Writing on console is avoided to save time too. All these changes involve study of the system, careful tuning of the parameters and kernel code and observing the results. Many tricks and techniques for optimization are documented here.

Beside the above mentioned techniques, some companies are coming with optimised distributions to cut the booting time.

• Montavista has announced an optimised version of embedded Linux on the Freescale platform that boots in one second.

• Moblin, promoted by Intel for MID/Netbook market based on ATOM processors, is working on a boot time of five seconds for embedded Linux.

As Linux is getting into mainstream consumer devices like netbooks, mobile phones, set-top boxes, there is need drastically speed up the boot time. And, at the end of the day, efforts that address this factor will help in improving the overall customer experience by cutting down the long waits in boot and shutdown operations.

About the author

Rajagopal Nagarajan is head of the System Software practice at MindTree Ltd. He has more than 20 years of experience in embedded and networking product development and has a strong interest in embedded linux, networking and multicore technologies . At MindTree, he has led the Networking Industry Group which was responsible for VoIP product development and the building of intellectual property on network processors. Before joining MindTree, he worked on device drivers development and networking product development at Wipro. Nagarajan holds a BE degree in Electronics and Communication engineering from The College of Engineering, Guindy, India.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.