System Porting Summary

Source: Internet
Author: User

Menu what are the main contents of embedded Linux system porting?

1> Building Cross-development environment

2> Transplant Bootloader

3> porting the Linux kernel

4> making the root file system

First, build a cross-development environment

1, cross-compilation tool chain production (gcc cross compiler Generation)

(1) Download binutils, GCC, glibc source code

(2) Configure and compile binutils get the required assembly and linking program (connector LD, assembler as, mainly for GNU system to provide assembly and connection tools)

(3) Configure and compile GCC source code to generate GCC compilers. (the C compiler is mainly provided for the GNU system)

(4) Configuring GLIBC and compiling the C function library (some basic C functions and other function definitions) generated by glibc

(5) Configure and compile the GCC source code again, generate compiler for other languages, such as C + + compiler (usually C compiler is generated first, then base on this, combine the generated glibc C function library, compile and build other compilers)

"Note" tool chain dependent kernel version

2 Binary Tool binutils

Ld:

As

The objcopy:objcopy is used to convert the target format

Objdump:objdump is used for disassembly.

Strings

Strip:strip is to discard all or specific symbols of the target file, reducing the file volume

addr2line: addr2line is used to convert the program address to the file name and line number.

Ar:ar is used to generate a static library for the target file.

3. Configure the software required by the host Party

(1) TFTP server

The simplest network protocol that TFTP uses to download remote files, based on the UDP protocol implementation

(2) Server for NFS

The main local directory through the network output, other computers can remotely hook up this directory and access.

NFS has its own protocols and ports, but NFS uses remote procedure call Protocol (RPC) when file transfer or other related information is passed, and RPC manages the corresponding service-related work for the port number. NFS itself does not have a protocol to transfer files.

Two, U BOOT

The Uboot architecture prior to version 2010.08 was simpler, and the later version architecture became more complex.

1. What is bootloader and what is its role? List of the bootloader commonly used in three types of ARM platforms

(1) bootloader is a piece of code that runs first when the system is power-up or reset.

(2) Role: The software and hardware of the system to do the corresponding initialization, for the operating system load run ready.

(3) Bootloader:u-boot, Redboot, blob, and vivi commonly used by arm platforms

2. Describe the U-boot startup process

The U-boot launch is divided into two stages:

The first stage is implemented in a compilation. Set interrupt vector table, set SVC mode, interrupts, and clock

Turn off the watchdog, MMU, and cache-> Initialize memory controller, auto-move, set up stack, empty BSS segment

The second phase is implemented in C. Initialize flash devices and environment variables, called a series of initialization functions

Initializing network devices, entering loops

3. Uboot transplantation (1) The important directories in uboot transplantation."90% of the transplants are in the following 6 directories"A. Platform-related (important, related to the system can not start normally, can be used)/board/cpu/lib_arm/includeB. Platform-independent (sub-important, functional is complete, related to uboot support commands ...) such as: ping command Support) General/common/drivers/include (2) uboot migration Process A. Modify makefile to increase the path of the cross-compilation toolchain: cross_compfile:= b.make CLE An (pre-purge compilation) c. Configuring Uboot (privatization, making corresponding modifications to the board to be ported) D. Compile Uboot make some files (three main concerns) Uboot (elf file), Uboot.bin (binary file), System.map ( Symbol mapping table) 4.Uboot related knowledge points:

(1). The way of bootloader to the kernel is param_struct and tag.

(2) in the U-boot command, the command to set the environment variable is setenv

(3) the environment variable that holds the kernel boot parameter in U-boot is Bootargs

(4) Linux requires the system to enter the SVC mode before running the kernel bootloader

(5) Linux requires bootloader to save the platform number in R1

5.uboot

Uboot countdown, determined by the self-startup script

Bootargs: Select startup mode

cross-debugging: Gdb_server ( in the cross-compiler tool chain)

CP to the NFS Mount path,

Third, the Linux kernel porting

1. Kernel concept

2. Functions (five tasks of the Linux kernel)

Process management, memory management, file system support, device management (drivers), network protocols

3. Organizational Structure

4. Configuration kernel (kernel cropping: Make Menuconfig)

(1) Top floor Makefile

(2) Kconfig (Crop menu option source, add delete option)

(3) arch/arm.../mach/... Board Level information

(4) ARCH.../SMDKC100.C board level drive configuration information

5. Compile kernel (make zimage)

6. Add Driver

(1) Network card

(2) LED

(3) NAND partitioning

(4) SD Card

(5) LCD

7, may test the face question

What is preserved and what is cropped when I configure the kernel?

The pre-development mode of the project is the way of NFS mount, all the NFS services are configured, the driver of DM9000 is configured, it is convenient for tftp to download, the ZigBee module and GPRS module are used in the main control end of the project, so the USB to serial port drive is configured separately. The SPI driver is not used in the project, so this part is cropped.

"Note" Make Zimage: Compile a portable image of the build kernel

Make modules: A section in the form of M control to compile

8.linux Kernel boot process

(1) Bootloader:

A. Hardware power up and jump to a fixed location to execute the corresponding code

B. Initialize the appropriate device

C. Load the kernel's code into memory

D. Jump to Kernel code start location execution

(2) Kernel

A. Kernel self-extracting

B. Initialize the driver module statically compiled into the kernel (requires access to ROOTFS)

C. Mount the ROOTFS (Programs that require access and run user space)

D. Direct execution of the first user-space program

(3) First User space program

Configure user environment, execute service process

9.linux Debugging Kernel Method Introduction

When the console is initialized, the simplest kernel debug mode is : PRINTK

PRINTK supports several print levels?

8 species (0~7)

Ten. Linux-related knowledge points (1) During kernel boot, if terminal "ERROR:A" error occurs, the reason may occur: The kernel does not support the current development platform (2) kernel boot process, if the terminal appears "Error:p" error, This may occur because the kernel does not support the current processor (3) after the kernel decompression, the console initializes the previously used function is: printascii

11, kernel-related issues:

(1) Compile kernel image command make Zimage

command to compile the module make modules

(2) What is the default kernel configuration file that should be used when configuring the kernel for the first time?

Arch/arm/configs/s5pc100_defconfig

(3) What is the file that holds the platform code (full path)?

Arch/arm/mach-s5pc100/mach-smdkc100.c

(4) which file does the kernel unzip after the entry?

Arch/arm/kernel/start. S

Iv. Production of Rootfs

1. Concept

A variety of software packages can also be installed to store the various tools, library files, scripts, configuration files, and other special files necessary to run and maintain the system.

2.ROOTFS production process

(1) Create basic commands with Bubybox

(2) Create a basic directory/lib/etc/var/tmp/dev/sys/proc, etc.

(3) Add glibc basic Dynamic Library

(4) Create a basic device node

(5) Add startup configuration and scripts (general etc with this four files)/etc/inittab/etc/fstab/etc/init.d/rcs

Another file profile can also be added to store environment variables.

Inittab: Defines a variety of action.

For example, when making a root file system with BusyBox, if you need to press ENTER before program execution to confirm, add Action:askfirst "

"The first script called by the Rcs:init process

Generally there will be mount-a (mount all content under Fstab) "

(6) Testing the root file system

(7) Make root file system image, such as RAMDisk Cramfs JFFS2 ...

4. root file system features

(1) The first file system mounted by the kernel,

(2) The first initialization program init, commands, device nodes, configuration files, shared libraries, etc. that are stored on the root file system with the kernel running

(3) Only one root file system can be found in the system

(4) Embedded Linux systems typically build file systems with the Bubybox toolset to reduce system volume

5.init process

(1) Ancestor process of all processes

(2) parent process of all orphan processes

6. Different file system differences

(1) YAFFS2, JFFS2 file system can be run on NAND flash, and have read and write characteristics

(2) Cramfs file system can be run on NAND flash with read-only feature

(3) TMPFS file system that does not occupy any disk space

Ubifs file systems for high-capacity disks.

YAFFS,YAFFS2 difference: yaffs by small page access, YAFFS2 by large page access.

The Yaffs file system has a fatal bug that scans the entire disk at boot time, which is slow and time consuming. Therefore, it is suitable for small capacity disks (below the gigabit level).

System Porting Summary

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.