Linux has the advantages of open source code, high efficiency, and scalability, and is widely used in the development of embedded systems. This article introduces the embedded Linux operating system, the transplantation target platform SBC2410, and the directory structure of the Linux kernel source code. It analyzes the implementation process of Linux transplantation to the SBC2410 platform, explains the Linux kernel, the cutting and compilation of u-boot, and the production process of the root file system, and finally successfully transplants the embedded Linux system on the SBC2410 platform.
An embedded system is a special-purpose computer system. The system is based on computer technology, and the software and hardware can be tailored, but it has strict requirements on functions, reliability, and cost. Today, some special-purpose systems need to process a large amount of information. Since it is difficult for traditional computer systems to achieve hardware tailoring, they can no longer meet the needs of special-purpose systems. With the rapid development of my country's automobile, home appliance and other industries, the application and development of embedded systems has become a new hot spot in the current IT industry. The first problem to be solved in the development of ARM-based embedded systems is the porting of embedded operating systems. As a multi-tasking operating system with open source code and support for multiple processor structures, the Linux operating system has the advantages of small kernel, easy tailoring, and good portability. It is currently the mainstream operating system for the application and development of embedded systems. This paper mainly studies the implementation method of building an embedded Linux system on the ARM9 platform.
1 Embedded Linux operating system and its characteristics
Currently, in the development of embedded systems, 52% of projects choose Linux as the embedded operating system, which is inseparable from the excellent characteristics of Linux itself.
The Linux operating system kernel source code is open and has rich software resources. Different application fields can modify the kernel as needed, and every general program can be found in Linux. You don't need to start from scratch when developing programs on Linux. You can choose a similar software for secondary development, so you can develop an embedded system that meets your needs at a low cost.
In addition, the Linux system can support a variety of hardware devices, and has rich drivers, which can support a variety of mainstream hardware devices and the latest hardware technologies. With the widespread application of Linux, many chip manufacturers have also begun to provide drivers for Linux, which has laid the foundation for the application of Linux on various hardware platforms.
Linux can support multiple architectures and has good portability. At present, Linux has been ported to most hardware platforms and can support multiple systems such as ARM, MIPS, LPHA, SPARC, etc. Linux supports almost all popular CPUs. Linux has a complete set of tool chains, which makes it easy to establish the development environment and cross-operation environment of embedded systems, and can overcome the obstacles of simulation tools in embedded system development. Because it complies with the IEEE POSIX.1 standard, the application has good portability.
Linux has a complete network communication and file management mechanism. In fact, Linux has been inseparable from the network from the beginning, and the network is the most prominent feature of Linux. Linux has the characteristics of embedded Linux system transplantation on ARM9, which ensures that it supports all standard Internet protocols and can use Linux's network protocol stack to develop embedded TCP/IP network protocol stack. At the same time, Linux supports file systems such as ext2, fat16, fat32, romfs, etc., which lays a good foundation for embedded system application development.
2 Linux porting on ARM platform
2.1 Introduction to SBC2410 Hardware Platform
The SBC2410 hardware platform is an embedded hardware platform based on the ARM9 processor SBC2410A, which can support ARM-Linux, Windows CE and other operating systems. The main hardware resources include a 64 MB SDRAM, a 64 MB NandFlash, a 1 MB Nor Flash, a serial port COM0, a USB Host A type interface, a USB Slave B type interface, and a standard JTAG interface.
2.2 Preparation for Linux porting on ARM platform
The first thing is to establish a cross-compilation environment. The cross-compilation environment is a comprehensive development environment composed of a compiler, a connector, and an interpreter. The cross-compilation tools mainly include the compiler gCC , the binary tool binutils, the standard C library glibc of the target system, and the Linux kernel header files of the target system. The host machine should select a Linux operating system for embedded development, and configure the network, NFS services, etc. Because the target machine does not have enough resources to run development tools and debugging tools, a cross-compilation environment must be established on the host machine, and then the cross-compilation tool will generate executable binary code (which cannot be run on the host machine), and then download it to the target board for debugging and running. The steps to generate a cross-compilation standard C environment include the following four steps:
(1) Obtain the source code of binutils, gcc, and glibc;
(2) Configure and compile binutils to obtain the assembler and connector;
(3) Configure and compile the gcc source code to generate the gcc compiler;
(4) Configure glibc to compile and generate glibc's C library functions.
2.3 Bootloader transplantation
The bootloader is closely related to the architecture. It is a small program that runs before the operating system kernel and application programs run, and is used to complete the startup and loading of the system. It is similar to the BIOS program in a PC. The bootloader is heavily dependent on hardware implementation, and it is generally impossible to build a universal bootloader in an embedded system. Users must write this small program by themselves to complete the initialization of hardware devices, establish a mapping of memory space, and bring the system's hardware and software to a suitable state to prepare for the operation of the operating system kernel.
Usually bootloader transplantation is divided into two steps:
The first step is to use assembly language to implement the code that depends on the CPU architecture. This mainly includes hardware device initialization; preparing RAM space for loading the bootloader; copying the bootloader to the RAM space; and setting up the stack.
The second step is usually implemented in C language. That is: initialize the hardware devices to be used in this stage; check the system memory map; read the kernel image and the root file system image from the flash to the RAM space; set the startup parameters for the kernel; call the kernel. Figure 1 shows the workflow of the bootloader.
2.4 Kernel transplantation
Kernel transplantation should first start the operating system, complete memory management, task scheduling, process management, driver loading, network and other functions, and then execute the application or wait for user commands. Although there are complex scheduling relationships between the various functions, due to the characteristics of the Linux layered structure, the hardware-related codes have been separated out. Therefore, during the transplantation process, only the hardware-related codes in process management, memory management and device management need to be changed.
Generally speaking, the kernel downloaded from the official website cannot be run directly on the hardware platform. Instead, the kernel must be re-cut and compiled according to the specific hardware platform, and the corresponding hardware-related code must be written according to the characteristics of the hardware platform to port Linux to the hardware platform. The modification of the kernel code includes the following parts:
(1) Modify the Makefile at the root of the kernel directory tree, find ARCH and CROSS_COMPILE, change ARCH=arm, CROSS_COMPILE=armlinux, and then set the PATH environment variable. Add export PATH=/usr/ LOCal /arm/3.4.4/bin:$PATH to the bashrc file so that it can find the cross-compilation tool chain, and then log in again.
(2) Set up the flash partition, modify arch/arm/machSBC2410/devs.c to specify the partition information, and the content of this file will establish the nand flash partition table; modify the arch/arm/machSBC2410/mach SMD k2410.c file to specify the initialization at startup, and perform initial configuration based on the partition settings when the kernel starts. In the Linux source file directory, execute the makemenuconfig command to configure the kernel to generate the config file, select the processor type as SBC2410, select the serial port driver device, and save the config file after completion.
After completing the kernel trimming, execute the command make clean to clean the environment before compiling the kernel. You can also use makerealclean or makemrproper to completely remove related dependencies to ensure that there are no incorrect files. Finally, download zimage to the development board.
3 Conclusion
After transplantation, Uboot and Linux can run on the SBC2410 platform. On this basis, various drivers and application software can be further developed. Connect the SBC2410 and the PC with a serial cable, and you can see the success of the transplantation through the hyperterminal. After the system is successfully started, you can enter the root file system. This article analyzes the characteristics and transplantation methods of Linux, summarizes a method of Linux system transplantation based on ARM, and realizes the transplantation of the Linux system kernel on the SBC2410 processor platform.
Previous article:How to transplant μClinux to ARM7 system microprocessor S3C4510B
Next article:Design of CAN communication module based on μCOS-II
Recommended ReadingLatest update time:2024-11-16 14:46
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Activate the new generation of video doorbell! Let your eyes and ears be close to you
- Ask about inductor winding
- MSP430F5529 ADC Reference Sampling Example
- Implementation of HPI Boot Mode in TMS320C62x
- Detailed explanation of MSP430F149 serial port receiving and sending program
- Those power supply test issues we ignore
- New OBD device with intelligent brake light control system
- GD32VF103V_EVAL uses USB to serial port function
- openocd command line programming ARM bare metal program problems and solutions
- How is your circuit preparation going?