Linux system porting key points

Source: Internet
Author: User

1. Build the boot loader compiling environment
Step 1: Before compiling the boot loader, you must first ensure that the cross-compilation tool chain has been installed. You can use the which arm-Linux-GCC command for detection.

In the/mnt/CDROM/toolchain directory, extract the xscalev1_liod_qt_2.3.7.tar.gz tool chain to the/usr/local/directory, as shown in figure 2.
Step 3: Use the Export command to add the path of the Cross-compilation tool to the system path environment variable. (You can also directly modify the ". bash_profile" file under the "root" directory)

Then, use the which command to check whether the cross-compilation tool is in the system search path.
Use the make command to compile the source code in the directory where the Blob source code is located. After the compilation is successful, the Blob image file boot is generated in the directory.

In short, install the compilation tool chain, import environment variables, modify the uboot source code, and configure some necessary hardware parameters, such as the system clock signal, SDRAM memory enabling, and peripherals:

Gpio, serial port, Flash, network port, and SDRAM.

2. Modify arch and cross_compile In The makefile.
Modify the top-level MAKEFILE file under the linux-2.6.22.10 directory and set the CPU architecture variable arch for compiling the Linux operating system and the Cross-compilation tool chain variable used

Cross_compile (Note: The experiment uses the arm-Linux cross-compilation tool chain 4.2.1, which can be downloaded from http://ftp.snapgear.org/pub/snapgear/tools/arm-linux/

Arm-linux-tools-20070808.tar.gz compressed files ).
Now the arm-Linux-tool chain has been decompressed in the/work/usr/bin directory.
Copy the ARCH/ARM/Mach-PXA/xsbase270.c file of the linux-2.6.22.10 to the/ARCH/ARM/Mach-PXA/directory under the linux-2.6.22.10 directory, and modify

MAKEFILE file, as shown in the video. And modify the kconfig file in the directory.
Run the drivers/MTD/maps flash driver source code and modify the makefile and kconfig files in the directory.
3. File System Creation
(1) busybox Introduction
Busybox is the first Development of Debian GNU/Linux famous Bruce perens, mainly used in Debian installation programs. Later, many Debian developers contributed to busybox. Busybox is compiled into an independent execution program called busybox, which can execute the ash shell function and dozens of small applications according to the configuration. This includes a mini VI Editor, an indispensable/sbin/INIT program in the system, and other such as SED, ifconfig, halt, reboot, mkdir, mount, LN,
Ls, Echo, cat, and so on, all of which are essential to a normal system. However, if you take the original program, the size cannot be borne by an embedded system. Busybox has all these functions, and the size is only about 100 K. In addition, you can configure and select busybox application functions as needed. In this way, the busybox size can be further reduced.
Busybox supports multiple architectures. It can be statically or dynamically linked to the glic or uclibc library to meet different needs. You can also modify the default compilation configuration of busybox to remove the support for commands you do not want to use.
(2) Compilation of busybox
Step 2. Download The busyboxsoftware package from the Internet. The download is busybox-1.15.0tar.tar. First, put it in the/root/xsbase270_linux/filesystem directory and decompress it.
You can configure the function options of the file system as needed to reduce the size of the file system and save storage space ,.
After compilation and installation, the _ install directory is generated. In addition, we can see the bin, sbin, and usr directories. In these three directories, we can see a busybox application and many symbolic links, we can also see that all these symbolic links point to the busybox application.
2. Configuration File System
Create the etc directory under _ install:
[Root @ localhost _ install] # mkdir etc
Next we will create three files, RC, inittab, and motd, respectively under this etc.
Enter the newly created etc and run the "vi rc" command to create the RC file:
#! /Bin/sh
Hostname emdoor
Mount-T proc/proc
CAT/etc/motd
Save and exit. Run the CHMOD command to change the attributes of the RC file.
[Root @ localhost etc] $ chmod 777 RC
Create an inittab file under etc with the following content:
: Sysinit:/etc/init. d/RCS
# Start an "askfirst" shell on the console (whatever that may be)
: Askfirst:/bin/sh
#/Sbin/Getty invocations for selected TTYs
Tty4: respawn:/sbin/Getty 38400 tty5
Tty5: respawn:/sbin/Getty 38400 tty6
# Example of how to put a Getty on a serial line (for a terminal)
#: Respawn:/sbin/Getty-l ttys0 9600 VT100
#: Respawn:/sbin/Getty-l ttys1 9600 VT100
#
# Example how to put a Getty on a modem line.
#: Respawn:/sbin/Getty 57600 ttys2
# Stuff to do when restarting the INIT process
: Restart:/sbin/init
# Stuff to do before rebooting
: Ctrlaltdel:/sbin/reboot
: Shutdown:/bin/umount-a-r
: Shutdown:/sbin/swapoff-
Create a motd file under etc.
Welcome
==========================================================
ARM-LINUX world
==========================================================
Base on: Xsbase270-EDR
Partner: emdoor (www.emdoor.com)
Create the init. d directory under etc, and then create the RC file's symbolic connection file RC under the init. d directory.
[Root @ localhost etc] $ ls
Inittab motd RC
[Root @ localhost etc] $ mkdir init. d
[Root @ localhost etc] $ CD init. d
[Root @ localhost init. d] $ ln-S ../RC RCS
Create the dev directory under _ install and create the device file. In this experiment, some device files are required, such as the console of the system console and mdblock3 Of The MTD block device. You can use the mknod command to create these files.
# Mknod console C 5 1
# Mknod mdblock3 B 31 3
In addition to the mknod command, you can also copy some necessary device files under the/dev directory of the host platform/root/xsbase270_linux/filesystem/busybox-1.00-pre5/_ install/dev directory:
# Cp-DPR/dev/*/root/xsbase270_linux/filesystem/busybox-1.00-pre5/_ install/dev
-The DP parameter indicates that the link file remains unchanged during the copy process, but the original file referred to by the link is not copied, and the attributes remain unchanged, and unnecessary device files are deleted.
Create a jffs2 file Image
Copy mkfs. jffs2 under the filesystem of the CD to buybox.
Return to the root directory of busybox and run the command mkfs. jffs2.
#./Mkfs. jffs2-O rootfs270.img-E 0x40000-R _ install-P-l
Generate the image file rootfs270.img, copy it to/tftpboot, and burn it to flash. Run the result after startup.

 

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.