Linux kernel embedded system reduction

Source: Internet
Author: User
Linux general technology-Linux programming and kernel information for Linux kernel embedded system reduction. The following is a detailed description. Abstract: Based on the analysis of the new features of the Linux 2.6 kernel, the 264 kernel and the new file system were transplanted on the S3C2410 Development Board and successfully supported the H.264 encoding and decoding multimedia system.

Keywords: Linux kernel embedded system S3C2410


With the rapid development of information technology combined with multimedia and communication technology and the wide 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 daily lives.

The operating system provides the most basic interface program for users to use computers and their external devices to manage resources on computers. As the application field expands, in order to adapt to different application scenarios, considering the flexibility, scalability, and scalability of the system, an application-centric, computer technology-based, software and hardware cropping, adapted to the application system's functional, reliability, cost, volume, power consumption requirements of a dedicated computer system-Embedded Operating System it is extended.

Linux is a free operating system with excellent performance, open source code, and widely used. Thanks to its small size, scalability, high running speed, and good network performance, can be used as an embedded operating system. With the release of the 2.6 kernel, Linux has posed great challenges to mainstream RTOS providers in the embedded system market, such as VxWorks and WinCE, which have many new features, it will become a better embedded operating system.

Linux's low cost and openness have created a fertile ground for its application in the field of embedded systems. This article focuses on the new features of Linux 2.6 kernel and its advantages in embedded applications. It is transplanted to the embedded platform and successfully supports H.264 encoding/decoding multimedia systems.

   1 Linux 2.6 kernel has notable features for Embedded Development

Real-time reliability is a common requirement for embedded applications. Although Linux 2.6 is not a 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, with three of the most significant improvements: use kernel preemption, more effective scheduling algorithms, and synchronization improvement [4]. Linux 2.6 is a huge improvement in enterprise servers and embedded system applications. In the field of embedded systems, Linux 2.6 not only improves its real-time performance, but also facilitates system migration, at the same time, a new architecture and processor type were added, including support for MMU-less systems without hardware control memory management solutions, and support for large-capacity memory models and microcontroller, at the same time, the I/O subsystem has been improved and more multimedia application functions have been added [4].

1.1 kernel preemption

In earlier kernel versions (including the 2.4 kernel), tasks running in the core State are not allowed to be preemptible (including user tasks that enter the kernel mode through system calls ), you can only wait for them to manually release the CPU. This will inevitably lead to the delay of some important tasks waiting for the end of the System Call.

A kernel task can be preemptible so that important user applications can continue to run. The main advantage of this is to greatly enhance the user interaction of the system.

2.6 The kernel is not a Real Time Operation System (RTOS). It inserts a preemption point in the kernel code, allowing the scheduler to stop the current process and call a process with a higher priority, test the preemption point to avoid unreasonable system call delay. The 2.6 kernel can be preemptible to a certain extent, providing better responsiveness than the 2.4 kernel. However, not all kernel code segments can be preemptible. You can lock the key part of the kernel code to ensure that the data structure and status of the CPU are always protected and not preemptible.

The software must meet the final time limit and schedule Virtual Memory Request pages. Slow page error processing will damage the system's real-time responsiveness, and 2.6 kernel can compile a non-virtual memory system to avoid this problem, which is the key to solving the problem, however, software designers are required to have enough memory to ensure task execution.

1.2 Effective scheduling program

The 2.6 Linux kernel uses a new scheduler algorithm developed by Ingo Molnar, called the O (1) algorithm. It performs extremely well under high load conditions, and can be well expanded when many processors run concurrently [2]. In the past, the scheduler had to look up the entire ready task queue and calculate their importance to determine the task to be called next. The time required changes with the number of tasks. The O (1) algorithm no longer scans all tasks each time. When the task is ready, it is placed in an active queue. The scheduler schedules the appropriate tasks each time, therefore, each scheduling is a fixed time. A time slice is allocated when the task is running. When the time slice ends, the task will discard the processor and go to the expired Queue according to its priority. After all the tasks in the active queue are scheduled, the two queues are switched and the expired queue becomes the current queue. The scheduler continues to schedule the tasks in the current queue with simple algorithms. This improves SMP efficiency in the case of multi-processor, balances the load of the processor, and avoids the process from jumping between processors.

1.3 synchronization prototype and shared memory

Multi-process applications need to share memory and peripheral resources. To avoid competition, they adopt a mutex method to ensure that resources are accessed by only one task at a time. The Linux kernel uses a system call to determine whether a thread is blocked or continues to execute to achieve mutex. When the thread continues to execute, this time-consuming system call is unnecessary. The Fast User-Space Mutexes supported by Linux2.6 can detect from the User Space whether the thread needs to be blocked, and only execute the system call termination thread when needed. It also uses the scheduling priority to determine the process to be executed [4]. In a multi-processor embedded system, each processor needs to share the memory. The Symmetric Multi-processing technology takes the same 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 ). According to the topology of the processor and memory, NUMA grants different levels of permissions to different processors in case of memory competition to solve the memory preemption bottleneck and improve the throughput.

1.4 POSIX thread and NPTL

The new thread model is based on a thread model (a kernel thread corresponds to a user thread), including Kernel support for the new NPTL (Native POSIX Threading Library, this is a significant improvement to the previous kernel thread method. The 2.6 kernel also provides POSIX signals and POSIX high-resolution timers. POSIX signals is not lost and can carry communication information between threads or processors. The embedded system requires the system to execute tasks according to the schedule. POSIX timer can provide 1 kHz triggers to simplify all the tasks and effectively control the progress.

1.5 microcontroller support

The Linux2.6 kernel is supported by multiple microcontroller types. MMU-free processors can only use improved branch versions, such as uClinux, And the 2.6 kernel has integrated them into the new kernel, and began to support a variety of popular MMU-free microcontroller, such as Dragonball, ColdFire, and Hitachi H8/300. Linux still supports multi-task processing without the MMU controller, but does not have the memory protection function. It also supports many popular controllers, such as S3C2410.

1.6 application-oriented

Embedded applications are customized by users, and hardware design is developed for specific applications. This poses problems for the system to support non-standardized design (such as IRQ management ). A component-based operating system can be used for better implementation. The subsystem architecture used in Linux2.6 modularize the functions and can be customized to minimize the impact on other components. At the same time, Linux2.6 provides support for a variety of new technologies to achieve various application development, such as Advanced Linux Sound Architecture (ALSA) and Video4Linux, to facilitate multimedia information processing. USB2.0 USB2.0 support, provides higher-speed transmission, and adds bluetooth wireless interfaces, audio data links, and link-oriented data transmission L2CAP to meet short-distance wireless connection needs; in addition, in the 2.6 kernel, it can be configured as a pure non-user interface system without input or display.

   2 Application Research

Transplant the embedded Linux 2.6.11.7 kernel system on the S3C2410 Development Board to build the H.264 multimedia system.

2.1 create a cross-compilation environment

To port the kernel on the RedHat9 host, you must first establish a cross-compilation environment. Because some new features and commands are adopted in the 2.6 kernel, a newer toolset needs to be adopted to build a cross-compilation toolchain using binutils-2.15, gcc-3.4.2, glibc-2.2.5, linux-2.6.8 and glibc-linuxthreads-2.2.5, after the tool chain is created, add the tool chain PATH to the system PATH $ PATH.

2.2 kernel Modification

Linux 2.6.11.7 kernel supports the S3C2410 chip and no patch files are required. Modify the cross-compilation options ARCH = arm and CROSS_COMPILE = arm-linux-for Makefile in the kernel source code -. For hardware configuration, you need to add the FLASH partition information in arch/arm/mach-s3c2410/devs. c or smdk2410.c, such as table 1.

Table 1 nand flash Partition Table
CODE: the start address of the partition name is large or small.
Vivi 0x00000000 0x00020000
Param 0x00020000 0x00010000
Kernel 0x00030000 0x001c0000
Root 0x00200000 0x00200000
Usr 0x00400000 0x03c00000
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.