Linux Embedded System Application for Advanced 2.6 Kernel

Publisher:快乐的成长Latest update time:2013-04-06 Source: dzscKeywords:Advanced Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
    With the rapid development of information technology combining multimedia technology and communication technology and the widespread application of the Internet, the PC era has also transitioned to the post-PC era. In the post-PC era with the rapid development of digital information technology and network technology, embedded technology is increasingly closely integrated with people's lives.

       The operating system provides the most basic interface program for users to use computers and their external devices, and manages the resources on the computer. With the expansion of application fields, in order to adapt to different application occasions, considering the flexibility, scalability and tailorability of the system, a special-purpose computer system centered on applications, based on computer technology, with tailorable software and hardware, and adapting to the strict requirements of application systems on functions, reliability, cost, volume, and power consumption - embedded operating system has been born.

       The Linux operating system is a free operating system with excellent performance, open source code and wide application. It can be used as an embedded operating system due to its advantages such as small size, scalability, high running speed and good network performance. With the release of the 2.6 kernel, Linux has posed a huge challenge to the existing mainstream RTOS providers in the embedded system market, such as VxWorks and WinCE, and has many new features, which will become a better embedded operating system.

       The low cost and openness of Linux create fertile soil for its application in the field of embedded systems. This paper focuses on the new features of the Linux 2.6 kernel and its advantages in embedded applications, and transplants it to an embedded platform to successfully support H.264 codec multimedia systems.

      1 Linux 2.6 kernel for embedded development of significant features

      Real-time reliability is a common requirement for embedded applications. Although Linux 2.6 is not a true real-time operating system, its improved features can meet the response requirements. Linux 2.6 has added improvements to the kernel body to improve interrupt performance and scheduling response time. The three most significant improvements are: the use of a preemptible kernel, a more efficient scheduling algorithm, and improved synchronization<4>. In the field of enterprise servers and embedded system applications, Linux 2.6 is a huge step forward. In the embedded field, in addition to improving its real-time performance and making system porting easier, Linux 2.6 also adds new architectures and processor types - including support for MMU-less systems without hardware-controlled memory management solutions, which can support large-capacity memory models and microcontrollers, and also improves the I/O subsystem and adds more multimedia application functions<4>.

      1.1 Preemptible kernel

      In previous kernel versions (including the 2.4 kernel), it is not allowed to preempt tasks running in kernel mode (including user tasks that enter kernel mode through system calls), and they can only wait for them to actively release the CPU. This will inevitably cause some important tasks to be delayed to wait for the system call to end.

      A kernel task can be preempted so that important user applications can continue to run. The main advantage of this is that it greatly enhances the user interactivity of the system.

      The 2.6 kernel is not a true RTOS (Real Time Operation System). It inserts preemption points in the kernel code, allowing the scheduler to terminate the current process and call a higher priority process. It avoids unreasonable system call delays by testing the preemption points. The 2.6 kernel is preemptible to a certain extent and has better responsiveness than the 2.4 kernel. However, not all kernel code segments can be preempted. The key parts of the kernel code can be locked to ensure that the CPU data structure and state are always protected and not preempted.

      The need for software to meet the final time limit and virtual memory request paging are in conflict. Slow page fault handling will destroy the real-time responsiveness of the system, and the 2.6 kernel can compile a system without virtual memory to avoid this problem, which is the key to solving the problem, but requires software designers to have enough memory to ensure the execution of tasks.

      1.2 Effective Scheduler

      The Linux kernel version 2.6 uses a new scheduler algorithm developed by Ingo Molnar, called the O(1) algorithm, as shown in Figure 1. It performs extremely well under high load conditions and can also scale well when there are many processors in parallel<2>. In the past, the scheduler needed to search the entire queue of ready tasks and calculate their importance to decide which task to call next. The time required varies with the number of tasks. The O(1) algorithm no longer scans all tasks each time. When a task is ready, it is placed in an active queue. The scheduler schedules the appropriate task from it each time, so each scheduling is a fixed time. When the task runs, it is assigned a time slice. When the time slice ends, the task will give up the processor and move to the expired queue according to its priority. After all the tasks in the active queue are scheduled, the two queue pointers are exchanged, the expired queue becomes the current queue, and the scheduler continues to schedule the tasks in the current queue with a simple algorithm. This can further improve the efficiency of SMP in the case of multiple processors, balance the load of processors, and avoid process jumping between processors.

      1.3 Synchronization Prototypes and Shared Memory

      Multi-process applications need to share memory and peripheral resources. To avoid competition, mutual exclusion is used to ensure that resources are accessed by only one task at a time. The Linux kernel uses a system call to decide whether a thread should be blocked or continue to execute to achieve mutual exclusion. When the thread continues to execute, this time-consuming system call is no longer necessary. Fast User-Space Mutexes supported by Linux2.6 can detect from user space whether a thread needs to be blocked, and only execute a system call to terminate the thread when necessary. It also uses scheduling priority to determine the process to be executed <4>. Multi-processor embedded systems need to share memory between processors. Symmetric multi-processing technology uses equal priority for memory access, which greatly limits the scalability and processing efficiency of the system. Linux2.6 provides a new management method - NUMA (Non Uniform Memory Access). NUMA gives different levels of permissions to different processors based on the topological layout of processors and memory when memory contention occurs to solve the memory preemption bottleneck and improve throughput.

      1.4 POSIX threads and NPTL

      The new thread model is based on a 1:1 thread model (one kernel thread corresponds to one user thread), including kernel support for the new NPTL (Native POSIX Threading Library), which is a significant improvement over the previous kernel threading approach. The 2.6 kernel also provides POSIX signals and POSIX high-resolution timers. POSIX signals will not be lost and can carry communication information between threads or processors. Embedded systems require the system to execute tasks according to a schedule, and POSIX timers can provide 1kHz triggers to make this simple, so that progress can be effectively controlled.

      1.5 Microcontroller Support

      The Linux 2.6 kernel has added support for a variety of microcontrollers. Previously, processors without MMU could only use some improved branch versions, such as uClinux, but the 2.6 kernel has integrated it into the new kernel and started to support a variety of popular microcontrollers without MMU, such as Dragonball, ColdFire, and Hitachi H8/300. Linux still supports multitasking on controllers without MMU, but there is no memory protection function. At the same time, it also adds support for many popular controllers, such as S3C2410. [page]

      1.6 Application-oriented

       Embedded applications are user-customized, and hardware designs are developed for specific applications, which brings problems to the system in supporting non-standard designs (such as IRQ management). In order to better achieve this, a componentized operating system can be used. The subsystem architecture adopted by Linux2.6 modularizes functions and can be customized with minimal impact on other parts. At the same time, Linux2.6 provides support for a variety of new technologies to realize various application development, such as Advanced Linux Sound Architecture (ALSA) and Video4Linux, which make multimedia information processing more convenient; support for USB2.0, providing higher-speed transmission, adding Bluetooth wireless interface, audio data link and link-oriented data transmission L2CAP to meet the needs of short-distance wireless connection; and in the 2.6 kernel, it can also be configured as a pure user-free interface system without input and display.

      2 Applied research

      The embedded Linux 2.6.11.7 kernel system was ported to the S3C2410 development board and applied to building the H.264 multimedia system.

      2.1 Establishing a cross-compilation environment

      To develop kernel porting on a RedHat9 host, you first need to establish a cross-compilation environment. Since the 2.6 kernel uses some new features and instructions, you need to use a newer tool set, binutils-2.15, gcc-3.4.2, glibc-2.2.5, linux-2.6.8, and glibc-linuxthreads-2.2.5 to establish a cross-compilation tool chain. After establishment, add the tool chain path to the system path $PATH.

      2.2 Kernel modification

      The Linux 2.6.11.7 kernel has added support for the S3C2410 chip, and no patch files are needed. Modify the cross-compilation options ARCH=arm, CROSS_COMPILE=arm-linux- in the Makefile in the kernel source code. For hardware configuration, add the FLASH partition information s3c_nand_info in arch/arm/mach-s3c2410/devs.c or smdk2410.c, as shown in Table 1.

Table 1 NAND FLASH partition table
Partition name starting address size
Vivi 0x00000000 0x00020000
Param 0x00020000 0x00010000
Kernel 0x00030000 0x001c0000
Root 0x00200000 0x00200000
Usr 0x00400000 0x03c00000

       Then add .dev={.platform_data= &s3c_nand_info} in s3c_device_nand, and add &s3c_device_nand in the __initdata section of arch/arm/mach-s3c2410/mach-smdk2410.c to enable the kernel to initialize the NAND FLASH information at startup.

       2.3 Kernel compilation and loading

       Properly configuring the kernel is a tailor-made process. Since the 2.6 kernel will be initially set up according to the local system configuration, you can import the default s3c2410 configuration file of the kernel source code to facilitate loading the basic kernel configuration, and then select the required options. For the MTD configuration, select to support the MTD device driver and NAND FLASH driver; select to support various file systems (DEVFS, TMPFS, CRAMFS, YAFFS, EXT2, NFS) and network devices and protocols to be used. This system loads the network chip CS8900 and USB support; in the H.264 multimedia system, it is also necessary to load the Frame buffer to support the LCD display function. After compiling the kernel source code using the cross-compilation tool, a kernel image named zImage will be generated under arch/arm/boot/. Use the download command in the command prompt mode of the Boot loader to complete the kernel loading into the storage device FLASH of the development board. Compilation process (compared to the compilation process of previous versions, the 2.6 kernel compilation is simplified):

       make mrproper

       make menuconfig (character interface, or use make xconfig graphical interface, but it requires the support of Qt library, and make gconfig requires the support of GTK library)

       make

       make bzImage

       2.4 File System

       Linux uses the file system to organize files and devices in the system and provide a unified interface for devices and user programs. Linux supports multiple file systems. This system uses the read-only root file system in CRAMFS format, and uses the YAFFS file system format that supports read and write in the USER area of ​​FLASH, which is convenient for adding your own applications.

       In the root file system, the CRAMFS format is used to protect the basic settings of the system from being changed. DEVFS is used to implement the establishment and mounting of basic devices. At the same time, using BusyBox is also a way to reduce the root file system, providing basic instructions for the system; it is also necessary to create some necessary directories and add the required configuration files, such as fstab, inittab, etc.; another important task is to add the dynamic function library necessary for system applications. Use the generation tool mkcramfs to make the contents of the entire root file directory into an image file.

       mkcramfs rootfs rootfs.ramfs

       To support the YAFFS file system format, you need to add the driver to the kernel code tree under fs/yaffs/, modify the kernel configuration file, and then load the support for the file system during kernel compilation. Use the mkyaffs tool to format the NAND FLASH partition as a YAFFS partition, burn the application image generated by mkyaffsimage into the YAFFS partition, and automatically load the YAFFS partition by writing fstab at startup.

       2.5 Network Device Drivers

       The system uses the 10M network chip of CS8900A, which uses nGCS3 and IRQ_EINT9 of S3C2410. Modify linux/arch/arm/mach-s3c2410/irq.c accordingly, and add {SMDK2410_ETH_IO,S3C2410_CS2, SZ_1M, MT_DEVICE} in smdk2410_iodesc<> of mach-smdk2410.c. Add the chip drivers drivers/net/arm/cs8900.h and cs8900.c to the kernel source code, configure the Makefile and Kconfig files of the network device driver, and add the configuration options of CS8900A, so that the network device driver can be loaded when the kernel is compiled.

       When using Linux 2.6, we should also see some problems compared with previous versions of the kernel. Compared with Linux 2.4, there are some shortcomings in kernel compilation time, kernel image size, kernel RAM space occupied, and system startup time, but they are acceptable in today's increasingly advanced hardware conditions, and part of it is also due to the inevitable result of enhanced functions. Although Linux is not a true real-time operating system, the improvements of the 2.6 kernel can meet most application requirements, so the Linux 2.6 kernel will be very useful in the field of embedded systems.

Keywords:Advanced Reference address:Linux Embedded System Application for Advanced 2.6 Kernel

Previous article:CAN bus embedded driver programming based on uclinux
Next article:Design of mobile TV software and hardware based on S3C2440A T-DMB

Recommended ReadingLatest update time:2024-11-16 20:46

at91sam9x5ek linux 4, experience accumulation in embedded Linux transplantation
1: Related source code (1) arm-2010q1-202-arm-none-linux-gnueabi.tar.bz2 cross-compilation tool gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202) (2) Bootstrap-V3.5.tar.bz2 The first-level Boot provided by ATmel (3)u-boot-2014.04.tar.bz2                        Uboot (4)linux-2.6.39_OK.tar.bz2                        Lin
[Microcontroller]
OK6410A Development Board (VIII) 99 linux-5.11 OK6410A File Access Example Comparison between mmap and read
Implementation of mmap and write The implementation of both of them actually focuses on Linux, so to compare their differences, we should pay attention to the differences in the following processes in the Linux kernel: open - addr=mmap(...); - addr - close open - read - close Same point To get the "file contents
[Microcontroller]
OK6410A development board (eight) 4 linux-5.11 OK6410A peripheral driver
Other drivers It has been completed and can be used normally boot uart mmc(sd) DDR LCD (WXCAT43-TG3#001, CON1 external plug-in) ethernet(dm9000a) usb(usb otg) There are still some interesting ones left, which I will do later. touchscreen gpio(J8/J12/J13) LED (LED1/2/3/4) camera(FIT-CAM-OV9650,JP1 external plug) audi
[Microcontroller]
Application design of wind power generation monitoring system based on S3C2410A embedded processor
In order to adapt to different application scenarios and take into account the flexibility, scalability and tailorability of computer systems, an embedded operating system was born that is application-centered, based on computer technology, and tailorable in software and hardware. This kind of embedded system can be s
[Microcontroller]
Application design of wind power generation monitoring system based on S3C2410A embedded processor
Linux port IO operations
Linux follows allocation, mapping and use for port IO usage struct resource *request_mem_region(unsigned long start,unsigned long len,char *name); Returns NULL if the application fails, otherwise non-zero. void release_mem_region(unsigned long start,unsigned long len); release. void *ioremap
[Microcontroller]
OpenCloudOS, a domestic open source operating system, now supports Linux native version of WeChat
On June 17, OpenCloudOS is an open source and neutral domestic operating system community. After months of development and testing, the OpenCloudOS community officially announced today that it has achieved adaptation support between OpenCloudOS and the Linux native version of WeChat with the WeChat team.
[Embedded]
OpenCloudOS, a domestic open source operating system, now supports Linux native version of WeChat
OK6410A Development Board (VIII) 68 linux-5.11 OK6410A Implementation of the atomic synchronization mechanism in the linux kernel
What is the problem being solved? All race conditions accomplish 32bit // Below is the definition of atomic_add arch/arm/include/asm/atomic.h  36 #define ATOMIC_OP(op, c_op, asm_op)                                               37 static inline void atomic_##op(int i, atomic_t *v)                              
[Microcontroller]
Design of Embedded Image Transmission System Based on S3C2410
1 Introduction How to better obtain the image data of the monitoring site has always been a difficult problem. The traditional method is to use CCD cameras to obtain the video information of the site. This method is easy to implement, but the cost is high. With the increasing application of ARM series processor
[Microcontroller]
Design of Embedded Image Transmission System Based on S3C2410
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号