Embedded Linux Linux Inside


Linux
inside
Why are so many developers now
choosing to build their embedded
applications with Linux? Bill
Weinberg reviews the reasons
rom the business parks of Silicon
Valley, to Wall Street, Linux was the
Fcatchword of 1999 and 2000. All
signs pointed to Linux continuing as both a
hot financial and technological prospect
into the new millennium. While today, in
2001, IPO fever seems a distant memory, Inside . The long and short of it is that
there are still strong technical reasons to embedded Linux, before and after the
consider using Linux for your next embed- dot.com meltdown, is the embedded plat-
ded development project. form with lowest overall cost and the fastest
Embedded Linux offers measurable engi- time to market. This article reviews these
neering advantages, like broad hardware and other reasons for building your next  borrow drivers from, you guessed it, Linux!
support, scalability, excellent performance, embedded application with Linux. And, they still must invest substantial time
high reliability, and open APIs. There are and (customers ) money to port the inter-
The elusive device driver
enticing financial reasons to employ Linux: faces to their proprietary, closed systems.
no run-time royalties, free or low-cost avail- Finding device drivers for embedded Contrast the availability of drivers for
able software components, and freely avail- designs based on a traditional embedded Linux: with very few exceptions, device
able source code. Add to these some less tan- OS, running on commodity-off-the-shelf interface code for Linux appears quite regu-
gible business reasons to put a penguin into hardware, can be a frustrating exercise. In larly along with or even prior to the release
your next internet appliance, control sys- the desktop and server world, new devices of the new devices themselves. For example,
tem, or communications switch: engineers emerge every six months or less. Peripheral several years ago a client of mine in
like Linux and want to put Linux experi- vendors themselves augment the OS offer- Australia needed an Ethernet interface dri-
ence on their resumes, easing today s hiring ing with drivers and utilities that accompa- ver for the proprietary OS they were using.
crunch - and so do marketers, who continue ny their video cards, network interfaces, The chip manufacturer, although already
to be eager to package products with  Linux and other devices. Smaller, more resource- shipping silicon, was keeping the specifica-
constrained embedded OS vendors struggle tion under wraps. Rather than haggle with
to keep a few dozen device drivers and the vendor, together with a consultant I eas-
board support packages current. I once ily found a Linux driver for the device, and a
spent three days searching for a single-board rapid port ensued. The client was so
computer whose complement of peripher- impressed that last year they switched to
als was fully supported by the OS in use! embedded Linux for their application plat-
Even more challenging is getting an embed- form.
ded OS to pass the  Currys Test  walking
Scaling Linux
down the aisle of the local electronics retail-
er looking to find which devices, if any, a Traditional embedded operating systems
traditional embedded OS supports. tout the size and efficiency of their kernels.
Traditional RTOS vendors employ two Even today, when memory is only available
strategies to support the hardware chosen economically in increments of 4MB or
by their customers: either charge up to 16MB, vendors still extol their  complete
US$40,000 in NRE/consulting fees (and micro-kernel solutions in 50KB.
then retain the driver code themselves), or Realistically, viable commercial OS configu-
LinuxUser/October 2001 51
EMBEDDED LINUX
rations come in at 128-256KB for a reason- respond in a sprightly fashion with a hand-
Embedded Linux, present and
ably configured kernel, another 100-200KB ful of threads and a couple of interrupting
future
for a TCP/IP stack and sockets library, and devices, but scale either significantly and
for a web appliance, 50-300KB for a HTTP watch responsiveness drop and jitter hit the
Key enabling technologies are now emerging and
maturing to foster the mainstreaming of Linux in server, plus a minimum 64KB of working ceiling.
embedded applications.
RAM. Thus, an embedded system software Linux, developed for desktops and
profile of 800 KB to 1MB no longer looks servers, is also a GPOS, but enjoys great suc-
Broadened processor support
gargantuan. cess in embedded designs with real-time
Prior to the year 2000, most Linux distributions
These same vendors point out that a requirements. Three primary paths exist to
focused on Intel Pentium. The last two years have
brought support for a range of embedded 32-bit
desktop distribution of Linux runs into the providing a real-time Linux: (1) tuning key
x86 and PowerPC CPUs, including the low power
hundreds of megabytes. Well, they are right. device drivers and kernel functions (ad
Crusoe and Jeode, and high power and high integra-
However, embedding an OS like Linux is hoc), (2) inserting a second kernel into the
tion PowerPC processors from Motorola (74xx, 8xx
more like lunching at a good cafeteria than system, and (3) refining the standard Linux
and 82xx) and IBM (4xx). They ve been joined by
ports for half a dozen MIPS-family and ARM archi- dining at an upscale prix fixe establishment. scheduler and using a preemptible version
tecture chips popular in networking, gaming, and
When you embed Linux, you choose only of the Linux 2.4 kernel, such as the open
office automation, like Alchemy s Au1000, NEC s VR
those components that make sense for your source project sponsored by MontaVista.
family, Intel s StrongARM, XScale, and the ARM
application. Don t need a read/write file sys- Before even attempting to enhance
720/920. Add to this list emerging Japanese CPUs
like SH-3 and SH-4 and you see that Linux is begin- tem? Don t use it! The same logic applies to Linux responsiveness, it is key to measure its
ning to rival and even outstrip traditional RTOS plat- networking, GUI, shells, and countless real-time performance, thoroughly, in terms
forms for CPU coverage.
other utilities and libraries. If your project familiar to real-time/embedded designers:
does need more functionality than fits into worst-case interrupt latency, context switch,
Open source flash file systems
local non-volatile storage, you can craft maximum blocking times, and most impor-
Closed source enabling flash technology has been
joined by reliable, compressed and wear-levelled file either a tiny Linux boot loader, a stand- tantly, preemption or task response latency.
systems like CramFS and JFFS.
alone bootable Linux system, or a slim Simply knowing how well Linux responds
Linux kernel that pulls down additional on a particular platform in many cases obvi-
CompactPCI-based HA
modules and application code over a net- ates the need for additional re-architecting.
Ports of Linux today exist for CPCI systems from
work, often in 500KB or less. Also, Linux already enjoys provably superi-
vendors like FORCE, Motorola, Radisys, and Ziatech,
now offer high availability frameworks with PCIMG
or compute and networking performance
hot swap support, with maturing models for Linux
Linux and real-time
throughput, even when compared to sup-
hot swap infrastructure (PICMG 2.14) and hot swap
Many (but not all) embedded applications posedly lightweight RTOS products, with
aware drivers (HSADs), bonding redundant network
have some sort of performance or respon- good-to-excellent average response times,
drivers, backplane communications, and multiple
options for clustering. siveness requirement. However, the latency- even under load.
sensitive portions of embedded code are The first approach above (tuning) has
Enhanced real-time support
usually dwarfed by purely throughput-sen- been applied to GPOS applications for years,
With the advent of the version 2.4 Linux kernel and
sitive code that implements control algo- with deployed examples on Solaris, and
options for preemptibility, Linux has become more
rithms, communications protocols, and Windows NT; indeed such tuning is a mat-
real-time/deterministic in performance (see above)
with average preemption latencies under five
user interfaces. Moreover, many of these ter of course for many so-called RTOS plat-
microseconds.
real-time requirements prove to be  soft  forms as well. The second path (kernel sub-
missing a deadline once in a while does not stitution), which has also been applied to
More options in tools
impact the overall system viability. Even Windows NT (by Radisys and VenturCom),
Traditional cross-development tool vendors and
open source projects are at last delivering both when  hard real-time deadlines do exist (in presumes that to use Linux for real-time,
workstation Linux hosting and embedded Linux tar-
less than 10 per cent of embedded applica- you must first  throw it out . The addition of
geting tool sets for C, C++, Java, IDEs, and high-
tions), the scope of deterministic response a second OS, regardless of its putative real-
level design tools that complement or compete with
can be reduced to the driver level or over- time characteristics, complicates both the
GNU. Examples include IBM Visual Age Micro
come by the  real-fast performance offered development and run-time considerations
Edition, Kdevelop, Greenhills Multi for Linux,
MetroWerks Code Warrior, I-Logix, Rational, and
by combining Linux with Pentium, of the embedded Linux developer. The sec-
others.
PowerPC, or MIPS silicon. ond OS introduces: a second set of RTOS-
So, when developers choose to embed specific APIs; the loss of Linux process and
Embedded Linux tools
Linux to leverage the wealth of available threads programming model; a  flat memo-
Developers are now leveraging tools targeted
specifically at embedded Linux, including GUI- networking, database, and interface soft- ry model without benefit of memory pro-
based scaling/configuration tools (like MontaVista s
ware, real-time concerns often take a back tection; starvation of applications running
Target Configuration Tool and other vendors wiz-
seat. But should they? Using a general-pur- in the  normal Linux environment; and
ards), small GUIs (like TrollTech s Qt/embedded and
pose operating system (GPOS), like stratification of Linux applications and dri-
MontaVista Hard Hat Graphics), and tiny web
Windows NT, for real-time and embedded vers into poorly-defined non-real-time and
servers and reduced footprint browsers (like
Netfront, Opera, and Mozilla)
applications, can spell disaster  recall the real-time classes.
US Navy s having to tow their Aegis destroy- The much more sensible, third approach
These developments and others, technical and mar-
ers back to port, repeatedly, because of is to optimise the existing, open Linux code
kets-based, have brought embedded Linux into the
crashed Windows NT steering systems. A base to address the needs of actual applica-
traditional domains of the proprietary RTOS. Linux,
with its wealth of networking software, very natural- GPOS typically suffers from several chal- tions. (For additional information on lever-
ly accompanies the Internet revolution as host to
lenges to real-time applicability: determin- aging the Linux SMP kernel for preemptible,
applications like Internet-enabled multimedia,
ism in general, and response under load in deterministic performance, see Key Links).
SOHO office appliances, and home network gate-
specific. GPOS schedulers, optimised for
ways, as well as finding its way into both shelf and
Legacy code
time-sharing, can induce unpredictably
card controllers for large communications switches,
routers, and other infrastructure equipment.
long blocking times (up to 500 millisec- Application code comes to an embedded
Industrial control, robotics, instrumentation - all tra-
onds!); drivers developed by a mix of GPOS- Linux environment from one of three
ditional domains of the proprietary RTOS, are now
vendor engineers, peripheral-board ven- sources: existing code written for a commer-
implementing and deploying Linux-based systems.
dors, and other third parties add their own cial RTOS, code written for an in-house pro-
variable latencies. The whole system may prietary kernel or executive, and code devel-
52LinuxUser/October 2001
EMBEDDED LINUX
oped for Unix-compatible workstations and dependencies on semi-proprietary exten- vendors like MontaVista). Embedded Linux
servers. sions (vendor and platform specific) or from suppliers cannot afford  drive-by selling
Applications running on both commer- use of superceded open APIs (like POSIX.4 strategies  their commercial viability
cial and in-house kernels share a key charac- or other POSIX draft APIs). Such challenges accrues only from the quality of the distrib-
teristic: proprietary APIs. While several off- are very much akin to those faced when ution products and services they offer, not
the-shelf kernel products enjoy extensive porting proprietary code. customer lock-in from proprietary intellec-
design-in success, few if any offered pro- While many embedded developers use tual property.
grammers viable open applications pro- the occasion of moving to Linux as an Proprietary embedded OS vendors
gramming interfaces, like POSIX or the opportunity to rearchitect their code, there attempt to front-load their commercial rela-
cross-industry openness of the various still can arise the need to move existing pro- tionships (even those charging royalties),
Linux APIs. Moreover, embedded OS ven- grams with proprietary system and library and thereby have little or no interest in see-
dors had little interest in supporting open calls, ad hoc/in-line device access, explicit ing a project through to completion.
APIs or any other tools that might facilitate interrupt/preemption disabling, and so on, Embedded Linux suppliers must (and do)
customers porting applications from their to Linux. Solutions exist for accommodat- prove their worth from the start to impart
kernels to those of other vendors or to open ing the most frequently-used calls and value to their offerings (beyond what one
platforms. In-house kernels, developed for programming practices (see box on this gets from the newsgroups), today, and
very specific target applications, either had page, Accommodation Solutions). tomorrow. The benefit to you as an embed-
no perceived need for openness and porta- ded developer is a supplier who lives or dies
The embedded Linux business model
bility, or arose with and were perpetuated upon your project s success.
by NIH ( not invented here ) sensibilities. Embedded systems designers have always
Linux cachet
Today, embedded and real-time systems reluctantly faced to prospect of purchasing
designers, excited by the benefits of Linux development tools. First came the sticker In the past, choice of embedded software
and the Linux explosion in general, are shock from per-seat proprietary tool sets components was a closely-held trade secret;
eager to build their next-generation prod- priced from US$15,000 to US$20,000. Next implementation specifics, including the
ucts on an embedded Linux. However excit- came often-obligatory service contacts, usu- embedded OS, could confer significant
ed, they still must face the challenge of port- ally of dubious real value. And last came the competitive advantage. Marketers and
ing existing code to Linux. haggling over run-time pricing and over the embedded OS vendors despaired of ever
Porting Unix applications to Linux often cost of source code (which can run over being able to crow about design wins 
is as simple as typing  make or using a GNU US$250,000). While some typically low-end either the project languished, or the appli-
configuration package. The availability of embedded OS vendors offer run-time buy- cation designer remained tight-lipped when
POSIX (IEEE1003), System V, Berkeley, X11, out options, most impose a heavy deploy- it came to PR.
and other standard APIs on Linux makes ment royalty, not just on the kernel but on Compare new designs based upon Linux
porting incredibly easier, if not always 100 every useful component. These run-time  when before have high-tech product mar-
per cent transparent. Challenges arise from costs significantly raise real development keters touted their companies choice of
costs, and impact the cost- operating system?  Linux Inside is now
of-goods-sold of your prod- appearing on the outside of products.
Accommodation solutions
uct, thinning sometimes- When have manufacturers been able to use
It can be necessary to move existing programs to Linux complete with pro- precarious margins and their embedded OS choice as a hiring incen-
prietary system and library calls, ad hoc/in-line device access, explicit inter- threatening your time-to- tive? Linux expertise continues to be in
rupt/preemption disabling, and so on. Solutions for accommodating the sev-
volume. high demand in the US, Europe, and Asia.
eral dozen most frequently-used calls, as well as programming practices,
Contrast the embedded And when have inherent economies freed
breaks out as follows:
Linux business model. the embedded developer from being a
Open tools, open kernel, hostage to imperious tools and OS vendors?
Task creation, scheduling, management use POSIX/Linux threads
open utilities, greatly Today. That s when, with embedded Linux.
IPCs (queues, mutexes, etc.)use POSIX .1 and SVR4 equivalents
reduced (but not eliminat-
Bill Weinberg is director of strategic marketing at
Networking use equivalent Berkeley sockets
MontaVista Software
ed) cost of development
Pre-emption disable migrate to driver / rearchitect
and deployment.
In-line interrupt management migrate to driver / rearchitect
Moreover, most commer-
Key links
Direct memory access either migrate to driver or use POSIX .1b mmap()
cial embedded OS vendors
enjoy only a 25-30 per cent Leveraging the Linux SMP kernel for preemptible,
For developers not wishing to re-code to track the above, inter-OS transla-
deterministic performance
support renewal rate (com-
tion libraries do exist for at least large APIs subsets. MontaVista Software
www.mvista.com/realtime
and other companies provide RTOS porting and emulation kits, and a num- pare the 85 per cent-plus
ber of independent vendors, like Migratec, focus on the inter-OS migration
subscription renewal
Linux kernel preemption project
process.
enjoyed by open source
http://sourceforge.net/projects/kpreempt


Wyszukiwarka

Podobne podstrony:
Embedded Linux Realtime
Embedded Linux Kernel And Drivers
Embedded Linux Ready For Real Time Montavista
inside the linux 2 6 completely?ir scheduler ibm?veloperworks
Linux 2000 DVB T Experiments
linux kobiety
compilar linux
Linux IPCHAINS HOWTO Appendix Differences between ipchains and ipfwadm
systemy operacyjne cw linux apache mysql
Linux materialy
Linux System Plików
Asembler linux
Nauka słówek i memoryzacja na Puppy Linux
rs232 linux win32 cz2
linux 1 00
linux zen
linux nt loader pl 7
03 Linux Konfiguracja serwera FTP PROFTPD

więcej podobnych podstron