Running Linux on Tiny Peripherals

430

It seems like every day new IoT devices with a very limited amount of RAM and storage space are appearing in homes, gardens, businesses, labs, and elsewhere. This includes things like heart rate monitors, thermometers, home automation components, and other devices that only need to perform small, limited tasks. About a year ago, Marcel Holtmann from Intel began looking at the challenge of shrinking Linux to run on these types of small, IoT devices as a hobby project, and at LinuxCon Europe, he presented what he’s learned about how to run Linux on tiny peripherals.

When you begin working with these tiny devices, you ultimately need to decide whether to use a real-time operating system (RTOS) or stick with Linux, Holtmann says. He mentioned that at the October 2015 Kernel Summit in Seoul, Jon Corbet talked about the fear that if they couldn’t shrink Linux, Linux would lose out on the vast numbers of IoT opportunities and become less relevant. In some cases, Holtmann points out that Linux will be a better choice than a RTOS. For example, if you need an IPv6 stack to support a particular feature or Wi-Fi connectivity, most RTOS’s won’t have them, but Linux does. Where do you spend your time? Shrinking Linux or building a new feature into your RTOS?

The costs of these devices are coming down drastically, to the point where people are starting to use devices like the Raspberry Pi for speaker gifts and other giveaways. Holtmann talked about three categories of devices: First, simple sensors, like thermometers and Bluetooth heart rate monitors that are very inexpensive; second, IP nodes, like IPv6-enabled devices used for home automation and with a variety of mesh technologies; and, third, larger gateway devices like routers and Wi-Fi access points. 

Holtmann said that for the tiny devices he wanted to focus on, you can’t just install your favorite distribution and hope for the best. He picked several very specific components to build his Linux-based devices: gummiboot (UEFI boot loader), Linux (OS kernel), musl (C library), ELL (utility library), and BlueZ (Bluetooth library). From the idea to implementation, he worked mostly in QEMU to avoid tangling with the hardware until he figured out what would actually work. When he was ready to test it on real hardware, he booted it from a MicroSD card on a Minnowboard Max with a USB-based Bluetooth dongle. 

For all of the details about exactly how he optimized Linux to run on a tiny device, watch the video of Holtmann’s entire presentation below.

Interested in speaking at Open Source Summit North America on September 11-13? Submit your proposal by May 6, 2017. Submit now>>

Not interested in speaking but want to attend? Linux.com readers can register now with the discount code, LINUXRD5, for 5% off the all-access attendee registration price. Register now to save over $300!