With the development of information technology, embedded system technology has been widely used in many fields such as national defense, communications, industrial control, and consumer electronics. Among them, Linux, as an open source, mature, efficient and stable multi-tasking operating system, has many incomparable advantages and has become the most potential embedded operating system at present. As we all know, building the root file system is crucial for embedded Linux development. It is the first file system loaded after the kernel is started, and is the key to determining whether the system can start normally. During the development phase, programs often require repeated debugging. In view of this, it is particularly important to build a root file system based on NFS (Network File System); this eliminates the need for repeated programming of the target development board and facilitates online debugging. Program changes and debugging. This article is based on Busybox software and introduces a practical method for building an NFS root file system.
1 Introduction to the embedded root file system
When Linux starts, the first thing that must be mounted is the root file system; if the system cannot mount the root file system from the specified device, the system will report an error and exit the startup. After the system starts successfully, other file systems can be mounted automatically or manually.
When storing files in each partition of the Linux system, it needs to follow a certain format. This file format is called a file system type, such as ext2, ext3, ext4, etc. are common. In terms of storage devices, FLASH is a mainstream storage device widely used in embedded systems. It is an electrically erasable non-volatile memory with the advantages of small size, low power consumption and high density. At present, the common file systems in FLASH mainly include Cramfs, Jffs2, Yaffs2, etc. The basic root file directory structure of embedded Linux is shown in Table 1.
2 Introduction to Busybox
Busybox is often called the "Swiss Army Knife" in embedded Linux system development. It combines many commonly used UNIX commands and tools into a single executable program. Although compared with the corresponding GNU tools, Busybox provides slightly fewer functions and parameters, but it is enough in smaller systems or embedded systems. It only uses one executable file to provide the commands required by the basic Linux operating system. It is small in size and easy to configure.
3 Compilation and installation of Busybox
3.1 Development environment
The hardware platform based on Feiling OK-2440Ⅲ adopts S3C2440 chip, and the peripherals include 64 MB SDRAM memory, 128 MB NAND FLASH, and 4 MB NOR FLASH. The development model of host plus target board is adopted. The host system is Fedora12, the kernel version of the target board is Linux2.6.30.4, and the bootloader uses U-boot.
3.2 Configuring Busybox
The source code of Busybox is on the official website www. Busybox. net/download, then unzip and configure and install. The specific steps are as follows:
You should modify the top-level Makefile (ARCH=arm, CROSS_COMPILE=arm-linux-) before executing the make command. You can also flexibly configure Busyhox according to your own needs in make menuconfig. After executing the make install command, three files, bin, sbin, and linuxrc, will be automatically generated in the _install directory of the current directory.
The configuration interface is shown in Figure 1.
4 Building the root file system
4.1 Creating a script file
In order to simplify the operation of building the root file system, first enter the development directory and create a new script file create_myrootfs_bash as follows:
Use the command chmod+x create_myrootfs_bash to change the executable permissions of the file. /create_myrootfs_bash runs the script to complete the creation of the basic root file system directory.
4.2 Create system configuration files inittab, fstab, rcS
4.3 Install dynamic library
If Busybox is compiled using dynamic linking, the loader and link library also need to execute the following commands:
5 NFS installation and configuration
NFS (Network File System) is a distributed file system launched by SUN, which allows users to use files or peripherals on other networked machines as conveniently as using the local machine. Enter setup in the console as root, and select the nfs service in the system service options, as shown in Figure 2.
Configure the shared home directory of the NFS server, paying attention to permission issues:
6 Mount the NFS root file system.
Connect the host and the target development board through the serial port and RJ45 network port, start the Hyper Terminal, and enter the following command:
After the target board is started, it will be displayed in the Hyper Terminal. The results are shown in Figure 3. It can be seen that the NFS root file system has been successfully loaded.
7 Conclusion
summarizes and summarizes the basic methods of using Busybox to create an embedded Linux root file system, and further provides a general method of building an embedded Linux root file system based on NFS. The NFS root file system constructed using this method can be directly used for the development of embedded Linux systems. The development program can be easily changed and debugged in real time, effectively avoiding repeated direct programming of the target development board and improving development efficiency. , shortening the development cycle.
Previous article:Transplantation of DM9000 network card driver based on S3C2440
Next article:Implementing security design of embedded systems using SM2 algorithm chip HS32U2-U
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- About 48V input buck type DCDC chip
- Some characteristics of MSP430 interrupts
- Where is the SD card of sensorTile.box
- Some questions about Bluetooth Mesh
- Read the good book "Operational Amplifier Parameter Analysis and LTspice Application Simulation" for free, take notes, and master the knowledge of operational amplifiers thoroughly
- About the problem of inaccurate reading of MAX6675
- Push-pull circuit
- How can a hybrid hardware engineer who doesn't know embedded programming prove that he has mastered common communication interfaces?
- Women's volleyball team wins 10th consecutive championship ahead of schedule
- EEWORLD University ---- Top 10 Arduino Projects 2020