The simplest embedded linux root file system

Source: Internet
Author: User
The simplest embedded linux root file system-general Linux technology-Linux programming and kernel information. For more information, see the following. Author: Liu suqi
Location: robot center, Guilin University of Electronic Science and Technology

1. Preparations
Download busybox tool Description: used to create an executable command tool set

2. Development Environment

1) Host: RedHat 9

2) path of the Cross-compilation tool:/usr/local/arm/3.3.2/(used to compile busybox1.2.0)

Add the/usr/local/arm/3.3.2/bin path to the/etc/profile file.

3) Development Board: SBC2410

4) the Linux 2.4.18 kernel and Linux 2.6.14 Kernel used by the Development Board respectively verify the file system.

3. Create the empty root directory folder of the target board and the folder under the root directory

[Root @ 190 friendly-arm] # mkdir myroots
[Root @ 190 friendly-arm] # pwd
/Friendly-arm/myroots
[Root @ 190 friendly-arm] # cd myroots
[Root @ 190 myroots] #
[Root @ 190 myroots] # mkdir bin sbin usr lib dev mnt opt root etc home proc tmp var
[Root @ 190 myroots] # mkdir etc/init. d

Go to the etc/init. d directory, create a script file, and name it "rcS". Open it with gedit and add the following content:

#! /Bin/sh
PATH =/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:
Runlevel = S
Prevlevel = N
Umask 022
Export PATH runlevel prevlevel

#
# Trap CTRL-C & c only in this shell so we can interrupt subprocesses.
#
Trap ":" INT QUIT TSTP

[Root @ 190 myroots] # cd ../lib

That is, enter the lib directory and add the corresponding library file. The specific operation is omitted.

4. Port Busybox

Go to the directory where the compressed files are stored and decompress the package. Enter the decompressed busybox directory folder and configure busybox.

[Root @ 190 busybox-1.2.0] # make menuconfig

After execution, the configuration page shown in

The configuration options of each version are organized differently. In any case, pay attention to the following options:

1) Support for devfs

2) Build BusyBox as a static binary (no shared libs) // compile busybox into a static Link

3) Do you want to build busybox with a Cross Compile?

(/Usr/local/arm/3.3.2/bin/arm-linux-) Cross Compile prefix // specify the Cross Compiler

4) init

5) Support reading an inittab file // supports init to read the/etc/inittab configuration file

6) (X) ash: Select ash // The created rcS script for execution.

7) ash

8) Select the cp cat ls mkdir mv // select the executable command tool. You can choose the tool as needed.

9) mount

10) umount

11) Support loopback mounts

12) Support for the old/etc/mtab file

13) insmod

14) Support version 2.2.x to 2.4.x Linux kernels

15) Support version 2.6.x Linux kernels

16) vi

The above content must be selected, and others can be selected by default. If you want to support other functions, such as network support, you can select as needed. If the English is not very bad, there is no problem.

After configuration, save and exit. Then compile and install it in the root file system directory just created:

[Root @ 190 busybox-1.2.0] make TARGET_ARCH = arm CROSS = arm-linux-\ PREFIX =/friendly-arm/myroots/all install

After installation, copy the binary file to the corresponding directory of the root file system.

5. Create a yaffs file system package

[Root @ 190 friendly-arm] # mkyaffsimage myroots. img

6. Download the root file system package to the Development Board and run it.

7. Supplement

First, the root file system created in this document is packaged into a yaffs image file using mkyaffsimage. You can also use other packaging tools to create a root file system in other forms, however, the kernel must support the corresponding file system. Otherwise, the root file system cannot be mounted.

Next, we can add the corresponding files and configure the corresponding services under the corresponding directory according to the project requirements. For example, the kernel dynamic loading module can be placed under lib, and corresponding modules can be mounted in the startup script; tinyligin logon interface applications can be transplanted under the etc directory, and so on.
Related Article

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.