Content: Embedded Systems Linux used as the advantages of your embedded system / disadvantage software and hardware requirements Real-time embedded Linux application configuration process summary Reference References About the author Review this article
Advanced Software Engineer / Consultant from Watches Based on Cluster - Based Cluster (DTADD95@bellatlantic.net), ASC Technologies Inc. 2001 August
After the application and its environment of embedded Linux and its environment, Darrick Addison teaches you step by step to build the soft and hardware environment of developing these applications. Now Linux is widely used in various types of computing applications, including not only IBM miniature Linux watches, handheld equipment (PDAs and cellular phones), Internet devices, thin clients, firewalls, industrial robots and telephone infrastructure equipment, and even Cluster's supercomputer. Let's take a look at Linux as an embedded system which functions need to provide, and its most attractive reason in the current options available.
The appearance of the embedded system is used to control the computer, namely the embedded system, which is almost as long as the computer itself. They were originally used to control electromechanical telephone exchanges in the late 1960s. Since the computer industry has continued to develop in a smaller system direction, the embedded system also provides more features to these small machines. Gradually, these embedded systems need to be connected to some kind of network, and thus produce the requirements for the network stack, which improves the system's complexity and requires more memory and interface, and you guessed The service of the operating system.
An existing operating system for embedded systems has occurred in the late 1970s, and there are now many feasible options. Among them, some major competitors began to emerge, such as VxWorks, PSOS, NECULEUS, and Windows CE.
The advantages and disadvantages of using Linux in the embedded system are running on the PC platform, but Linux can also serve as the reliable main force of the embedded system. Linux popular "Back-to-Basics" approach makes it easy to install and manage more simple than UNIX, which is the advantage of those UNIX experts, they have many commands and programming interfaces in Linux. The Unix appreciates it.
Typical compressed packaging Linux systems are packaged, running on PCs with hard drives and large-capacity memory, and embedded systems do not have such a high configuration. A functionally complete Linux kernel requires approximately 1 MB of memory. The Linux microcarbon only occupies a small part of the memory, including virtual memory and all core operating system functions, only takes up 100 k memory of the Pentium CPU system. As long as there is 500 k memory, a complete Linux system with a network stack and the basic utility can run on an 8-bit bus (SX) Intel 386 microprocessor. Because memory requirements are often determined by the applications, such as a web server or SNMP agent, the Linux system can only work with 256 KB ROM and 512 KB RAM. So it is a lightweight operating system aiming at the embedded market.
Compared with the traditional real-time operating system (RTOS), another benefit of an open source of an open source such as embedded Linux is that Linux development groups seem to support new IP protocols faster than RTOS vendors and others. protocol. For example, a device driver for Linux is more than a device driver for a commercial operating system, such as a network interface card (NIC) driver, and parallel port and serial driver.
Flash Flash RAM Memory is most PALM devices to store dedicated memories for the operating system. It has the advantage of allowing the operating system upgrade, and can also be used in digital cellular phones, digital cameras, LAN switches, PC cards, digital set-top boxes, embedded controllers, and other small devices. Embedded systems, such as embedded Linux, no disk drives, although other memory organizations may be used. So if, for an alphabode, Linux uses the flash memory, which can use some of the read-only file system to store additional programs and static data. The core Linux operating system itself is quite simple. The network and file systems are placed in the form of the micronelf in the form of a module. The driver and other components can be compiled as the loaded module as the loaded module at runtime. This provides a highly modular component method for constructing a cooked embedded system. In a typical case, the system needs to be combined with custom drivers and applications to provide additional features. Embedded systems also often require universal functions, in order to avoid duplication of labor, the implementation of these functions uses many ready-made programs and drivers that can be used for public peripherals and applications. Linux can run on most microprocessors in a wide range of peripherals, and have already had a ready-made application library.
Linux is also very suitable for embedded Internet devices because it supports multiprocessor systems that make Linux has a scalability. Therefore, designers can choose to run real-time applications on the dual processor system to improve overall processing power. For example, you can run the GUI in a processor while running the Linux system on another processor.
One disadvantage of running Linux on the embedded system is that the Linux system provides real-time software modules to provide real-time performance. The kernel space running in these modules is the operating system implementation scheduling policy, hardware interrupt exception and execution program. Since these real-time software modules are running in kernel space, code errors may undermine the operating system to affect the reliability of the entire system, which will be a very serious weakness for real-time applications.
On the other hand, the ready-made RTOS is designed to real-time performance, which is reliability by assigning a process higher than other processes when starting from the user rather than the system level process. Reliability. The process is in the operating system that is the program executed on the memory or hard drive. Give them a process ID or a numeric identifier to let the operating system track the programs that are being executed and the associated priority of these programs. This way ensures that the RTOS time can provide higher reliability (predictable) than Linux. But most important, this is also a more economical choice.
Different types of embedded Linux systems have an example of many embedded Linux systems; it can be grasped, some form of Linux can run on a computer that almost any execution code. For example, ELKS (Embed Linux kernel subset) program plans to use Linux on Palm Pilot. Some more widely known small embedded Linux versions:
ETLINUX - a complete distribution of Linux that is used in small industrial computers, especially PC / 104 modules.
LEM - runs in small (<8 MB) multi-user, network Linux version on 386.
LOAF - "Linux On A Floppy" distribution, running on 386.
Uclinux - Linux running on the system without MMU. Currently supports Motorola 68k, MCF5206, and MCF5207 ColdFire microprocessors.
Ulinux - Tiny Linux distribution version running on 386.
ThinLinux - a minimized Linux distribution version of a dedicated camera server, X-10 controller, MP3 player, and other similar embedded applications.
Software and hardware require many user interface tools and programs to enhance the multi-functionality of the Linux basic kernel. In this regard, it can regard Linux as such a continuous range, from the minimized microelectronics that minimize the memory management, task conversion, and timer service, has been perfect to a complete series of file systems and network services. The smallest embedded Linux system only needs three basic elements:
Boot utility Linux microenvironment, consisting of memory management, process management, and timed services to initialize the minimum work capability, you also need to add:
The hardware driver is one or more application processes to provide the desired function as the required increase, you may also need:
A file system (probably in the ROM or RAM) TCP / IP network stack storage semi-transient data and disk 32-bit built-in CPU (all full Linux systems required) is some now Some embedded hardware schemes customized for Linux operating systems.
PLEB: Pocket Linux embedded machine with ARM SA-1100 / ARMLINUX UCSIMM / UCLINUX FLASH EPROM.
Linux Lab: Linux LAB schemes are designed to help people develop Linux data acquisition and process control software. It plans to provide a standardized development environment from hardware support to application development.
Controller Domain Network: Linux GPIB Controller Domain Network (CAN) Bus Driver; Linux GPIB package is a support package for ordinary GPIB (IEEE 488.1) hardware. The driver supports National Instruments AT-GPIB, TNT488.2, and PCII and PCIIA boards. This package has a complete development environment, including testing and configuration tools, libraries, and support for TCL and Python language. The process of selecting the best hardware is quite complicated. The problem originated from the company's internal policy, seeing the legacy issues of other programs, lacking comprehensive or accurate information and cost - considering the total product cost, not just CPU itself. Sometimes, once the bus logic and delay time necessary for the CPU uses other peripherals, the fast and inexpensive CPU may become expensive. To calculate the CPU speed required for any given item, first, let's see how fast the CPU is running in order to complete a given task CPU and then multiply. Also determine how fast the bus needs to run. If there is a secondary bus, such as the PCI bus, then it is also considered. A slow bus (i.e., a bus that is blocked by the DMA communication) will significantly reduce the speed of the high speed CPU. Below is the best hardware solution for some embedded Linux applications.
Bright Star Engineering: Bright Star Engineering's IPENGINE-1 is a single-chip microcomputer that supports embedded Linux credit card size. It utilizes PowerPC-based CPUs and provides a set of peripherals on a panel, with Ethernet, LCD / video controller, USB, serial port I / O, and a 16K gate can be configured by a user. BSE's embedded Linux configuration allows Linux to boot from 4MB flash drives on the iPENGINE board.
Calibri: CalibritM-133 is a network device that uses embedded Linux as its operating system, which is convenient to use, compact, and can be used in a variety of purposes. It provides an efficient, low-cost solution for firewall, VPN and routing requirements.
EmbeddedPlanet: EmbeddedPlanet created a computer that was launched after the PC age, which was installed with Montavista's Hardhat Linux. The Linux Planet is installed in a colored transparent box and has a touch screen, and the Linux Planet is mounted in a colored transparent box and has access to numbers and simulation I / O. Eurotech: Eurotech provides embedded PC SBC and funds ET-Linux, a fully designed glibc 2.1.2-based Linux system specifically designed on a small industrial computer.
Microprocess Ingenier: Microprocess development, production and sales standards and customized products for industrial and embedded markets. Microprocess is within real-time software activities in terms of global, and has systematic knowledge of expertise. Its product, such as a 740 PowerPC CompactPCI board, can be ordered with a standard Linux distribution or embedded Linux version.
Moreton Bay: Moreton Bay released Linux-based Internet routers, which ranges between Nettel 2520 and Nettel 2500. These small, easy-to-linked intelligent router solutions are designed to provide simple, safe and priced external network-friendly virtual private networks (VPNs) for planar networks. The Nettel router series is running an embedded Linux kernel. A set of development tools can exist in the custom code in flash memory and execute inside Nettel. The code may contain a specific encryption or authentication protocol, or when Nettel is used as a remote control device code, some local monitoring scripts are included.
Matrix Orbital: This is an optional, but not recommended additional items. A series of serial LCDs and VFDs produced by Matrix Orbital are added to their embedded systems by many Linux users. The range of this production line includes 8x2 to 40x4 characters LCDS, 20x2 and 20x4 VFD plus 240x64 graphics LC (128x128 is still in production). Communication to use the display is not through the RS232 is implemented by I2C, both of which are criteria on all of its modules. The module's BIOS contains a comprehensive command set.
Real-time embedded Linux application is one of the most important transactions of embedded systems to require a real-time operating system. There are several definitions here in real time. For some people, it means that the event will be reacted in 1 microsecond time, but it may be 50 milliseconds for another person. Real-time hardness is different. Some systems need to be hard-lived, and the events make certain responses in a short period of time. However, when we carefully analyze many systems, we found that in fact, the requirements for response time are just close to real-time. Real-time requirements are often the trade-off of time and buffering space. As memory is getting cheaper, the CPU speed is getting faster and faster, and now it is more common than real-time than hard real-time, many commercial so-called real-time operating systems are far non-hard. Typically, when you enter the detailed design portions of these systems, you need to be vigilant to design the driver's interruption and application to meet real-time requirements.
RT-Linux (real-time extended Linux system) contains time-to-time functions to accurately control interrupt processing with interrupt managers, which is well ensured that critical interrupts can be implemented when needed. The hardness of this method is mainly dependent on the hardware support of the CPU interrupt structure and environmental conversion. This approach can meet real-time requirements within a wide range of ranges. Even if there is no real-time extension, Linux can also handle multiple event streams well. For example, the Linux PC system running on the low-end Pentium allows multiple 10BASET interfaces to be effectively executed, while running the character stage serial port with a full-speed 56kbps without losing any data. Recommented real-time hardware and software Linux API has RTLinux, RTAI, EL, and Linux-SRT. RTLinux is a hard-real-time Linux API initially developed in the New Mexican Institute of Technology. RTAI (DIAPM) is a by-product of RTLinux real-time API developed by the Polytechnic Politecnico Di Milano (DIAPM) Space Engineering Department. EL / IX is a planned POSIX hard-based Linux API, which is initiated by Red Hat. Linux-SRT is a real-time API's soft-time replacement, which enables all Linux programs to enhance performance without modifying or recompiling.
Please refer to the reference part of this article to find information about the previous content and some web sites, which provide software extensions, development tools, support, and training courses for different types of standard Linux operating systems.
Short-term deterministic response time Some real-time embedded systems require quick response to external events to complete a specific task. For example, a custom microcontroller embedded in a missile requires rapid response to external events such as movement goals, weather, and humans before guiding the missile aiming at a particular target of its surrounding environments. A short confirmatory response time means that the embedded system can determine how to respond to external events.
Configuration steps Now let's take a look at how Make Lem, which is a small-to-embedding Linux distribution version, providing both networks and X servers. You can download the distribution version, although it is not required. You need a full Linux distribution version to create your own embedded Linux operating system, which will include everything you need (utility, source code, compiler, debugger, and document). Below is a list of software that can be used as a Make LEM:
Tinylogin: TinyLogin is a Tiny UNIX utility that is used to log in to the embedded system, accept its verification identity, modify the password for it, and maintain its users and user groups. In order to enhance system security it also supports the shadow password. As its name is implicit, Tinylogin is very small, and BusyBox on the embedded system is excellent.
BusyBox: BusyBox is a multi-call binary that provides the minimum subset of POSIX commands and dedicated functions. It is suitable for very small embedded systems such as guiding disks, and the like. Especially for the Debian rescue / installation system (which inspired the initial development of BusyBox), Linux Routeur Solution, LEM, LINEO, and elsewhere. Busybox is maintained by Erik Andersen.
ASH: ASH is a very small Bourne Shell.
Sysvinit: sysvinit is the most commonly used init package for Linux. We will use init and c language START-STOP-Daemon.
See the reference part for more information.
Creating a boot disk boot disk is essentially a floppy disk with miniature, self-contained Linux system. It can perform many and complete Linux systems. The following materials are based on BootDisk-HOWTO (see Resources). Step 1: All PC systems of the BIOS are loaded by performing a zone 0 cylinder 0 sector from the boot disk from the code in the ROM (Clear, BIOS), thereby starting the boot process. The boot driver is usually the first floppy disk drive (specified under DOS as A:, and the Linux is specified as / dev / fd0). The BIOS is then tried to perform this sector. Most of the 0 cylindrical 0 sectors of the guided disk include one of the following two contents:
From the loader, such as the code, the loader is positioned, loaded and running the kernel to start the normal boot of an operating system, such as the core of Linux, starting part
If the Linux kernel is directly bare to disk, hard drive, or other media, the first sector of the disk will be the first sector of the Linux core itself. The first sector continues the boot process from the remainder of the kernel from the boot device.
Step 2: Boot Loader You can perform boot process with a load program like Lilo. It allows development and production platforms to coexist on the same hardware and allow switches from one platform to another by rebooting. The LILO boot loader is loaded by the BIOS. Then it loads the kernel or other operating system's guiding sector. It also provides a simple command line interface to select items to be booted based on its options. See Resources for more information about LILO.
Step 3: The kernel checks the hardware and load the root device, then find the init program of the root file system and executes the program.
Step 4: InitInit is the parent process that will run on your Linux operating system. It will observe its child process and start, stop, restart them when needed. INIT gets all information from / etc / inittab.
Step 5: The inittab / etc / inittab file is installed by reference to a script installation system named / etc / rc .... It also has an entry for the Getty tool to handle the login process.
Step 6: The login process has a getty in the initTab file for each console that allows users. Getty will start / bin / login to verify the user password.
Step 7: Creating a new partition from LFS-HOWTO (see Resources): Before installing a new Linux system, we need an empty Linux partition to install a new system. If you already have a Linux Native partition, you can skip this step and step by step. Select the appropriate hard drive (such as / dev / hda if you want to create a new partition on the basic primary IDE disk) Start the FDISK program (or cfdisk, if you prefer CFDisk). Create a Linux Native partition, write partition tables and exit (c) FDISK programs. If you are notified to reboot the system to make sure the partition table is updated, then reboot the system before proceeding the following steps.
Step 8: Creating an EXT2 file system on a new partition is taken from LFS-HOWTO (see Resources): We created a new EXT2 file system with the mke2fs command. Such a file system is built with the only option for $ LFS. From now on, I will call this new partition as $ EMBPART. $ EMBPART should be replaced into the partition you created.
Step 9: Load partition In order to access this new file system, you must install it. To install the partition, you have to create a / mnt / hda? Directory and enter the following content at the Shell prompt: MKDIR / MNT / HDA? MOUNT $ EMBPART / MNT / HDA?
If you establish a partition in / dev / hda4 and install it on / mnt / hda4, then you need to return to the step of copying the file to the directory $ embwart / usr / sbin, and copy the file to the directory / MNT / HDA4 / USR / BIN. After completing the last command of step 14, execute this step (copy the file in the EmbPart / USR / SBIN directory).
Step 10: Fill file system root file system must include full content required to support a complete Linux system. We will establish a directory structure that is not far from the file level (see Reference).
Step 11: Directory The newly installed file system's mkdir command has established the following directory:
/ Procproc file system Requirements Directory Store / ETC System Profile / Sbin Key System Binary File / BIN is considered to be a basic binary / lib / lib provides real-time support for shared library / MNT maintenance mount point / usr Additional utility and application software
CD / MNT / HDA / MKDIR BIN DEV Home Proc Sbin USR Boot ETC LIV MNT Root Tmp Var MKDIR -P USR / BIN USR / SBIN USR / Share USR / LIB MKDIR -P ETC / Config etc / default etc / init.d ETC /rc.boot mkdir -P etc / rc0.d etc / rc1.d etc / rc2.d etc / rc3.d etc / rc4.d etc / rc5.d etc / rc6.d etc / rcs.d
The / devdev directory is a stub that performs device input / output requirements. Each file in this directory can be created with the mknod command. You can use the following instructions to copy the requirements of the requirements from your desktop Linux to save time: CP -DPR / DEV / MNT
Install TinyLogin and log in to slave (see the Reference section) will install the following tools for you to install less than 35KB: / bin / addgroup, / bin / adduser, / bin / delGroup, / bin / deluser, / bin / login , / Bin / su, / sbin / getty, / sbin / sulogin and / usr / bin / passwd.
See the primary release document or man page to get a detailed description of these commands.
Step 12: Configuring TinyLogin from Tinylogin Readme: TinyLogin, you can help you only configure the required components to reduce the binary length. To close an unwanted TinyLogin component, simply edit the TinyLogin.def.h file and use the C style (//) annotation to comment the part you don't want.
Step 13: Install TinyLogin After the compilation is complete, generate a tinylogin.links file, which is then used by Make Install to create a symbolic connection to the Tinylogin binary files by Make INSTALL. By default, Make Install will put a symbolic connection forest in PWD / _Install unless you have defined the prefix environment variable.
Step 14: Installing Sysvinit and Start-Stop Daemon After the kernel loading is complete, it runs the init program to end the boot process. right now:
Unzip the SysVinit archive into the SRC directory Copy the INIT executable in the Embpart / sbin directory. The sysvinit package also has a C language version of Start-Stop-daem in the Contrib directory. Compile Copy $ EMBPART / USR / SBIN Next: Configuring SysvinitsysVinit Requires a configuration file called initTab, it should be in the $ EmbPart / etc directory. Below is the configuration file used in the LEM distribution version:
Listing 1. InitTab configuration script
# / etc / inittab: init (8) Configuration. # $ ID: INITTAB, V 1.6 1997/01/30 15:03:55 Miquels EXP $ # modified for lem 2/99 by sebastien huet # default rl.id: 2 : INITDEFAULT: # first Except in Emergency (-b) mode.si :::sinit:/etc/init.d/rcs# single-user mode. ~~: s: Wait: / sbin / sulogin # / etc / init. D Executes The S and K Scripts Upon Change # 0: Halt 1: Single-User 2-5: Multi-User (5 May Be x with xdm or other) 6: reboot.l0: 0: Wait: / etc / init. D / RC 0L1: 1: Wait: /etc/init.d/rc 1L2: 2: Wait: /etc/init.d/rc 2l3: 3: Wait: /etc/init.d/rc 3l4: 4: Wait : /etc/init.d/rc 4L5: 5: Wait: /etc/init.d/rc 5L6: 6: Wait: /etc/init.d/rc 6 # ctrl-alt-del pressed.ca: 12345: Ctrlatdel: / sbin / shutdown -t1 -r now # action on special keypress (alt-upARROW) .KB :: kbrequest: / bin / echo "Keyboard Request - Edit / etc / inittab to let this work." # / sbin / MINGETTY INVOCATIONS for Runlevels.1: 2345: Respawn: / sbin / getty 9600 TTY12: 23: Respawn: / sbin / getty 9600 TTY2 # 3: 23: Respawn: / sbin / getty tty3 # 4: 23: Respawn: / sbin / getty TTY4
Step 16: Creating the initial boot script is like seeing in the initTab file, Sysvinit needs some additional scripts in its own directory.
Step 17: Create the required directory and basic files to create a directory with the following command:
Listing 2. Creating a script for directory and basic files
CD $ EMBPART / etcmkdir rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d init.d rcs.d rc.boot
Enter the Sysvinit source directory to decompress Debian / etc / init.d / rc to: $ Embart / etc / init.d to enter $ EMBPART / ETC / INIT.D / directory Create a new file similar to the LEM File RCS:
Listing 3. RCS script
#! / bin / Shpath = / / sbin: / bin: / usr / sbin: / usr / binrunlevel = sprevlevel = Numask 022export path runlevel prevlease / etc / default / rcsexport verbose # trap ctrl-c only in this shell sowe can interrupt Subprocesses.trap ":" 2 3 20 # call all parts in order.for i in /etc/rcs.d/s??*do [! -f "$ i"] && continue case "$ i" in *. SH) (Trap - 2 3 20. $ I start) ;; *) $ I start ;; esacdone # run the files in /etc/rc.boot [-d /etc/rc.boot] && run-parts / etc /rc.boot copies executables from your distribution to $ EmbPart / bin.
Step 18: Adding the basic script This list is a UNIX / Linux command that is set to embedded in the path within the UNIX shell script, export.
Listing 4. Notes
Create a new file Reboot, which contains the following:
Listing 5. Reboot script
#! / bin / shpath = / sbin: / bin: / usr / sbin: / usr / binecho -n "rebooting ..." reboot -d -f-i
Create a new file HALT, which contains the following:
Listing 6. HALT script
#! / bin / shpath = / sbin: / bin: / usr / sbin: / usr / binhalt -d -f -i -p
Summarizing in the field of embedded applications, from the Internet device to a dedicated control system, the prospect of the Linux operating system is very bright. About 95% of all new microcomputer chips are used for embedded applications. Due to powerful, reliable, flexible and scalable, plus it supports a large number of microprocessor architectures, hardware devices, graphics support, and communication protocols, which make it become more and more software platforms for many programs and products. popular.