Linux system development on embedded devices - Patch PDA for fun and profit

xiaoxiao2021-03-06  97

LINUX system development on embedded devices

English original

content:

Guide Loader Settings Toolchain Device Driver Embedded Device File System User Graphical Interface (GUI) Option Conclusion Reference About the author to this article

related information:

Embedded Linux Application: Overview

In the Linux area:

Tutorial Tools & Product Codes & Component Articles

Patching PDA for fun and profit

Anand K Santhanam (Asanthan@in.ibm.com), software engineer, IBM Global Servicesvishal Kulkarni (Kvishal@in.ibm.com), software engineer, IBM Global Services 2002 March

If you just get in contact with embedded development, then a large number of bootloader (bootloader), scale-reduced distribution (Distribution), file system and GUI look too much. But these rich options are actually a gift, allowing you to adjust the development or user environment to fully comply with your needs. Overview of Linux embedded development will help you understand all of these options.

Linux is steadily developing in the field of embedded development. Because Linux uses GPL (see Refer to References later), anyone who is customizing Linux in PDA, handheld or wearing equipment, can download its kernel and application free of the Internet free of charge, and start transplantation or development . Many Linux modified varieties cater to embedded / real-time markets. They include RTLinux (real-time Linux), Uclinux (Linux for non-MMU), Montavista Linux (Linux Distribution Edition, ARM, MIPS, PPC), ARM-Linux (Linux on ARM), and other Linux systems (please Refer to the reference to link these and other terms and products mentioned herein.)

Embedded Linux development is generally involved in three levels: boot loaders, Linux kernels, and graphical user interfaces (or GUI). In this article, we will focus on some basic concepts involving these three layers; how to understand how to guide loaders, kernel and file systems interact; and will be used in the numerous options for file systems, GUI, and boot loaders. Part.

The boot loader boot loader is usually the first code executed on any hardware. In a conventional system like a desktop, the boot loader is typically loaded into the main boot record (Master Boot Record, (MBR)) or in the first sector of the disk where Linux resides. Typically, on a desktop or other system, the BIOS will control the control to the boot loader. This puts forward an interesting question: Who will boot the loader (in most cases) Does there is no BIOS embedded device?

Solving this issue has two conventional technologies: special software and tiny boot code (tiny bootcode).

Dedicated software can interact directly with flash devices on remote systems and install the bootloader in a given location of the flash. Flash devices are special chips similar to storage devices, and they can store information - ie, do not erase their content when rebooting.

This software uses the JTAG port on the target (in embedded development, the embedded device is typically referred to as the target), which is an interface for executing an external input (usually from the host machine) instruction. Jflash-Linux is a popular tool for direct writing flash. It supports numerous flash chips; it is executed on the host machine (usually I386 machine - this article we call an I386 machine as a host) and uses a parallel port to access the target's flash chip through the JTAG interface. Of course, this means that the goal needs to have a parallel interface to communicate with the host. JFlash-Linux can be used in Linux and Windows versions, you can start using the following command in the command line: JFlash-Linux Some types of embedded devices have tiny boot code - according to the instructions of several bytes - It will initialize some DRAM settings and enable a serial (or USB, or Ethernet) port on the target to communicate with the host program. The host program or loader can then use this connection to transfer the bootloader to the target and write it into flash.

After installing it and gives its control, this bootloader performs the following features:

Initializing the CPU speed initialization memory, including enabling memory libraries, initializing the internal memory configuration register, etc. Initializing serial port (if you have anything on the target) Enable instruction / data cache setting stack pointer to set the parameter area and construct parameter structure and tag (this is Important step, because the kernel uses boot parameters to identify the root device, page size, memory size, and more, perform POST (power-up self-test) to identify existing equipment and report any problem to provide the power management Restore support to jump to the beginning of the kernel

Typical memory layout with boot loaders, parameter structures, kernel, and file systems may be shown below:

Listing 1. Typical memory layout

/ * TOP of memory * /

Bootloader

Parameter Area

Kernel

FileSystem

/ * End of memory * /

Some popular and free Linux boot loaders on embedded devices have BLOB, RedBoot and BootLDR (see Referring to Link). All of these boot loaders are used in the ARM device-based Linux and require a JFLASH-Linux tool for installation.

Once the boot loader is installed into the target's flash, it will perform all the initialization works mentioned above. It is then prepared to receive the kernel and file system from the host. Once the kernel is loaded, the bootloader will turn the control to the kernel.

Settings Toolchain Settings Toolchain Create a build environment for compiling kernels and applications running on the target - because the target hardware may not have a binary execution with the host.

The tool chain consists of a set of components used to compile, assemble, and link kernels and applications. These components include:

Binutils - Utility Collection for operating binary files. They include utilities such as Ar, AS, ObjDump, Objcopy. GCC - GNU C compiler. GLIBC - All user applications will link to the C library. Avoid using any core and other applications that use any C library function to compile without the library.

Building a tool chain established a cross-compiler environment. The local compiler compresses the instructions of the processor that are similar to this machine. The cross-compiler runs on a processor, but can compile the instructions of another processor. The weight setting Cross-compiler tool chain is not a simple task: it includes downloading source code, patch patch, configuration, compiling, setting header file, installation, and a lot of operations. In addition, such a thorough build process is huge for memory and hard drive. If there is not enough memory and hard disk space, there is a lot of problems in the construction phase due to correlation, configuration or header file settings. Therefore, it is a good thing to obtain a precompiled binary file from the Internet (but not very good, currently, most of them are limited to ARM-based systems, but sooner or later). Some popular pre-compiled tool chains include tool chains from Compaq (Familiar Linux), LART (LART Linux), and Embedian (Debian but related to it) - all of these toolchains are used in ARM-based platforms.

The kernel setting Linux community is actively adding functional components and support for new hardware, correcting errors in the kernel and regular improvements in time. This leads to approximately every 6 months (or 6 months) has a new release of a stable linux tree. Different maintaists maintain different kernel trees and patches for a particular architecture. When you select a kernel for a project, you need to evaluate the stability of the latest release, it meets the project requirements and hardware platforms, from the programming angle to see its comfort and other difficult aspects. It is also very important: Find all patches that need to be applied to the basic kernel to adjust the kernel for a specific architecture.

The kernel layout kernel layout is divided into a partially specific part of the architecture and a part that is independent of the architecture. The system-specific partial part is performed first, set the hardware register, configure the memory mapping, perform an initialization specific to the architecture, and then control the control to the kernel and the architecture independent. The rest of the system is initialized during this second phase. Directory ARCH / by different subdigalogs under the kernel tree, each subdirectory for a different architecture (MIPS, ARM, I386, SPARC, PPC, etc.). Each such subdirectory contains the Kernel / and MM / subdirectory, which contains the architectual code to complete the initialization of memory, set IRQ, enabling caches, setting kernel page tables. Once the kernel is loaded, these functions are first called, and then the rest of the system is initialized.

The kernel can be compiled into VMLinux, Image or Zimage based on the functionality of the available system resources and boot loaders. The main difference between VMLinux and Zimage is that VMLinux is an actual (uncompressed) executable file, and zimage is more or less self-bucket compressed files that contain the same information - just compress it to process (usually intelrative) 640 kB boot time limit. For all of these authoritative explanations, see Linux Magazine's article "KERNEL Configuration: DEALING WITH THE UNEXPECTED" (see Resources).

The kernel is loaded into the target system by using the boot loader (which has been loaded into the target's flash ", the kernel is used to compile the kernel (which has been loaded into the target's flash). ). By using a serial, USB or Ethernet port, the loader communicates with the host to transfer the kernel to the target's flash or DRAM. After the kernel is fully loaded into the target, the bootloader passes the control to the address that is loaded into the kernel.

The kernel executable is composed of many links to the object files. Object files have many questions, such as text, data, init data, bass, and so on. These object files are linked by a file called the linker script and loaded. The function of this linker script is to map each section of the input object file to the output file; in other words, it will link all input object files to a single executable, put the executable of each section of the executable To the specified address. VMLinux.lds is a kernel linker script existing in the Arch / / directory, which is responsible for linking the individual sections of the kernel and puts them into the specific offset in the memory. Typical vmlinux.lds look like this: Listing 2. Typical vmlinux.lds file

Output_arch () / * Includes Architecture Type * /

Entry (stext) / * stext is the kernel entry point * /

Sections / * Sections Command Describes The Layout

of the output file * /

{

. = Textaddr; / * textaddr is lma for the kernel * /

.init: {/ * init code and data * /

_SText =.; / * First section is Stext Followed

BY __INIT DATA Section * /

__INIT_BEGIN =.

* (. text.init)

__INIT_END =.

}

.Text: {/ * real text segment backs __init_data section * /

_text =.;

* (. Text)

_ETEXT =.; / * end of text section * /

}

.data: {

_DATA = .; / * Data section comes after text section * /

* (. DATA)

_eData = .;

} / * Data section ends here * /

.bss: {/ * BSS Section Follows Symbol Table Section * /

__BSS_START =.

* (. BSS)

_end =.; / * bss section ends here * /

}

}

LMA is a load module address; it represents the address in the target virtual memory that will be loaded into the kernel. TextAddr is a virtual start address of the kernel and specifies its value in the Makefile under Arch / /. This address must match the address used by the bootloader.

Once the boot loader copies the kernel to flash or DRAM, the kernel is repositioned to TextAddr - it is usually in the DRAM. Then, the bootloader will transfer to this address so that the kernel can begin execution.

Parameter transfer and kernel boot Stext is the kernel entry point, which means that the code under this section is first executed when kernel boots. It usually writes in assembly language and usually it is in the Arch / / kernel directory. This code sets the kernel page directory, creates an identity kernel mapping, identifies architectural and processor, and performs branch start_kernel (primary system's main routine).

START_KERNEL calls setup_arch as the first step in execution, in which the architecture is completed. This includes initializing the number of hardware registers, identifying root devices, and systems available in the system, specifying the number of available pages in the system, file system size, and so on. All of this information is passed from the bootloader from the bootloader to the kernel in parameters. There are two ways to pass the parameters from the boot loader to the kernel: parameter_structure and tag list. In both methods, it does not agree with the parameter structure because it imparts the limit: specifying in memory, each parameter must be located at a specific offset in param_struct. The latest kernel expects parameters are passed as the format of the tag list and convert the parameters to the marked format. PARAM_STRUCT is defined in include / asm / setup.h. Its important fields are:

Listing 3. Sample parameter structure

Struct param_struct {

Unsigned long page_size; / * 0: size of the point * /

Unsigned long NR_Pages; / * 4: Number of Pages in the system * /

Unsigned long ramdisk / * 8: ramdisk size * /

Unsigned long rootdev; / * 16: Number representing the root device * /

Unsigned long initrd_start; / * 64: starting address of initial ramdisk * /

/ * THIS Can Be Either in Flash / DRAM * /

Unsigned long initrd_size; / * 68: size of initial ramdisk * /

}

Note: These numbers represent the offset in the parameter structure of the field. This means that if the boot loader places the parameter structure at the address 0xc0000100, the rootdev parameter will be placed in 0xc0000100 16, and init_start will be placed in 0xc0000100 64, etc. - Otherwise, the kernel will encounter difficulties when explaining the correct parameters.

As mentioned above, because the parameter pass from the boot loader to the kernel will have some constraints, most 2.4.x series kernel expectation parameters are passed in the labeled list format. In the labeled list, each tag consists of a Tag_Header that is transmitted, and the subsequent parameter values ​​thereafter. The regular format marked in the tag list can be shown below:

Listing 4. Sample tag format. The kernel identifies each tag via end.

#define

Struct {

U32 ;

U32 ;

}

/ * EXAMPLE TAG for Passing Memory Information * /

#define atag_mem 0x54410002 / * Magic Number * /

Struct tag_mem32 {

U32 size; / * size of memory * /

U32 Start; / * Physical Start Address of Memory * /

}

Setup_arch also needs to perform memory mappings for flash repository, system registers, and other specific devices. Once the architectural setting is completed, the control returns the start_kernel function of the rest of the initialization system. These additional initialization tasks include: Setting Trap Initialization Interrupt Initial Timer Initializer Calling MEM_INIT, which calculates the number of pages in various areas, high internal storage, etc. Initialize the SLAB dispenser and creates SLAB high speeds such as VFS, buffer cache, etc. Cache build a variety of file systems, such as Proc, Ext2, and Jffs2 Create Kernel_thread, which performs the init command in the file system and displays the LIGN prompt. If there is no init program in / bin, / sbin or / etc, the kernel will execute the shell in the / bin of the file system.

Equipment Driver Embedded Systems typically have many devices for interacting with users, like touch screens, keypads, rolling wheels, sensors, RA232 interfaces, LCDs, and more. In addition to these devices, there are many other special devices, including flash, USB, GSM, etc. The kernel controls them through the respective equipment drivers of all of these devices, including the GUI user application to access the device by accessing these drivers. This section focuses on device drivers that are typically almost important devices that will be used in each embedded environment.

Frame buffer drivers are one of the most important drivers because the system screen can display the content through this driver. The frame buffer driver usually has three layers. The bottom layer is the basic console driver Drivers / Char / Console.c, which provides part of the text console regular interface. By using the console driver function, we can print the text to the screen - but the graphics or animation cannot (do this need to use video mode functions, usually in the middle layer, that is, DRIVERS / VIDEO / FBCON.C). This second layer driver provides a regular interface of the drawing in the video mode.

The frame buffer is the memory on the graphics card, you need to map it to the user space so you can write graphics and text on this memory segment: Then this information will be reflected on the screen. Frame buffers support to improve the speed and overall performance of the drawing. This is also the attention of the top-level driver, the top layer is very hardware driver, which requires different hardware aspects of the graphics card - icon enables / disables the graphics card controller, depth and pattern support, and palette. All three layers are interdependent to achieve the correct video function. The device related to the frame buffer is / DEV / FB0 (main device number 29, secondary device number 0).

The input device driver can touch board is one of the most basic user interactive devices for embedded devices - keypads, sensors, and scroll wheels are also included in many different devices for different purposes.

The main function of the touchpad device is to report the user's touch and identify the coordinates of the touch. This is usually implemented by generating an interrupt when touching each time.

Then, the role of this device driver is to query the touch screen controller whenever an interrupt occurs, and request the controller to send a touch coordinate. Once the driver receives the coordinate, it sends a signal about the touch and any available data to the user application, and sends the data to the application (if possible). The user application then handles data according to its needs.

Almost all input devices - including keypads - work with similar principles.

Flash MTD Drivers MTD devices are devices such as flash memory chips, small flash cards, memory sticks, and the like, which are growing in embedded devices.

The MTD driver is a new type of driver developed under Linux for embedded environments. The main advantage of using the MTD driver relative to the conventional block device driver is that the MTD driver is designed specifically for flash-free devices, so they usually have better support, better management and sector-based erasure And a better interface for reading and writing. The MTD driver interface under Linux is divided into two types of modules: user modules and hardware modules.

User Module These modules provide interfaces directly from user space: raw character access, original block access, FTL (flash conversion layer, Flash Transition Layer - a file system on flash) and JFS (ie log file system, journaled File System - Directly provides file systems directly instead of analog block devices). The current version of JFS for flash memory is JFFS2 (described later in this article). Hardware Modules These modules provide physical access to memory devices, but they don't use them directly. They are accessed by the user modules described above. These modules provide actual routines for reading, erase, and writing in flash memory.

The MTD Driver Set to access a specific flash device and put the file system thereon, you need to compile the MTD subsystem into the kernel. This includes selecting the appropriate MTD hardware and user modules. Currently, the MTD subsystem supports numerous flash devices - and more and more drivers are being added to use for different flash chips.

There are two popular user modules to enable access to flash: MTD_CHAR and MTD_BLOCK.

MTD_CHAR provides the original character access to the flash, and MTD_BLOCK is designed to create a regular block device that can create a file system above. The device associated with MTD_CHAR is / dev / mtd0, MTD1, MTD2 (etc.), and the device associated with MTD_BLOCK is / dev / mtdblock0, MTDBLOCK1 (etc.). Since the MTD_BLOCK device provides analog image of a block device, it is usually more desirable to create file systems such as FTL and JFFS2 on this simulation.

To do this, you may need to create a partition table to split the flash device into the bootloader section, the kernel festival, and the file system festival. The sample partition table may contain the following information:

Listing 5. Simple Flash Equipment Partition of MTD

Struct MTD_PARTITION SAMPLE_PARTITION = {

{

/ * First partition * /

Name: bootloader, / * bootloader section * /

Size: 0x00010000, / * size * /

Offset: 0, / * offset from start of flash- location 0x0 * /

Mask_flags: MTD_WRITEABLE / * THIS Partition IS Not Writable * /

}

{/ * Second partition * /

Name: kernel, / * kernel section * /

Size: 0x00100000, / * size * /

OFFSET: MTDPART_OFS_APPEND, / * APPEND AFTER BOOTLOADER Section * /

Mask_flags: MTD_WRITEABLE / * THIS Partition IS Not Writable * /

}

{/ * Third partition * /

Name: Jffs2, / * Jffs2 FileSystem * /

Size: mtdpart_siz_full, / * occupy rest of flash * /

OFFSET: MTDPART_OFS_APPEND / * APPEND AFTER KERNEL Section * /}

}

The above partition table uses the MTD_BLOCK interface to partition the flash device. The equipment nodes of these partitions are:

Simple flash partition device node

User Device Node Major Number MINOR NUMBER

BootLoader / dev / mtdblock0 31 0

KERNEL / DEV / MTDBLOCK1 31 1

FileSystem / dev / mtdblock2 31 2

In this case, the bootloader must pass the root device node (/ dev / mtdblock2) and the correct parameters that can be found in the file system in the flash (this example is Flash_Base_Address 0x0400000000) to the kernel. Once the partition is completed, the flash device is ready to load or hover the file system.

The main goal of the MTD subsystem in Linux is to provide a universal interface between the hardware driver and the upper layer, or the user module. The hardware driver does not need to know how to use user modules like JFFS2 and FTL. All they really need is a simple routine for the underlying flash system for Read, Write, and ERASE operations.

The file system system of embedded devices requires a method of storing and retrieving information in structured format; this requires the participation of file systems. Ramdisk (see Resources) is a mechanism for creating and hooking the file system by using the computer's RAM as a device, which is usually used for diskless systems (of course, including miniature embedded devices, which only contains a permanent storage medium Flash chip).

Users can select the type of file system based on the needs of reliability, robustness, and / or enhanced features. The next section will discuss several available options and its excellent disadvantages.

The second version of the extended file system (EXT2FS) EXT2FS is a Linux truth-based standard file system, which has replaced its predecessor-extended file system (or EXTFS). The file size supported by EXTFS is 2 GB, supported maximum file name size of 255 characters - and it does not support index nodes (including data modification time tags). Ext2fs is done better; its advantages are:

EXT2FS supports 4 TB memory. The EXT2FS file name can be up to 1012 characters. When creating a file system, administrators can select the size of the logical block (usually selected by 1024, 2048, and 4096 bytes). EXT2FS has a fast symbolic link: do not need to be assigned data blocks for this purpose, and store the target name directly in the Index Node (INODE) ​​table. This makes performance, especially at the speed.

Because of the stability, reliability and robustness of the EXT2 file system, EXT2 file systems are used almost all Linux-based systems (including desktops, servers and workstations - and even embedded devices). However, it has some disadvantages when using EXT2FS in an embedded device:

EXT2FS is designed for block devices like IDE devices, and the logical block size of these devices is a multiple of 512 bytes, 1 k bytes, and more. This is not suitable for flash devices that are different due to different devices. The EXT2 file system does not provide good management for sector-based erase / write operations. In EXT2FS, in order to erase a single byte in one sector, the entire sector must be copied to the RAM, then erase, and then rewrite. Considering that the flash device has a limited erase life (approximately 100,000 erases), they cannot be used after this, so this is not a particularly good way. EXT2FS is not anti-crushing when a power failure occurs. The EXT2 file system does not support loss balance, thus shortening the life of sector / flash memory. (Loss balance ensures that different regions of the address range are used to write and / or erase operations to extend the life of the flash device.) Ext2fs does not have particularly perfect sector management, which makes the design block driver is very difficult. For these reasons, it is usually better than EXT2FS to use MTD / JFFS2 combination in an embedded environment.

Mounting EXT2FS with RAMDisk By using the concept of RamDisk, you can create and flush the EXT2 file system (and any file system for this purpose) in the embedded device.

Listing 6. Create a simple EXT2FS-based Ramdisk

MKE2FS -VM0 / DEV / RAM 4096

Mount -T ext2 / dev / ram / mnt

CD / MNT

Cp / bin, / sbin, / etc, / dev ... Files in MNT

Cd ../

Umount / MNT

DD if = / dev / ram bs = 1k count = 4096 of = ext2ramdisk

MKE2FS is a utility for creating an EXT2 file system on any device - it creates a hyper block, an index node, and an index node table.

In the above usage, / dev / RAM is a device that constructs 4096 EXT2 file systems above. Then, this device (/ dev / ram) is hung up on a temporary directory called / mnt and all required files. Once these files are copied, uninstall this file system and the content of the device (/ dev / ram) is documented into an ext2ramdisk, which is the required RAMDisk (EXT2 file system).

A 4 MB of RAMDisk is created in the order, and it is filled with the required file utility.

The important directory that some to include in ramdisk is:

/ bin - Save Most Ibred Documents such as init, busybox, shell, file management utilities. / dev - contains all device nodes / etc-all devices in the device contains all configuration files / lib - contains all required libraries such as libc, libdl, etc.

Log flash file system, version 2 (Jffs2) Sweden Axis Communications developed the initial JFFS, Red Hat David Woodhouse improved it. The second version, JFFS2 appears as the actual file system for the original flash chip for micro-embedded devices. The JFFS2 file system is log structure, which means it is basically a long column node. Each node contains some information about the file - may be the name of the file, perhaps some data. Compared with EXT2FS, Jffs2 is increasingly popular in diskless embedded devices because of these advantages:

JFFS2 performs flash / write / read operations in sector levels than the EXT2 file system. Jffs2 provides better crash / power-off safety than EXT2FS. When you need to change a small amount of data, the EXT2 file system copies the entire sector into memory (DRAM), merged new data in memory, and writing back to the entire sector. This means that in order to change a single word, it is necessary to perform read / erase / write routines for the entire sector (64 KB) - the efficiency of this is very low. If the air is poor, when the data is being merged in DRAM, a power failure or other accident occurs, and the entire data collection is lost because the flash sector is removed after reading DRAM after reading DRAM. Jffs2 Additional files rather than rewriting the entire sector and has the ability to crash / power down security. This may be the most important point: JFFS2 is created specifically for embedded devices like flash chips, so its entire design provides better flash management. Because this paper is mainly written about the use of flash devices, it is very few shortcomings in embedded environments:

JFFS2 will greatly slow down the running speed when the file system is full or near full. This is because of the problem of garbage collection (more, see the reference).

Creating a JFFS2 file system Under Linux, create a JFFS2 file system with mkfs.jffs2 command (essentially using JFS2 RAMDISK).

Listing 7. Creating a JFFS2 file system

Mkdir Jffsfile

CD Jffsfile

/ * Copy all the / bin, / etc, / usr / bin, / sbin / binaries and / dev enties

That Are Needed for the FileSystem Here * /

/ * TYPE The FOLLOWING COMMAND Under Jffsfile Directory to Create The Jffs2 Image * /

. /MKFS.JFFS2-E 0x40000 -P -O ../jffs.image

The typical usage of mkfs.jffs2 is shown above. The -e option determines the erase sector size of the flash memory (usually 64 kilobytes). The -P option is used to fill zero in the remaining space of the image. The -o option is used to output a file, usually a JFFS2 file system image - in this example is Jffs.Image. Once the JFFS2 file system is created, it is loaded into the appropriate location in the flash memory (boot the loader to inform the core to find the address of the file system) so that the kernel can be hung it.

TMPFS When Linux is running on an embedded device, the device is a fully functional unit, and many daemon runs in the background and generates many log messages. In addition, all kernel logging mechanisms, like Syslogd, DMESG, and KLOGD, a number of messages will be generated in / var and / tmp. Since these processes have a large amount of data, it is not desirable to occur all of these write operations. Since these messages do not require persistent storage during reboot, this problem is to use TMPFS.

TMPFS is a memory-based file system that is primarily used to reduce unnecessary flash write operations for the system. Because TMPFS resides in the RAM, the operation of writing / reading / erase occurs in the RAM and not in flash. Therefore, log messages are written to RAM instead of flash memory, they will not retain them when rebooted. TMPFS also uses disk switched space to store, and when requesting a page for storage files, use the virtual memory (VM) subsystem.

The advantages of TMPFS include: Dynamic File System Size - File System Size can be scaled based on the number of files or directories represented, created or deleted. Memory can be used most ideally. Speed ​​- Because TMPFS resides in RAM, reading and writing almost instantaneous. Even if the file is stored in the form of exchange, the speed of I / O operation is still very fast.

One disadvantage of TMPFS is that all data is lost when the system reboots. Therefore, important data cannot be stored on TMPFS.

Most other file systems such as EXT2FS and JFFS2 reside on the underlying block device, while TMPFS is different from them, it is directly located on the VM. Thus, it is very simple to hidge the TMPFS file system:

Listing 8. Holding TMPFS

/ * Entries in /etc/rc.d/rc.sinit for creating / using TMPFS * /

# mount -t tmpfs tmpfs / var-= 512K

# MKDIR -P / VAR / TMP

# MKDIR -P / VAR / LOG

# ln -s / var / tmp / TMP

The above command will create TMPFS on / VAR and limit the maximum size of TMPFS to 512 K. At the same time, the TMP / and LOG / directories become part of TMPFS to store log messages in RAM.

If you want to add one item of TMPFS to / etc / fstab, then it may look like this: TMPFS / VAR TMPFS SIZE = 32M 0 0

This will hang a new TMPFS file system on / var.

The graphical user interface (GUI) option is from the user's point of view. The graphical user interface (GUI) is the most important aspect of the system: the user interacts with the system via the GUI. Therefore, GUI should be easy to use and very reliable. But it also needs to have memory consciousness so that the micro-embedded device can be seamless on the micro-embedded device. Therefore, it should be lightweight and can be quickly loaded.

Another important aspect to consider involving license issues. Some GUI distribution versions have licenses that allow free use, even in some commercial products. Other license requirements If you want to merge the GUI to enter the project, you have to pay the routine.

Finally, most developers may choose XFree86 because Xfree86 provides them with a familiar environment that can use their favorite tools. But the newer GUI, like Century Software's MicroWindows (NANO-X) and Trolltech's Qt / Embedded, which expands fierce competition in embedded Linux's competitive stage, this is mainly because they take a small resource. The speed of execution is fast and has support for custom window components.

Let's take a look at each of these options.

Xfree86 4.x (X11R6.4 supported by frame buffers) Xfree86 Project, Inc. is a company that produces XFree86, which is a X-WINDOW system that can be repeated, open source. The X WINDOW System (X11) provides resources to the application in graphical way, and it is the most common window system on UNIX and class UNIX machines. It is very small but very effective, it runs on numerous hardware, which is transparent to the network and has a good document description. X11 provides powerful features for window management, event processing, synchronization, and customer-wide communication - and most developers have been familiar with its API. It has built-in support for kernel frame buffers, and takes up very little resources - this is very helpful in devices that have relatively few memory. The X server supports VGA and non-VGA graphics cards, which support color depths 1, 2, 4, 8, 16, and 32, and provide built-in support for rendering. The latest release is XFree86 4.1.0. Its advantages include:

The use of the frame buffer architecture improves performance. The resource occupied is relatively small - size is within 600 k to 700 k bytes, which makes it easy to run on a small device. Very good support: There are many documents available online, and there are many mailing lists dedicated to Xfree86 development. X API is ideal for expansion.

Its disadvantages include:

Poor performance than the recent embedded GUI tool. In addition, Xfree86 appears more memory when the latest developments in GUI is designed to be designed for embedded environments.

MicroWindowsMicrowindows is the open source project of Century Software, which is designed for micro devices with small display units. It has many functions for modern graphic window environments. Like X, there are a variety of platforms that support microwindows.

The MicroWindows architecture is based on client / servers and has a hierarchical design. The bottom is the screen and the input device driver (regarding the keyboard or mouse) to interact with the actual hardware. In the middle layer, portable graphics engine provides support for line drawing, area fill, polygon, crop, and color model support.

At the top, MicroWindows supports two API: Win32 / WinCE API implementation, called MicroWindows; another API is very similar to GDK, which is called NANO-X. NANO-X is used on Linux. It is an app that is like X's API, which is used to take up less resources.

MicroWindows supports Palletized display of 1, 2, 4 and 8 BPP (bits per pixel), and true color display of 8, 16, 24, and 32 bpp. MicroWindows also supports a frame buffer that makes it fast. The resources occupied by the NANO-X server are approximately 100 k to 150 k bytes.

The average size of the original NANO-X application is from 30 k to 60 k. Since nano-x is designed for low-end devices with memory restrictions, it supports many functions as X, so it can't act as alternatives to micro X (Xfree86 4.1).

FLNX can be run on MicroWindows, which is a version of the FLTK (Fast Light Toolkit) application development environment for NANO-X instead of x. This will describe FLTK.

The advantages of NANO-X include:

Unlike the XLIB, NANO-X is still running synchronously on each client, which means that once the client request package is sent, the server is waiting for another client to serve the service until the entire package arrives. This makes the server code very simple, and the speed of running is still very fast. The disadvantage of occupying a small resource nano-x includes:

The networked function has not been adjusted appropriately (especially network transparency). Not too many ready-made applications are available. Compared to X, NANO-X has recently been accelerating development, but there is still not much documentation and there is no good support, but this situation will change.

The Fltk Apifltk on MicroWindows is a simple but flexible GUI toolbox, which has won more and more attention in the Linux world, which is especially suitable for the environment where it is very small. It provides that you expect most of the window components obtained from the GUI toolbox, such as buttons, dialogs, text boxes, and excellent "assault" options (for entering a value-added window component). Also includes a slider, a scroll bar, a tick disk, and other components.

The Linux version of the FLTK for the MicroWindows GUI engine is called FLNX. FLNX consists of two components: fl_widget and fluid. Fl_widget consists of all basic window components APIs. Fluid (Fast Light User Interface Designer, FLUID) is a graphic editor used to generate FLTK source code. In general, FLNX is an excellent UI builder that can be used to create an application for embedded environments.

The resource occupied by Fl_Widget is approximately 40 k to 48 k, while Fluid (including each window component) takes approximately 380 K. These very small resource usage make Fl_Widget and Fluid are very popular in embedded development.

Advantages include:

Anyone who is accustomed to developing GUI-based applications in a well-established environment such as Windows is very easy to adapt to the FLTK environment. Its documentation includes a very complete and well-written manual. It uses LGPL to distribute, so developers can flexibly distribute their applications licenses. FLTK is a C library (Perl and Python bindings are also available). The choice of object-oriented model is a good choice because most modern GUI environments are object-oriented; this also makes it easier to port the written applications to similar APIs. Century Software environments offers several useful tools such as ScreenTop and Viewml browsers.

Its disadvantage is:

Ordinary FLTK can work together with the X and Windows API, while FLNX cannot. It hinders the use of X to use it in many projects.

Qt / EmbeddedQT / Embedded is a graphical user interface system for the new development of Trolltech for embedded Linux. Trolltech originally created QT as a cross-platform development tool for Linux desktop. It supports various systems with UNIX features and Microsoft Windows. KDE - One of the most popular Linux desktop environments is written in QT.

Qt / Embedded is based on the original QT and has made many excellent adjustments for embedded environments. Qt Embedded interacts directly with Linux I / O facilities through the Qt API. Those familiar with and have adapted to object-oriented programming will find it is an ideal environment. Moreover, object-oriented architecture makes code structure, reusable and runs fast. Compared to other GUI, QT GUI is very fast, and it has no layering, which makes Qt / Embedded become the most compact environment used to run QT-based programs. Trolltech also launched a QT Palmtop Environment (QT Palmtop Environment, commonly known as QPE). QPE provides a basic desktop window and which provides an easy-to-use interface for development. QPE contains a full set of personal information management (Personal Information Management (PIM)) application, Internet client, utility, etc. However, in order to integrate QT / Embedded or QPE into one product, it is necessary to obtain a business license from Trolltech. (Original QT from version 2.2 can be obtained according to GPL.)

Its advantages include:

Object-oriented architecture helps to perform small resources, approximately 800 k-flawed textures and pixel mappings of mixed video

Its disadvantage is:

Qt / Embedded and QPE can only be used without business licenses.

Ending the embedded Linux development is developing rapidly. You must learn and make a selection from the various options for boot loaders and distribution to each matter in the file system and GUI. But thank you for your freedom and a very active Linux community. The embedded development on Linux has reached a new realm, and the module has never been simpler than it is now simpler. This has led to many new handheld and miniature equipment as an open box, this is a good thing - because the truth is that you don't have to be an expert to choose from these modules to meet your own requirements and needs.

We hope this introduction of the introduction of embedded Linux can arouse your desire to test, and I hope you will experience the fun of tiny devices to meet your hobbies. To further help your project, see "Resources" below to link to more in-depth information about the technology we have outlined here.

Reference

Boot: If you need to get the excellent explanation of VMLinux and Zimage, find the "Booting your Kernel" section in "Kernel Configuration: DEALING WITH THE UNEXPECTED (Linux Magazine) written in ALESSANDRO RUBINI. About the kernel, For more information on the image and boot process, please read Chapter 13 of the System Management Text of the Central Queensland University. To learn more about the working principle of the boot process, please refer to Rolo: a developer's Guide, it discusses Take Linux (Embedded Linux Works, June 2001). Small Distributed Edition: The Embedded Linux Distributions Quick Reference Guide covers many commercial and open source distribution (Linux Devices, Aug 2001). Check out another detailed distribution and useful tool list (Linux-Embedded.com). Toolchain: Wiki Tools Chain page contains links to all three toolchain mentioned in this article, as well as their comments. Device Driver: MEMORY TECHNOLOGY DEVICE (MTD) Subsystem for Linux is to simplify the creation of drivers of memory devices (especially flash devices). Vipin Malik Writing the Linux MTD, Jffs HowTo will help you work with MTD and JFFS2 LINUX for PowerPC Embedded Systems HowTo has a good device driver list. Understanding Linux Device Drivers helps understand this introductory article (PenGuin Magazine). To master the Linux device driver, read O'Reilly Linux Device Drivers, 2nd Edition book. Useful Tools: Please check the jflash-linux on the LART. Binutils, GCC and GLIBC can be downloaded from Free Software Foundation. Many useful downloads can be obtained from NetWinder.org, this is a Committed to Netwinde The volunteer site developed on the R platform. Please read all the information about ramdisk in the article written in Mark Nielsen. FLNX is based on FLTK (fast and lightweight toolbox). File System: The homepage of the second edition extension file system EXT2FS is in SourceForge. Red Hat British David Woodhouse outlines a lot of background knowledge about Jffs2: log flash file system, version 2. VIPIN MALIK JFFS - A Practical Guide One article also discussed Jffs in detail, including garbage collection (Embedded Linux Works, May 2001). You can read more information about TMPFS in Linux Headquarters.

The flash filesystems for Embedded Linux Systems written by Cliff Brake and Jeff Sutherland discusses more file systems for flash devices (Embedded Linux journal). GUI: Xfree86 is the home page developed by X. Information about MicroWindows and NANO-X is available on the MicroWindows site. Please see a discussion of some shortcomings of MicroWindows (the mailing list of Gnome GTK developers). You will find a rich MicroWindows / nano-x link on MicroWindows Project Links. Find more information about Qt / Embedded on Trolltech. The Embedded Linux GUI / WINDOWING REFERENCE GUIDE has a rich link (Linux Devices, February 2002). General Reference: General Public License or GPL Ensure that users are replicated, distributed, and modify software rights. ARM Linux is a very good site for your understanding of information about Linux for the ARM processor. It maintained by the ARM's creator Russell King. Penguinppc.org is the home page for Linux for the PowerPC Series processor. This site has a rich tutorial about establishing a toolchain based on PPC-based architecture. Linux Devices is a very comprehensive site that contains various information about publishing, quick reference, news, and feature reports for Linux and embedded development. The Silicon Penguin list has a detailed collection of embedded Linux references on the site. Armlinux - The Book can be obtained from Aleph One. You can order a copy or read online. Embedded Linux consortium is a non-profit mutual assistance association, which is welcome to become a member of the embedded Linux field. Access IBM About Embedded Linux Homepage, gets news, products, and developers. IBM Linux Wristwatch is an example of running Linux's micro-embedded device; one of this article, Vishal Kulkarni is also involved in its development. Read information about it in IBM's Linux Watch: The Challenge of Miniaturization (PDF format), or this article (FreeOS.com, March 2001). Browse more Linux references on developerWorks. Browse more wireless fields on developerWorks.

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

New Post(0)