The creation of the Linux root file system

Source: Internet
Author: User

One. Creating root file system directories and files

1. Create a 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

2. Create a Device file

#cd Rootfs/dev

#mknod-M 666 console C 5 1

#mknod-M 666 null C 1 3

3. Join the configuration file

#tar etc.tar.gz

#mv etc/*/root/etc/-RF

4. Adding kernel modules

#cd .../linux

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

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

5. Compiling BusyBox

1. Configure BusyBox

#make Menuconfig

Busybox Settingsàbuild options->

* check "Build busybox as a static binary", Static link

*cross Compiler prefix (arm-linux-)

Installation options->

* Select "Don t use/usr" to prevent BusyBox from being installed in the/USR directory of the host system, destroying the host system

*busybox installation Prefix (/XXX/ROOTFS)

This option indicates the installation location of the compiled BusyBox

2. Compiling and installing BusyBox

#make

#make Install

Two. Mount the root file system to the kernel

1. Introduction to Mount Mode

(1). File system type

Depending on the hardware characteristics and system requirements of the storage device, different file system types have different application situations.

In embedded Linux applications, the main storage devices are RAM and flash,

Common storage device-based file system types include: JFFS2, YAFFS2, ubifs, RAMDisk, etc.

(2). System type

#基于nandflash的文件系统 YAFFS2, UbiFS (Readable and writable)

#基于norflash的文件系统 JFFS2

#基于内存的文件系统 Rmdisk, Initramfs

#基于网络的文件系统 NFS

2. Initranfs Mount

1. #cd/rootfs/#ln –s./bin/busybox Init

2. Configure the Linux kernel to support Initramfs

      

3. Compiling

4. Setting Environment variables

Setenv BOOTARGSNOINITRD console=ttysac0,115200

3. NFS Mount

    

Setenv Bootargs NOINITRD

console=ttysac0,115200 Init=/init

Root=/dev/nfs RW

nfsroot=192.168.1.3:/home/s5-arm/part4/rootfs,proto=tcp,nfsvers=

3ip=192.168.1.6:192.168.1.3:192.168.1.1:255.255.255.0::eth0:off

The creation of the Linux root file system

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.