Embedding Linux
Total Page:16
File Type:pdf, Size:1020Kb
L1nux Alex Lentnon explains the whys and hows of fitting a software quart into a pint pot-with room to spare t's hard to escape hearing about Liiiux these for networking. This includes a large nurnber of days, while sightiiigs of the. Linux mascot, drivers for network interface adaptors, and a a slightly overweight penguin, are complete implementation ofTCP/IP networking. Ibecoming commonplace. If you're a There are also drivers available for USB devices, systems softw-are buff tlie excitement can seem PCMClA cards, multimedia devices and many natural enough, but for everyone else, curious other types of hardware. bewilderment is the more likely sentiment. So The typical Liiiux distribution comprises a what exactly is Linux, and why is it so wealth of software resources. In addition to the important? kernel, it will include a basic Linux file system, Linux is an open-source Unix-like kernel, that a desktop GUI, development and debugging can be freely distributed under the ternis of the tools and a myriad of other open-source GNU General Public Liccnse. (See the Links (distributed under the GPL) amlications and section for details of the GNU project and the utilities Such is the enthusiasm of the Linux Open Source Initiative). It was developed initially fraternity that, whatever your requirements, by the Finnish student LinusTorvalds, and had its there 15 likely to he a group working on a first official release a surprisingly long time ago project which will be useful to you-XM in October 199 1.Right from the beginning, as is Java, wireless networking, Bluetooth, netwo tlie case today, distributions of the Linux kernel protocols, IPv6, home automatLon, remote have been accompanied by GNU-developed data acquisition and many iiiore utility prograins to form a complete operating system. Strictly speaking, the correct name for The whys of embedded Linux such distributions is GNU/Linux, although tlie Historically, Linux wa5 GNU prefix is generally dropped in the interests speufically as an opei-ahng system for the of brevity. Sirice its initial release the desktop/server environment. More communications infrastructure provided by [he recently, there has been a growing Internet has enabled large numbers of developers interest in tailoring Linux to the very 1 to enhance and extend Liimx, to the point where different hardware and software 1 it can now be seen as a mature alternative to needs of the embedded applicauons operating environments such as Windows and environment. Unix. In hardware terms, the mimmum I Linux is a multi-tasking, multi-user, multi- requirements of desktop Linux 7 processor operating system supporting a wide compare favourably with operating range of hardware platfornis, such as x86, Alpha, systems such as Windows and Solaris Sparc, MIPS, SuperH, PowerPC and ARM. Where Red Hat, a Linux distributor, suggests hardwarc support is provided, the kernel makes niinirnuni installation of an Intel 386 or use of protected-mode memory management, above for the CPU, a 1620 Mbyte hard disk increasing system reliability as one failing for a server, or 450 Mbytes for a workstanon, application is unlikely to cause the kernel, or arid 16 Mbytes of RAM A hardwar other applications, to fail. One of the great footprint of this order is entirely strengths of the operating system is the support reasonable for a desktop PC, IEE REVIEW MAY 2001 .33 edded operating system must display a ree of robustness well beyond the requirements of the desktop domain. A Linux server, or even a desktop 1 machine, expects a specific power- down sequence to occur before the power supply is removed from the system. If the power fails unexpectedly a system can become corrupt. Power cycling and power failures (often user generated) are inore likely in embedded environments and the system is required to handle these without user intervention. Established embedded operating systems, such as QNX, pSOS, and VxWorks, have been designed from the ground up to conform to the constraints inherent in an embedded environment. Similarly, the demands for real-time performance were addressed during the initial design phase. As a result, commercial non-Linux embedded operating systems have tended to he more scalable at the low end and have better real-time performance. The real- time performance issue can he important in the embedded operating system market, and embedded Linux vendors are working hard to match the real-time capabilities of established products. Given the availability of highly capable existing embedded operating systems, and the substantial hardware and software challenges id inherent in adapting Linux to the embedded world, the obvious question to ask is: why t bother? In practice, the considerations that make preient Linux attractive in the embedded domain insuperable closely mirror its strengths in the desktop 1 Arcom’s Elanl04-NC obstacles to current embedded systems environment. Embedded Linux hardware-at least in terms of CPU and RAM Development Kit, incorporating an Elan- requirements No licensing fee is needed-For high-volume, low- 104NC single board Space for the file $ystem is, however, quite cost items such as Internet appliances, a zero computer [featuring a another matter If we are able to use rotating licensing fee can’t be beaten. 100 MHz media, as with the Arcom Elan-l04NC single 486-compatible processor, with board computer (Fig l), incorporating Open source-The kernel and support 16 Mbytes of RAM and 16 Mbytes of RAM, a 100 MHz 486, and a applications are open-source, implying direct 8 Mbytes of flash 4 Gbyte attached hard disc, then it’s possible to access to the source code. Developers can thus memory), a power run a standard installation of Linux (albeit see exactly how individual parts of the supply unit and all connectors needed to slowly) In practice, most embedded systems operating system work, can customise run embedded Linux run from ROM or flash memory, and a more behaviour, and optimise performance in time- ‘out of the box’ typical footprint would be a 386/486/586 or critical sections of code-an impossibility equivalent processor, 8-1 6 Mbytes of‘hard disc’, with rival commercial operating systems. implemented as flash memory, and 16 Mbytes Similarly. in the medical and defence arenas, it or more of RAM The high per-byte cost of flash is often necessary to certify an entire body of memory means that a pared down keriiel and code running within an embedded system. minimal file system are mandatory for any This is only possible where the complete practical implementation of embedded Linux operating system source is available for Aside from footprint constraints, an inspection. 34 IEE REVIEW MAY 2001 Reliability-Linux has an enviahle reputation for robustness. Up-time is measured in weeks or years and systems rarely, if ever, require rebooting. Scalability-With the advent of Linux 2.4, the kernel has become significantly more modular and scalable. This is a distinct advantage when using Linux in resource- constraiped environments. Large programmer base-Linnx is developed by a large number of pcople primarily communicating through the Internet. The current maturity of Linux, and the extended feature set, is a reflection of the multitude of individual programmers who enjoy working m the Linux environment (often in their spare time.). Support-Getting up to speed with a new operating system can be problematic. In the case of Linux, extensive documentation is available from the Internet, and companies such as Red Hat provide support, traiiiiiig seminars and courses. Literature and training can be very effective, but a particularly effective way of progressing with Linux development is to subscribe to one of the Internet-based, Linux-oriented mailing lists. Questions can be asked as problems arise and, given the question has not been answered too many times before, somebody is bound to come to your assistance. systems for which a iiiininiuin set of Standards-The distributed nature of the Linux components must be carcfully defined. development process has encouraged a high proportion of the components of the Liiiux The initial program loader (IPL) environment to be written to open Before the Linux kernel can start running it specifications and standards. obviously needs to he loaded into memory. When running froin staridard devices, e.g. a Portability-It is relatively straightforward to hard disc drive, standard IPLs, such ab LILO and develop/debug an application on a hmt GRUB, are readily available. However, when system running Linux and then transfer to the running from ROM or from flash EPROM-the target, helping to ensure a shortened likely set up in an embedded context-a debugging cycle. hardware-specific loader will bc required. All these features combine to produce an The kernel embedded operating system that is attractive This Is the heart of the Linux operating system. froin a licensing perspective, while supporting Linux has a ‘monolithic’ kernel, meaning rapid application development with a reduced that the whole operating system-process time to market. management, memory management, file system and drivers-is contained within one binary How is embedded Linux implemented? image. Given the open-source, modular, nature Standard Linux distributions tend to install a of Linux a user can recompile the kernel to great deal of software to a target system on the obtain the functionality set required. A compiled basis that the user may find it useful. This kernel is generally stored in a compressed form, approach does not serve well for cinbedded and is then uriconipressed when it has been IEE REVIEW MAY 2001 35 s of devices, libraries, utilities, configuration files and scripts to get the system up and running. The majority of the file system footprint is taken up by system utilities and their associated shared library files.