Construction and research of embedded Linux NFS root file system

Publisher:爱笑的猫咪Latest update time:2022-12-20 Source: 21icKeywords:Embedded Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

a.jpg



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:
b.jpg

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.

g.jpg



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:
c.jpg
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
d.jpg
4.3 Install dynamic library
If Busybox is compiled using dynamic linking, the loader and link library also need to execute the following commands:
h.jpg

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.

i.jpg


Configure the shared home directory of the NFS server, paying attention to permission issues:
k.jpg

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:
l.jpg
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.

j.jpg



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.


Keywords:Embedded Reference address:Construction and research of embedded Linux NFS root file system

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

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号