Create and port a small Linux System Based on 2.6.19

Source: Internet
Author: User

The combination of arm9-s3c2410 microprocessor and Linux is getting closer and closer, and has been widely applied in the embedded field. Currently, the combination of S3C2410 and Linux can be seen in portable consumer electronic products, wireless devices, automobiles, networks, and storage products.

The S3C2410 microprocessor is a low-cost, low-power, high-performance, ARM920T-core microprocessor designed by Samsung for handheld terminals. It has a memory management unit (MMU) and adopts a 18mm MPa process and a new AMBA bus structure. The clock speed can reach 203 MHz. At the same time, it supports the Thumb 16-bit compression instruction set, so as to get 32-bit system performance with a small storage space.

Among the many embedded operating systems, Linux is currently the fastest growing and most widely used [1]. Linux with excellent performance and open source code has many advantages such as small size, reduced kernel, improved network functions, and high portability. It is very suitable for Embedded operating systems. A basic Linux operating system includes three parts: boot program, kernel, and root file system.

Compared with the Linux2.4 kernel, the 2.6 kernel incorporates the latest technology and greatly improves performance, testability, device support, and availability; supports more architectures, processors, buses, interfaces and devices, standardizes internal interfaces, and simplifies the process of expanding or adding new devices.

This article focuses on how to create a small Linux operating system based on the linux-2.6.19 kernel and port it to the S3C2410 open board. The content includes the establishment of the Cross-compilation environment, boot program, 2.6.19 kernel, modification, configuration, compilation, and transplantation of the root file system.

◆ System creation and Transplantation

Build a cross-compilation environment

To port and develop a small Linux system, you must first configure the cross-development environment on the host with RedHat9 or a later version of Linux. Cross-development refers to the installation of development tools on the Development host to edit and compile the boot program, kernel, and file system of the Target Board so that it can run on the target board.

For this development, the need to install arm-linux-gcc-3.4.1 and armv4l-tools tool chain. After installation, add the two paths to the system PATH $ PATH.

Bootstrap program

For computer systems, a boot program is required from power-on to operating system startup. Embedded linux systems are also inseparable from boot programs, which are called Bootloader [1]. Through this applet, You can initialize hardware devices and create a memory space ing table to establish an appropriate system hardware environment and prepare for the final call of the operating system kernel.

Vivi [4] is a Bootloader developed by South Korean MIZI for its arm9-series products. It is small and smart. Here we use it as the Bootloader for small Linux systems.

First, modify the Flash partition information in the vivi source code. The new partition information is shown in table 1.

According to table 1, modify the parameters in the vivi source code arch/s3c2410/smdk. c file.

Then, import the default configuration of smdk2410 in the configuration menu. After compilation is successful, the required Bootloader file will be generated in the vivi source code directory, with the file name vivi.

Then, you can download vivi to the corresponding position of the target board Flash.

◆ Kernel

Modify the kernel
First, modify the Makefile file under the kernel source code linux-2.6.19, specify the target code type and compiler: SUBARCH: = arm; CROSS_COMPILE: =/usr/local/arm/3.4.1/bin/arm-linux -.

Then, modify the Flash partition information in the kernel based on table 1 in the linux-2.6.19/arch/arm/mach-s3c2410/common-smdk.c. This reminds the reader that there is no Flash partition information in the kernel source code before 2.6.16 (inclusive), so new partition information needs to be added. In 2.6.17 (inclusive) later, the source code of the kernel contains the Flash partition information. All you need is to modify the partition information.

The Flash partition information of the kernel must be consistent with the Flash partition information of vivi. Because the address in the Flash partition of vivi is the real address downloaded from the kernel and file system to Nand flash, while the address set by the kernel Flash partition is read at startup, if the two are different, it is likely that the kernel cannot be started normally or the file system is read.

Finally, modify the linux-2.6.19/drivers/mtd/nand/s3c2410. c, disable the Nand flash Error Detection: chip-> eccmode = NAND_ECC_NONE ;.

Kernel configuration Compilation

In the configuration menu, import the default configuration of smdk2410, and then select the required function. Such as support for Nand Flash and MTD devices and Cramfs file systems.

After the configuration is complete, enter the compile command "make" on the terminal to compile. If the kernel source code is compiled successfully, the kernel image file zImage will be generated under the linux-2.6.19/arch/arm/boot.

Finally, use the download command in the vivi command prompt mode to load the kernel image zImage to the appropriate address in the Development Board Flash.

◆ Root file system

Files and devices in Linux are organized through the file system. The existence of a file system enables effective and transparent access to data and devices. The simplest root file system of a linux system should include the basic content that supports normal operation of the linux system, including the software and libraries used by the system, and all the architectures and commands used to provide basic support for users.

Create a series of necessary directories, such as bin, dev, etc, lib, proc, sbin, root, and tmp, under the root file directory rootfs, place the required configuration files and dynamic function libraries in the corresponding directory. BusyBox is a good way to narrow down the root file system. BusyBox integrates the most common linux commands and applications with a very small volume, greatly simplifying the process of creating a linux root file system.

One thing to note is that the kernel before 2.6.12 (inclusive) usually uses devfs to manage all Block devices and character devices located under/dev, but in 2.6.13 (inclusive) later kernels do not support devfs, but switch to udev to manage the devices under/dev. For details, see [5]. Therefore, for Kernel 2.6.19, to enable the system to enter the BusyBox console after startup, you also need to add the console device file under/rootfs/dev: "[root @ localhost dev] # mknod-m 600 console c 5 1 ".

Currently, linux supports dozens of File System formats, such as Cramfs, Jfss2, and Yaffs. Cramfs is a read-only Flash file system that can protect the basic settings of the system from being changed. The root file system uses the Cramfs format.

Use the Cramfs tool mkcramfs to create the root file directory as an image file: rootfs. cramfs.

After the root file system is created, download rootfs. cramfs to the appropriate Flash location in vivi command mode.

So far, a small Linux System Based on the 2.6.19 kernel has been successfully created and transplanted to the S3C2410 Development Board.

After the Board is powered on, you can see the system startup information and enter the BusyBox console.

◆ Conclusion

Linux based on the 2.6 kernel has a broad application world in the embedded field by combining its outstanding embedded features with the excellent performance of arm9-s3c2410. This article describes how to create a Linux system based on the Linux 2.6.19 kernel and port it to the S3C2410 Development Board. The creation and Transplantation of small systems is the basis for embedded development and must be mastered.

Related Articles]

  • How to Use Gdb to remotely debug the program on the ARM Board
  • Memory Management Methods in Linux Embedded Systems
  • Out-of-the-box Linux and Embedded System Applications

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.