Construction of embedded Linux application platform based on PXA255

Publisher:古泉痴迷者Latest update time:2012-03-22 Source: 微计算机信息 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Reference address:Construction of embedded Linux application platform based on PXA255

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

Analysis of Bootloader Source Code of ARM7 LPC2210
Analyze and interpret the Bootlaoder written by Chenmingji for Zhou Ligong's development board EasyARM LPC2210 development board. 1. Variable (constant) declaration     First declare           the stack size;     define the stack size     SVC_STACK_LEGTH EQU 0     FIQ_STACK_LEGTH EQU 0     IRQ_STACK_LEGTH EQU 25
[Microcontroller]
MC9S12XS128MAL Bootloader (1)
First of all, BootLoader and user program are two projects. The codes of the two projects are stored in different flash by modifying the PRM file, and the switching between the two projects is realized by jumping the PC pointer. BootLoader Disable interrupts Initialize the clock; Initialize CAN Initialize flash re
[Microcontroller]
TKScope simulation/burning BootLoader method
  In the development of ARM9 core, burning and simulating BootLoader program has always been a headache for R&D engineers. The reason is that there is no efficient BootLoader download program and simulation to imitate BootLoader loading. Therefore, the debugging and development efficiency of the entire BootLoader is
[Microcontroller]
TKScope simulation/burning BootLoader method
mini2440 u-boot linux kernel boot,Mini2440 uboot,kernel,root file system construction
According to the manual of mini2440, I have learned that the construction process of uboot, kernel and root file system is as follows. The specific details are not considered for the time being, only the entire compilation and burning process is considered. First of all, our host machine must have nfs server and tft
[Microcontroller]
OK6410A Development Board (VIII) 8 linux-5.11 OK6410A Detailed analysis of the start_kernel runtime stack
include/asm-generic/vmlinux.lds.h  376 #define INIT_TASK_DATA(align)                                                     377     . = ALIGN(align);                                                             378     __start_init_task = .;                                                        379     init_thread_unio
[Microcontroller]
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号