The production of Linux root file system

Source: Internet
Author: User
Tags mkdir

  (a): first the development environment required for the production of the Linux root file system.
1: Porting Linux kernel version: linux-3.0.1 (as long as it is available)
2: Cross-compilation tool: ARM-LINUX-GCC 4.3.2 (optional)
3: File system Production tools: Busybox-1.13.3 (optional)
4:etc.tar.gz
(ii): cross-compilation of the environment (this step I have in my blog other articles inside the detailed construction process, very simple ~)
(iii): Create a root file system directory
1: New folder under the home directory Rootfs
[ Root@localhost fs]# ls
[root@localhost fs]# mkdir rootfs
[root@localhost fs]# cd rootfs/
[root@localhost ROOTF s]# mkdir bin Dev etc lib proc sbin sys usr MNT tmp var
[root@localhost rootfs]# mkdir usr/bin usr/lib usr/sbin Dules
Description:
The root file system is the first file system to use when Linux is started, without which the system will not be able to start normally
However, in this root file system contains a series of directories, and then a simple introduction to these directories. In fact, this is a very understandable
bin
that holds basic commands that all users can use. The

Sbin
Stores Basic system commands for booting the system, repairing the system, and so on.
SYS
Some buses, devices, drives. Wait, it's all here. Seems to be dynamically generated.

usr
contains shared, read-only programs and data.

Proc
This is an empty directory and is often used as a mount point for proc file systems.

Dev
This directory holds device files and other special files.

Etc
holds system configuration files, including startup files.

Lib
holds shared libraries and loadable blocks (that is, drivers) that are used to start the system and run executable programs in the root file system.
MNT
is used to temporarily hook up a file system's hang point, usually an empty directory. You can also create an empty subdirectory inside.The
Boot
Boot loader uses the static file

Home
User directory, including the home directory used for service account locks, such as FTP

opt
To install additional software to the host. The

root
root directory

tmp
holds temporary files, usually an empty directory. The

Var
holds variable data.

2: Create a Device file
[Root@localhost Rootfs] #cd dev/
[Root@localhost dev]# mknod-m 666 console C 5 1
[root@localhost dev]# mknod-m 666 null C 1 3
Description: Mknod-m 666 console C 5 1
Console for the device file name, you can arbitrarily take, C is the character of the device (optional B, block equipment)
5 is the main device number/dev/devices records the existing equipment
1 is the secondary device number when you want to give two of the same device on the driver of the time will be divided, starting from 0, 1 is the second, for the character equipment, the secondary device number means the same type of equipment of different equipment. 666 Delegate Access Permissions

3: Configure/etc/
There are two ways of doing this.
1: You can put the system above the/etc/some of the more important documents to copy over
2: You can also download a etc.tar.gz directly on the internet
#tar-ZXVF etc.tar.gz
Copy the extracted files, etc, to the bottom of the new root directory below/rootfs/etc/
Etc/inittab
Etc/profile
Etc/fstab
etc/init.d/
Etc/init.d/rcs

4: Compiling kernel modules
first into the kernel directory (the kernel directory and root file system directory are not under the same directory)
# CD linux-3.0.1
#make modules Arch=arm cross_compile= arm-linux-
Description: In this step there are some problems, found how to compile also not, and then downloaded a kernel, compiled through
5: Install kernel module
#make modules_install arch=arm install_mod_ Path=/home/xiongyao/rootfs
Description: Put the kernel inside the compiled module under the root file system directory
6: Configure BusyBox
Description: About BusyBox: (Baidu Encyclopedia)
BusyBox is a software that integrates more than 100 of the longest Linux commands and tools. BusyBox contains a few simple tools, such as LS, cat, and Echo, and includes larger, more complex tools such as grep, find, Mount, and Telnet. Some people call BusyBox the Swiss Army Knife in the Linux tool. Simply put, BusyBox is like a large toolbox that integrates many of the tools and commands that compress Linux, as well as the own shell of the Android system.
# TAR-XVZF busybox-1.13.3.tar.gz
# cd busybox-1.13.3
#make menuconfig
Description: This step is to configure the BusyBox graphical interface to take effect, Running this command can be an error because you do not have the
install the image interface of the library, in the terminal input Apt-get install Libncurses5-dev OK ~
Busybox Settings-----> Build Options-----
Select Build BusyBox as a static binary (no shared libs)
BusyBox Settings-----> Installationop tions------------>
Check "Don t use/usr" Check this to avoid Busybox being installed to the host system's/usr directory, destroying the host system
Busybox Installation Prefix (/home/fs/myrootfs) Here to enter the absolute path to BusyBox installation
7: Compile installation busybox
#make arch=arm cross_compile=arm-linux-
#make install
Up to now, the root file system is completely done, you can make this root file system into RAMDisk system
8:, make the root file system RAMDisk
#genext2fs-B 8192-d/home/fs /myrootfs/ramdisk
Description: This step has a problem, and later found that the allocated space is too small, so change 8192 to 120400
#genext2fs-B/home/xiongyao/rootfs/ramdisk
#gzip-9-F RAMDisk
So you can download ramdisk.gz to the Development Board.

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.