The production of ARM Development Board system transplant-----ROOTFS

Source: Internet
Author: User

The previous two articles respectively introduced the MINI2440 Development Board to run the bootloader and kernel, to here after the system is actually stuck in a "zombie" state---Unable to mount the root file system.

Here's how to make a root filesystem and mount it to the kernel---that allows the kernel to access directories and files in the file system. From the user's point of view, the file system is nothing more than directories and files, note that these directories and files can exist in memory, or can exist in NAND flash or nor flash, depending on the specific file system. This paper introduces the concept of file system by using memory-based Initram and network-based NFS file system as examples.

First, what is a file system? As far as I understand it, it is an abstraction provided by the operating system that abstracts the storage media and provides a way to access this abstraction, providing users with simple and convenient access to storage media such as hard drives and NAND flash. To achieve this abstraction, the operating system divides the storage media into units, and the files occupy several units when they are stored in the media. Of course, the operating system also records the basic properties of each file (such as file size, storage location, owner, access rights, etc.), and form a file control block (FCB). The FCB of all files is saved in a directory file, that is, a directory file is the content of the FCB file, itself also has the FCB directory file FCB records in the previous level of the directory, so that the layer is connected to form a tree directory structure. Or this description: The file system consists of two parts: a set of files (that is, the data to be saved) and a catalog file (the contents of the directory file are the FCB,FCB of each file that records all the properties of the file). as shown in the following:

As shown in a typical Linux system directory structure, from the user's point of view this is the Linux file system, from the right to the left, assuming that the run directory has a file files, then file's FCB is saved in the Run directory file, and run is a file, its FCB stored in the var directory file, the last Var FCB is saved in the root directory file. To access file at a time, the essence is to follow a path such as/var/run/file. But from an operating system point of view, this is just a visual file system for the user, with specific implementation details (such as the physical and logical structure of the file) that have been hidden. It is important to note that the file system is stored in the external memory (NAND flash, etc.), and there will be a corresponding directory entry in memory that indicates the file attributes to speed up the efficiency of the operating system accessing the file. That is, the kernel will also have the content of the FCB, even the directory files will exist in memory.

Based on the above background, you can actually summarize the steps to establish the root file system, simply create these directories and files, and then let the kernel recognize them (that is, mount the root filesystem in the kernel).

The steps are as follows:

1. Create individual directories and required files

1.1. Create an empty directory:

#mkdir Rootfs

#cd Rootfs

#mkdir bin Dev etc lib proc sbin sys usr MNT tmp var

#mkdir usr/bin usr/lib Usr/sbin lib/modules

1.2. Create a Device file: Create the device driver files required for Linux boot: console and empty

#cd Rootfs/dev

#mknod-M 666 console C 5 1

#mknod-M 666 null C 1 3

1.3. Adding a configuration file: Add some configuration files that the kernel launches

#tar etc.tar.gz

#mv etc/*/rootfs/etc/-RF

1.4. Add Kernel modules:

#cd .../linux

#make Modules Arch=arm cross_compile=arm-linux-

#make Modules_install Arch=arm Install_mod_path=.../rootfs

1.5. Compile/install BusyBox: Use BusyBox to add common commands such as CD, LS, date, etc.

#make Menuconfig

#make

#make Install

2. Mount the root file system: In fact, mounting the root filesystem is done by specifying where the root file system is placed, how the operating system uses the file system's directory files, and so on. Here is a memory-based mount, where the root filesystem is directly integrated into the kernel code after compilation, and as the code is loaded into memory, the file system can be used directly during the kernel boot process. Production of Initramfs file system:

2.1. #cd .../rootfs/

#ln-S./bin/busybox Init

2.2, configure the kernel, let the kernel know how to mount the file system is Initramfs.

2.3. Compile the kernel

2.4. Set Uboot parameters:

setenv Bootargs NOINITRD console=ttysac0,115200

Complete the above work to create a complete Linux system with a Initramfs file system.

At this point a complete Linux system has been able to run in mini2440, where it can then be driven or applied for development.

The production of ARM Development Board system transplant-----ROOTFS

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.