Wide application embedded in Linux

xiaoxiao2021-03-06  60

Now Linux is widely used in all kinds of calculation applications, including not only micro Linux watches, handheld equipment (PDAs and cellular phones), Internet devices, thin clients, firewalls, industrial robots and telephone infrastructure equipment, and even cluster-based 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.

Embedded system

The computer used to control the device is also called an embedded system, and its history 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.

Using Linux in an embedded system, the advantages and disadvantages of Linux

Although most Linux systems operate on the PC platform, Linux can also be used as 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 memory

Flash RAM Memory is most Palm devices to store dedicated memory 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

There are many examples of embedded Linux systems; it can be grasped, some form of Linux can run on almost any computer that executes 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 requirements

Many user interface tools and programs enhance the versatility 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:

Guide utility

Linux microennote, consisting of memory management, process management, and timed service

Initialization process

To achieve the minimum work ability, you also need to add:

Hardware driver

One or more application processes to provide the desired function

As required, you may also need:

A file system (may be in the ROM or RAM) TCP / IP Network Stack

Semi-transient data and disks that provide swap space

32-bit built-in CPU (all complete Linux systems need)

Related hardware solutions

Below is 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.

Hardware platform options

The process of choosing the best hardware is quite complicated, the problem originates from the company's internal policy, seeing the legacy issues of other programs, lacking comprehensive or precise information and cost - considering the total product cost, not just the 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

One of the most important transactions of embedded systems is 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 identification response time

Some real-time embedded systems require a 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, it is a small embedded 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.

Create boot disk

The 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: BIOS

All PC systems are loaded from the 0 cylinder 0 sector from the boot disk from the code in the ROM (Clear, BIOS) to start 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 a 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: Kernel

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: Init

INIT is a parent process that will be running 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: InitTab

The / etc / inittab file is installed by a script installation system named / etc / rc .... It also has an entry for the Getty tool to handle the login process.

Step 6: Login Procedure

There is a getty in the inittab file for each console that allows users to use. Getty will start / bin / login to verify the user password.

Step 7: Create 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: Create an EXT2 file system on a new partition

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

The root file system must include all the 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: Catalog

The mkdir command of the newly installed file system establishes the following directory:

/ proc

Proc File System Requirements Directory Store

/ ETC

System configuration file

/ sbin

Key system binary file

/ bin

Basic binaries that are considered part of the system components

/ lib

Provide real-time support sharing libraries

/ MNT

Maintenance mounting 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

/ dev

The DEV directory is the stub that executes the device input / output requirements. Each file in this directory can be created with the mknod command. You can use the following instructions from your desktop Linux directly to copy the requirements of the DEV entry to save time:

CP -DPR / DEV / MNT

Install TinyLogin and login

TinyLogin (see the Reference section) will install the following tools for you to install less than 35KB:

/ bin / adduntgroup, / 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: Configure 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 completed, a TinyLogin.Links file is generated, which is then used by Make Install to create a symbolic connection to the Tinylogin binarily for all internal compilation functions. By default, Make Install will put a symbolic connection forest in PWD / _Install unless you have defined the prefix environment variable.

Step 14: Install Sysvinit and Start-Stop Daemon

Once the kernel load is complete, it runs the init program to end the boot process. right now:

Unzip the Sysvinit archive file

Enter 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 the file under EmbPart / USR / SBIN

Step 15: Configuring Sysvinit

Sysvinit 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

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 :: sysinit: /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 0

L1: 1: Wait: /etc/init.d/rc 1

L2: 2: Wait: /etc/init.d/rc 2

L3: 3: Wait: /etc/init.d/rc 3

L4: 4: Wait: /etc/init.d/rc 4

L5: 5: Wait: /etc/init.d/rc 5

L6: 6: Wait: /etc/init.d/rc 6

# Ctrl-alt-del pressies.

CA: 12345: CTRLALTDEL: / 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 runlevs.

1: 2345: Respawn: / sbin / getty 9600 TTY1

2: 23: Respawn: / sbin / getty 9600 TTY2

# 3: 23: Respawn: / sbin / getty tty3 #you may add console there

# 4: 23: Respawn: / sbin / getty tty4

Step 16: Create an initial boot script

Like I saw in the inittab file, sysvinit needs some additional scripts in its own directory.

Step 17: Create the required directory and basic files

Create a directory with the following command:

Listing 2. Creating a script for directory and basic files

CD $ EMBPART / ETC

Mkdir 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 after decompression

Copy Debian / etc / init.d / rc to: $ Embart / etc / init.d

Enter $ EMBPART / ETC / INIT.D / directory

Create a new file RCS similar to the file in the LEM:

Listing 3. RCS script

#! / bin / sh

PATH = / sbin: / bin: / usr / sbin: / usr / bin

Runlevel = s

Prevleasevel = N

Umask 022

Export Path Runlevel PrevlevLevel

/ etc / default / rcs

Export Verbose

# Trap Ctrl-C Only in this Shell So We 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

;

ESAC

DONE

# run the files in /etc/rc.boot

[-d /etc/rc.boot] && run-parts /etc/rc.boot

Copy the executable from your distribution to $ embpart / bin.

Step 18: Add basic script

Many of the commands used here are the UNIX / Linux command, which is set to embedded in the path inside the UNIX shell script, exported.

Listing 4. Notes

Create a new file Reboot, which contains the following:

Listing 5. Reboot script

#! / bin / sh

PATH = / sbin: / bin: / usr / sbin: / usr / bin

echo -n "rebooting ..."

Reboot -d -f -i

Create a new file HALT, which contains the following:

Listing 6. HALT script

#! / bin / sh

PATH = / sbin: / bin: / usr / sbin: / usr / bin

Halt -d -f -i -p

to sum up

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.

Since many modifications and configurations for Linux and its supported software components can be continuously improved due to the public code for free, and many of the modifications and configurations of software components thereof are also met to meet a variety of demand for market and applications using Linux. There is also a small version and real-time enhancement versions. Although Linux starts to be an operating system as a PC architecture, now there is already a version of non-x86 CPU (with or without memory control unit), including PowerPC, ARM, MIPS, 68K, or even microcontrollers. However, please note that in the near future, there will be more in many other information technology (IT) fields!

转载请注明原文地址:https://www.9cbs.com/read-112724.html

New Post(0)