How to make a small Linux based on linux 2.6.19 kernel...
The combination of ARM9 S3C2410 microprocessor and Linux is getting closer and closer, and it is gradually being widely used in the embedded field. At present, the combination of S3C2410 and Linux can be seen in portable consumer electronics, wireless devices, automobiles, networks, and storage products.
The S3C2410 microprocessor is a low-cost, low-power, high-performance microprocessor based on the ARM920T core designed by Samsung for handheld terminals. It has a memory management unit (MMU), adopts 0.18mm technology and AMBA new bus structure, and its main frequency can reach 203MHz. At the same time, it supports Thumb 16-bit compressed instruction set, which can obtain 32-bit system performance with a smaller storage space.
Among many embedded operating systems, Linux is currently the fastest growing and most widely used. Linux with excellent performance and open source code has many advantages such as small size, reduced kernel, perfect network functions, and strong portability. It is very suitable as an embedded operating system. A basic Linux operating system should include three parts: the boot program, the kernel, and the root file system.
Compared with the Linux 2.4 kernel, the 2.6 kernel absorbs the latest technology and has greatly improved performance, scalability, device support and usability; supports more architectures, processors, buses, interfaces and devices; Standardize the internal interface; simplify the steps of expanding or adding new equipment, etc.
This article focuses on how to make a small Linux operating system based on the linux-2.6.19 kernel and transplant it to the S3C2410 open board. The content includes the establishment of the cross-compilation environment, the modification, configuration, compilation, and transplantation of the boot program, the 2.6.19 kernel, and the root file system.
System production and transplantation
Build a cross-compilation environment
To transplant and develop a small-scale Linux system, you must first configure a cross-development environment on the host installed with RedHat9 or higher version Linux operating system. Cross-development refers to installing development tools on the development host, editing and compiling the boot program, kernel and file system of the target board so that it can run on the target board.
For this development, you need to install arm-linux-gcc-3.4.1 and armv4l-tools tool chain. After the installation is complete, remember to add the paths of the two to the system path $PATH respectively.
Bootloader
For a computer system, a boot program is required from power-on to the operating system startup. Embedded linux system is also inseparable from the boot program, this boot program is called Bootloader [1]. Through this small program, hardware devices can be initialized and a mapping table of memory space can be established, thereby establishing an appropriate system hardware environment and preparing for the final invocation of the operating system kernel.
vivi [4] is a Bootloader developed by South Korea's MIZI company for its ARM9 series products. It is small and smart. Here, it is chosen as the Bootloader of a small Linux system.
First, modify the Flash partition information in the vivi source code. The new partition information is shown in Table 1.
According to Table 1, make corresponding changes in the vivi source code arch/s3c2410/smdk.c file.
Then import the default configuration of smdk2410 in the configuration menu. If the compilation is successful, the required Bootloader file will be generated in the vivi source code directory, the file name is vivi.
Then, you can download vivi to the corresponding location of the target board Flash.
Kernel
Modify the kernel
First, modify the Makefile under the kernel source linux-2.6.19 to 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 according to Table 1 in linux-2.6.19/arch/arm/mach-s3c2410/common-smdk.c. The reader is reminded here that there is no Flash partition information in the kernel source code before 2.6.16 (including), so new partition information needs to be added; and after 2.6.17 (including) the kernel source code already contains Flash partition information, all that is needed is Modify partition information.
The kernel Flash partition information must be consistent with the vivi Flash partition information. Because, the address in the vivi Flash partition is the real address of the kernel and file system downloaded to the Nand flash; while the kernel reads the address set by the kernel Flash partition when it starts; therefore, if the two are different, it is likely to cause Cannot start the kernel or read the file system normally.
Finally, modify linux-2.6.19/drivers/mtd/nand/s3c2410.c to prohibit Nand flash error detection: chip-》eccmode = NAND_ECC_NONE;.
Kernel configuration compilation
Import the kernel's default configuration of smdk2410 in the configuration menu, and then select the required functions on this basis. Such as Nand Flash and MTD device support, Cramfs file system support, etc.
After the configuration is complete, enter the compiling command "make" in the terminal to compile. If the kernel source code is compiled successfully, the kernel image file zImage will be generated under linux-2.6.19/arch/arm/boot/.
Finally, use the download command in vivi command prompt mode to load the kernel image zImage to the appropriate address in the development board Flash.
Root file system
The files and devices in the Linux system are organized through the file system. The existence of the file system allows data and devices to be accessed efficiently and transparently. A linux minimal root file system should include the basic content that supports the normal operation of the linux system, including the software and libraries used by the system, as well as all the architectures and instructions used to provide basic support for users.
Create a series of necessary directories such as bin, dev, etc, lib, proc, sbin, root, tmp, etc. under the root file directory rootfs, and put the required configuration files and dynamic function libraries in the corresponding directories. Using BusyBox is a good way to shrink the root file system. BusyBox integrates the most commonly used Linux commands and applications in a small volume, which greatly simplifies the process of making a Linux root file system.
One thing that must be pointed out is that the kernel before 2.6.12 (inclusive) usually uses devfs to manage all block devices and character devices located under /dev; but the kernel after 2.6.13 (inclusive) no longer supports devfs , And switch to udev to manage the devices under /dev, see [5] for details. Therefore, for the 2.6.19 kernel, if you want to enter the BusyBox console after the system boots, you need to add a console device file under /rootfs/dev: "[root@localhost dev]# mknod -m 600 console c 5 1".
At present, Linux has been able to support dozens of file system formats, such as commonly used Cramfs, Jfss2, Yaffs, etc. 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 production tool mkcramfs to make the root file directory into an image file: rootfs.cramfs.
After the root file system is made, download rootfs.cramfs to a suitable location in Flash under vivi command mode.
So far, a small Linux system based on the 2.6.19 kernel has been successfully produced and ported to the S3C2410 development board.
After the board is powered on, you can see the startup information of the system, and finally enter the BusyBox console.
Conclusion
Based on the 2.6 kernel, Linux has a broad application space in the embedded field by combining its outstanding embedded features with the superior performance of ARM9 S3C2410. The article introduces how to make a small Linux system based on the Linux2.6.19 kernel and transplant it to the S3C2410 development board. The production and transplantation of small systems is the basis for embedded development and must be mastered skillfully.
LED Flashing Badge (LED Flashing pin)
Ningbo AST Industry Co.,Ltd has 17 Years Experiences to produce the Flashing Led Badge, Led Pins, Led Flashing Pins, Led Badges, Flashing Led Badges and so on .we can assure you of competive price,high quality,prompt delivery and technology supporting.
1. Flashing Led Badge Application:
The Led flashing Badges are usually used for Celebration,Party ,Warning and so on.
2.Press the play button to flash.
3.Led quantity and Led color:Customized.
4.Can be printed your logo on it
6.Certification:CE ,Rohs
7.Export to:
USA, UK,Canada,Germany, Turkey,Russia,Poland,Switzerland,Netherland ,Frence Hungary ,Australia,New Zealand, Brazil, Columbia,Argentina,Thainland,Singapore , Malaysia and so on.
|
|
LED Flashing Badge, LED Flashing pin, Customizable led pin
AST Industry Co.,LTD , https://www.astsoundchip.com