1 Introduction
Embedded Linux refers to a special Linux operating system that has been miniaturized and cut to fit into a memory chip or microcontroller with a capacity of only a few hundred thousand bytes, and is used in specific embedded situations. Embedded Linux is composed of many small and high-performance microkernel systems. Under the premise that the kernel code is completely open, users in different fields and at different levels can easily modify the kernel according to their own application needs, and design and develop an embedded system that truly meets their needs at a low cost.
As the electronics market grows, high-performance, low-power multimedia portable devices and wireless devices are becoming more and more popular in the market. The Intel XScale PXA255 processor is launched to address this situation. It uses the Intel XScale micro-architecture system framework and the ARMV5TE 7-stage super pipeline. It can work at 200MHz, 300MHz, and 400MHz, and integrates many commonly used peripheral interfaces. This article will introduce how to build an embedded Linux application platform on the Intel XScale PXA255.
The construction of an embedded Linux system consists of the following steps: loading the Bootloader, loading and compiling the Linux kernel and the corresponding root file system in a cross-compilation environment, etc. The implementation of each step is introduced step by step below.
2.1 Loading the Bootloader
The bootloader is the first piece of software code that runs after the system is powered on. Recalling the PC architecture, we know that the bootloader in the PC consists of the BIOS (which is essentially a firmware program) and the boot program located in the hard disk MBR. In embedded systems, there is usually no firmware program like BIOS, so the entire system loading and startup task is completely completed by the bootloader. The bootloader startup process is generally divided into two stages: stage1 and stage2. The code in stage1 is usually implemented in assembly language to improve the efficiency of system operation, while the code in stage2 is usually implemented in C language to achieve more complex functions and achieve better code readability and portability.
In stage1, the Bootloader mainly completes the following tasks:
Project Fund: National Natural Science Foundation of China (50678099)
(1) Basic hardware initialization.
(2) Prepare RAM space for loading stage2.
(3) Copy stage2 to RAM space.
(4) Set the stack pointer sp to prepare for executing the C language code of stage2.
In stage 2, the Bootloader mainly completes the following tasks: (1) Jump to the main entry function in assembly language. (2) Initialize the hardware devices to be used in this stage. (3) Check the system's memory map. (4) Load the kernel image and the root file system image. (5) Set the kernel startup parameters.
The Bootloader selected in this platform is U-Boot (Universal Bootloader), which is an open source project that complies with the terms of the GPL. Its source code directory and compilation format are very similar to the Linux kernel. In fact, many U-Boot source codes are simplified versions of the corresponding Linux kernel source programs, especially the drivers of some devices, which can be reflected in the comments of the U-Boot source code. So far, U-Boot has the most extensive support for PowerPC series processors and the most complete support for Linux.
Download the latest version of U-Boot from http://sourceforge.net/projects/u-boot. Before porting, you need to carefully read the readme file in the u-boot directory, which briefly introduces how to port. In order to reduce the workload of porting, you can select a development board that is the same or similar to the hardware to be ported in the include/config directory. According to the configuration of the hardware platform and referring to the existing source code, modify and configure the configuration file, such as modifying and configuring FLASH information, SDRAM information, network configuration, processor configuration, interrupt, development version parameter settings, etc. Then use the make command to generate an image file, download it, and burn it into FLASH.
2.2 Loading and compiling the Linux kernel in a cross-compilation environment
2.2.1 Establishing a cross-compilation environment
Cross-compilation refers to the compilation method of applying the executable program compiled on the host system to run on the target system when the architecture and operating system of the host system and the target system are incompatible. Embedded systems are usually resource-constrained systems, so it is difficult and sometimes even impossible to write software directly on the hardware platform of embedded systems. Therefore, it is necessary to establish a cross-compilation environment and download hybus-arm-linux-R1.1.tar.gz to the /usr/local directory. [page]
# cd usr/local
# tar zxvf hybus-arm-linux-R1.1.tar.gz
Generate the hybus-arm-linux-R1.1 directory, and then modify and add the following path under /root/.bash_profile:
PATH=$PATH:/usr/local/ hybus-arm-linux-R1.1/bin
export PATH
At this point, the cross-compilation environment is established.
2.2.2 Loading and compiling the Linux kernel
The kernel of the Linux system adopts a single-block structure, which can dynamically load and unload modules. The system can easily add new components to the kernel or unload kernel components that are no longer needed by using the dynamic loading and unloading functions of the kernel module. The dynamic loading of the kernel module keeps the size of the kernel image to a minimum and has maximum flexibility. It is also convenient to test new kernel codes without recompiling the kernel and rebooting. Therefore, users can build their own private kernel according to the needs of their own systems. The disclosure of its source code makes it possible to modify its kernel, especially to rebuild operating systems with special requirements. The release of Linux kernel versions is not synchronized with the development of Linux's support for embedded processors. Therefore, it is necessary to select a suitable kernel for a specific processor architecture. In this article, the 2.4.18 kernel version is selected and the patched kernel resource linux-2.4.18-rmk7.tar.bz2 is downloaded.
# tar jxvf linux-2.4.18-rmk7.tar.bz2
# cd linux-2.4.18-rmk7
# make menuconfig
# make dep
# make zImage
After completion, the image file zImage is generated in the arch/arm/boot path, downloaded to the development platform and burned into FLASH.
2.3 Configuring the root file system
Linux does not use device identifiers (such as device numbers or drive names) to access individual file systems. Instead, it accesses the entire file system through a hierarchical tree structure that represents the entire file system as a single entity. A root file system needs to contain all the files that support the operation of the Linux system, usually including:
(1) Basic file system structure.
(2) Basic directories: /dev, /proc, /bin, /sbin, /etc, /tmp, etc.
(3) Basic tools: sh, ls, cp, cd, mv, etc.
(4) Basic configuration files: rc, inittab, fstab, etc.
(5) Devices: /dev/hd*, /dev/tty*, /dev/fd0, /dev/ram*, /dev/console, etc.
(6) Basic runtime library. [page]
To create a root file system, you can use the BusyBox tool and download the latest version busybox-1.1.0.tar.gz from the Internet. Some main steps are as follows:
#tar zxvf busybox-1.1.0.tar.gz
#cd busybox-1.1.0
#make menuconfig
Under the build options menu, you can choose the static library compilation mode
[*]Build BusyBox as a static binary (no shared libs)
You also need to use the cross-compiler arm-linux-gcc with glibc library support
[*]Do you want to build BusyBox with a Cross Compiler?
/usr/local/hybus-arm-linux-R1.1/bin/arm-linux-
Select the installation path in installation Options, the default is _install directory
[*]Don't use /usr
(./_install)BusyBox installation prefix
After that, you can compile BusyBox by selecting some required compilation commands.
#make dep
#make
#make install
After completion, the _install directory is generated, under which there are bin, linuxrc and sbin directories. The following describes further configuration of the root file system:
Create etc directory
#mkdir etc
Create an rc file with the following content:
#!/bin/sh
hostname XScale
mount -t proc proc /proc
cat /etc/motd
Change rc properties
#chmod 777 rc
Create an inittab file, the main contents are as follows:
::sysinit:/etc/init.d/rcS
::askfirst:/bin/sh
tty1::respawn:/sbin/getty 38400 tty1
tty2::respawn:/sbin/getty 38400 tty2
::restart:/sbin/init
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
::shutdown:/sbin/swapoff -a
In the init.d directory, create a symbolic link file rcS[page] for the rc file
#ln -s ../rc rcS
Create a dev directory and create device files. You can use the mknod command to create them, or you can copy some required device files in the host platform's /dev directory to the /_install/dev directory.
Make a JFFS2 file image in the busybox-1.1.0 directory
#./mkfs.jffs2 -o newfs.img -e 0x40000 -r _install -p -l
Generate the image file newfs.img, download it and burn it into FLASH.
3 Conclusion
This paper builds an embedded Linux application platform based on the Intel XScale PXA255 processor and the Linux operating system. It mainly analyzes the functional characteristics of the Bootloader and the production of the Bootloader image, the characteristics of the Linux system, and the loading and compiling of the Linux kernel in the cross-compilation environment. Finally, it introduces the implementation of a streamlined root file system that supports the operation of the Linux system.
The author's innovation is: using BusyBox, he introduced in detail the implementation process of streamlining the root file system on the PXA255 processor. By using the XScale processor with powerful interface functions and the stable Linux operating system to build an embedded Linux application platform, the development difficulty is reduced and the reliability, stability and maintainability of the application platform are greatly improved. Programs can be written as needed to use the development board for actual industrial applications.
References:
[1] Sun Qiong. Detailed Explanation of Embedded Linux Application Development[M]. Beijing: Posts and Telecommunications Press, 2006
[2] Xia Weiwei, Shen Lianfeng, Xiao Jie, et al. Analysis and development of key technologies for embedded systems [J]. Industry Forum, 2003, (2): 5-9.
[3] SARWAR. A1. SAGABI. Basic Tutorial of LINUX&UNIX Program Development[M]. Translated by Ying Yu and Yao Feng. Beijing: Tsinghua University Press, 2004.
[4] Ying Haiyan. Embedded Linux operating system porting based on ARM[J]. Modern Intelligence, 2005, (5): 155-156.
[5] Karim Yagbmour. Building embedded Linux system[M]. O'Reilly & Associates, Inc. 2003
[6] Bai Weiping, Bao Qiliang. A brief analysis of embedded bootloader based on ARM[J]. Microcomputer Information, 2006, 4-2:99-100.
Previous article:Research on the Construction of Embedded Lightweight Agent Platform
Next article:Aircraft refueling statistics system based on QR Code barcode
Recommended ReadingLatest update time:2024-11-16 23:55
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
- Sell an unused Jiuxintaike oscilloscope and get a Guwei desktop multimeter for free
- MSP430F1232 external 4M crystal oscillator cannot start
- Appreciation of TR components of early warning aircraft radar
- Q: How do you determine the inductance value when selecting a common-mode coil?
- What does BMS device learning and chemical ID mean?
- [NUCLEO-L452RE Review] + Simple Digital Voltmeter
- Gaoyun FPGA various manuals
- [2022 Digi-Key Innovation Design Competition] ESP32S2 Lighting
- PCB connector connection method
- Application Note: High Voltage Floating MOS Gate Driver ICs (Part 1)