Embedded Linux
Page 1
Embedded Linux
Overview
Embedded Linux is intended for designers of embedded systems and information appliances, as well as
for general Linux programmers. It describes in great detail how to marry your tiny Linux distribution to
the hardware of your choice, building anything from a network router to a do-it-yourself MP3 player.
With specific suggestions on how to build the smallest possible Linux system and advice on choosing
the right hardware for your ultimate goal (better,faster,cheaper),this book teaches you how to build your
first embedded Linux device. You'll gain insight to finding the best Open Source software to fit your
application, with a hands-on approach that guides you through selecting the right tools for debugging
your application,as well as avoiding pitfalls and reducing your building costs.
Introduction
You walk into your home after a long day at work. You throw your keys on the table and plop down in
front of the TV. A few seconds with the remote control and your very own I Love Lucy marathon
begins.The product that automatically records any show or subject area on TV is TiVo, and the
technology behind TiVo is Linux.
We increasingly live in an automated world that George Jetson would envy. We still have computers on
our desktops, but over time they'll also melt into our walls, our furniture—into the very fabric of our
clothes. They'll be so easy to use that we won't have to learn how. Their operating procedure will be
Embedded Linux
Page 2
obvious from their physical design. At the heart of many of these devices will be the Linux operating
system.
Invented by a Finnish college student named Linus Torvalds in the early 1990s, Linux has become the
dominant Open Source computer operating system. Its influence has grown from its original "hacker"
devotees to serious IT departments worldwide and recently to Wall Street. In fact,VA Linux's stock
increased 733% in value on its first day of trading—a new record for the financial world.
Why Linux?
Why is Linux so popular? And why will it be the driving force behind the embedded computer
applications that will soon sweep across the world? We'll examine several reasons in detail, but briefly
these are the two most important reasons:
•
Linux is an Open Source operating system.
The mileage that Linux gets against other operating systems because of its Open Source nature
cannot be overemphasized. The main competitor to Linux in the operating systems market is
Microsoft's Windows family of products. Many other well-funded companies have brought
different (and perhaps technically superior) products to market trying to compete with Windows,
and for the most part those products have failed to achieve the marketplace success that their
designers had hoped for. Like Windows, all of these products were proprietary. The source code
to these products was closed to the public.
The source code for Linux, on the other hand, is completely open and can be changed by anyone
for any reason. You can create a product based on Linux and sell it to anyone without paying any
sort of royalty.You can make any necessary changes to Linux to make your product a success in
the marketplace. The only restriction is that you must share any and all changes you make to the
Linux kernel with the rest of the world.
This "open source" concept really changes how computer projects—especially those at the top
and bottom ends of the food chain—can be and should be designed. If you're designing a large
multiuser computer system, perhaps a large Web site, and you don't consider a solution that
involves Linux somewhere in the picture, you're doing yourself a disservice. Ultimately, you
may not choose Linux—but you should at least consider it. The same holds true for the other end
of the food chain—the very small computer systems such as embedded devices. Again, you may
ultimately choose another operating system for some very good reasons, but you should consider
Linux mainly because of its Open Source nature and the real benefits it brings to the table.
•
Linux has a huge percentage of mind share, which translates into lots of momentum.
There actually is an older, and, in some ways, technically superior Open Source operating system
called FreeBSD. A lot of discussion has gone into why Linux has been so successful with the
development community, while FreeBSD has not enjoyed the same level of recognition.
Whatever the reason, Linux has gained enormous acceptance over the last few years. That
acceptance has translated into mind share, which in turn has translated into momentum, which
Embedded Linux
Page 3
feeds back into even greater acceptance. This beneficial closed-looped cycle is driving Linux to
higher and higher levels of growth and market penetration and is the main reason that Linux is so
popular today and will be here for a long time to come.
What Is an Embedded System?
Okay, now we know some very specific reasons why Linux is a good choice for operating system. I'll
come back to this subject in a bit more detail shortly, but first, it's important to understand exactly what
constitutes an "embedded" system.
User Interface
Probably the easiest way to tell the difference between an embedded system and a general-purpose
computer is the user interface. A general-purpose computer usually has a monitor, keyboard, and a
mouse or other pointing device attached to it. An embedded system may not have a user interface at all,
or may have a more specialized primary interface such as a single button, a touch screen, or a large
control panel. Embedded systems that lack a user interface may just sit listening to a network or a sensor
simply gathering data, or sending and accepting commands. You may be able to plug a monitor and
keyboard into an embedded system, but this isn't the normal mode of operation. You would typically
plug them in for configuration or debugging only.
Does this mean that the PCs sitting in racks at your local ISP, without monitor or keyboard, are actually
embedded systems? Probably not—so it looks like we need to refine our definition a bit.
Limited Mission
The most conclusive method of determining whether a computer system fits into the "general purpose"
or "embedded" category requires an examination of the system's mission in life. Embedded systems try
to be cost-effective solutions to a specific problem or specification set. A general-purpose computer's
mission is much like that of a Swiss Army knife. Like a Swiss Army knife, it ships from the factory with
no clear mission. The Swiss Army knife can cut, saw, snip, screw, de-cork, tweeze, frappé. Similarly,
the general-purpose computer can be used to process payroll, play Quake, surf the Internet, and more.
An embedded system has a limited mission. It might do 10 different things, but those 10 things are all it
will ever do. For instance, the computer built into your car probably regulates fuel, gathers critical
engine telemetry, and waits for a service technician's commands all at the same time, but that's all it will
ever do—it doesn't matter how powerful it is, you're not going to play Quake on it.
Even though an embedded computer has a limited mission, that doesn't mean that its mission can't grow.
For instance, Cisco routers can be customer-upgraded to the latest software release. Not only can bugs
be fixed with the new releases, but new software can be added—expanding the usefulness of the
embedded system.
Another interesting example of an embedded system's mission growing as circumstances dictate is that
of NASA's Voyager 1 and 2 spacecraft (see www.jpl.nasa.gov/releases/97/vgrani97.html). Voyager 2,
the first of the two spacecraft to be launched, began its journey on August 20, 1977. Voyager 1 was
launched a few weeks later, on September 5, on a faster trajectory. Initially, both spacecraft were only
Embedded Linux
Page 4
supposed to explore two planets—Jupiter and Saturn. But the incredible success of those two first
encounters and the good health of the spacecraft prompted NASA to extend Voyager 2's mission to
Uranus and Neptune. As the spacecraft flew across the solar system, remote-control reprogramming
gave the Voyagers greater capabilities than they possessed when they left the Earth.
Anyone interested in embedded computers can find further fascinating reading online at
NASA's Web site. Check out the chapters titled "Computers On Board Unmanned
Spacecraft" in www.hq.nasa.gov/office/pao/History/computers/contents.html.
Hardware Cost/Software Complexity Ratio
We live in a time when the cost of embedded hardware components such as processors, RAM, and flash
memory are falling through the floor, yet the complexity of the software required to run within
embedded systems is exploding. Combined, these two trends change the rules for embedded systems
engineers. Instead of simply worrying about cramming every last possible byte into a memory space
stuffed full, as in years gone by, engineers must now also worry about finding time to implement all the
new software features the marketplace is demanding.
This is the marketplace in which an Open Source operating system such as Linux begins to make sense.
A solution based on Linux can be brought to market much more quickly than a solution that's
handcrafted from a proprietary software vendor, because many more people are working on Linux than
on any proprietary vendor's technology. The perception has been that these developers are hobbyist
hackers who don't really know how to program, but nothing could be further from the truth. Companies
such as Red Hat and VA Linux are paying a lot of money to some very bright people to make sure that
the Linux OS is the best it can be.
Software Cost
The most obvious—but not necessarily most important—advantage that Linux offers is that you pay no
license fee, royalties, or source license fee. In fact, you pay no fees to anyone at any time for the
privilege of using Linux.This can add up to a substantial savings. Commercial embeddable operating
systems like those from WindRiver and QNX can cost tens of thousands of dollars just to start
development, and require royalties to be paid for each product sold.
Of course, it's important to factor into that "free" operating system the costs of developing and
maintaining any changes you want to make—possibly quite long-term.
Stability
Everyone hears a lot of anecdotal evidence that Linux is very stable, especially when compared with
Microsoft Windows NT. But is there any way to quantify that? Has anyone timed the frequency of the
Blue Screen of Death in Windows as compared to a Linux "Oops"? The good folks at the Uptimes
Project (www.uptimes.net) have done a great job trying to answer just this question. Their survey
statistics showed Linux as the second most stable OS behind NetBSD and FreeBSD. As of late March
Embedded Linux
Page 5
2000, the Windows NT box with the longest uptime was number 277 on the list. It had been up for 76
days. If you've ever run NT, you would agree that this is an amazing feat, but in contrast to the 575 days
of the top Linux box or the 1,411 days of the top BSD box, there is really no comparison.
Portability
Linux has been ported to dozens of different architectures. The mainstream Linux source code itself is
compatible with all of the following CPU architectures:
•
DEC Alpha (AXP)
www.alphalinux.org
•
The ARM and StrongARM Processors
www.arm.linux.org.uk
www.uclinux.org
•
Hitachi SuperH
www.m17n.org/linux-sh
•
IA-64
www.linuxia64.org
•
i386
•
Motorola 68K series
www.linux-m68k.org www.uclinux.org
•
The MIPS Processor
www.oss.sgi.com/mips/
•
Motorola PowerPC
www.linuxppc.org
•
S390
www.ibm.com
•
Sparc (32 and 64 bit)