Creation of mini6410 file systems

Source: Internet
Author: User

1. Start

The friendly arm does not provide detailed methods and steps for creating the root file system of the mini6410 and tiny6410 development boards, therefore, I made the mini6410 root file system according to the mini2440 Linux transplant Development Practice Guide. The tools and source code packages used in this production process are from friendly official CDs, including:

(1) kernel: linux2.6.38-20111116.tgz

(2) root file system: rootfs_qtopia_qt4-20111103.tgz

(3) busybox: busybox-1.17.2-20101120.tgz

(4) Cross Compiler: arm-linux-gcc-4.5.1-v6-vfp-20101103.tgz

(5) file system image production tools: mktools-20110720.tar.gz

2. Build a Development Environment

The Development Environment (mainly Linux, virtual machine installation, and cross-compilation environment) is fully implemented in accordance with section 4.3 of the mini6410 user manual.

3. Description of the root file system directory

The root file system is the first file system used when Linux is started. Without it, it cannot be started normally. However, this root file system contains a series of directories, next, we will give a brief introduction to these directories.

4. Create a directory for the root file system

Go to the directory where you want to place the file system, use the mini2440 Linux transplant Development Practice Guide, the script file create_rootfs_bash in the new root file system directory, and run the command chmod + x create_rootfs_bash, change the executable permission of the file and execute ". run the/create_rootfs_bash script to create the root file system directory. The content of the script create_rootfs_bash file is:

#!/bin/shecho "------Create rootfs directons start...--------"mkdir rootfscd rootfsecho "--------Create root,dev....----------"mkdir root dev etc boot tmp var sys proc lib usr mnt homemkdir etc/init.d etc/rc.d etc/sysconfigmkdir usr/sbin usr/bin usr/lib usr/modulesecho "make node in dev/console dev/null"mknod -m 600 dev/console c 5 1mknod -m 600 dev/null c 1 3mkdir mnt/etc mnt/jffs2 mnt/yaffs mnt/data mnt/tempmkdir var/lib var/lock var/run var/tmpchmod 1777 tmpchmod 1777 var/tmpecho "-------make direction done---------"

In the script, the right to use the tmp directory is changed to enable the sticky bit. Enable this bit for the right to use the tmp directory to ensure the files created under the tmp directory, only the user who created it has the right to delete it. Although most of the embedded systems are single users, some embedded applications do not necessarily use root permissions for execution. Therefore, they must follow the basic requirements of the root file system permission bit.

5. Create a dynamic link library (that is, the lib directory)

The dynamic link library directly uses the friendly arm. First, extract the friendly arm's root file package and copy the Lib content to the new root file directory Lib.

cp -rfd /opt/FriendlyARM/mini6410/rootfs_qtopia_qt4 /opt/FriendlyARM/mini6410/rootfs/lib

6. Cross-compile busybox (that is, directories such as bin and sbin in the root file system)

Busybox is an open-source project that complies with the GPL v2 protocol. It optimizes the file size during the compilation process and considers the limited system resources (such as memory, busybox can automatically generate the bin, sbin, USR directory, and linuxrc files required by the root file system. For details, refer to the 346 page of the Wei Dongshan complete manual.
(1) decompress busybox
CD/opt/friendlyarm
Tar-zxvf busybox-1.17.2-20101120.tgz
(2) go to the source code and modify the MAKEFILE file: (this is an important step and must be done. For some tutorials or articles, refer to the Kernel configuration and compilation, that is, add arch, cross_compile and so on after make menuconfig and make, and do not modify this, it may cause errors such as "request_module: runaway loop modprobe binfmt-464c)
CD/opt/studyarm/busybox-1.17.2
Modify:
Cross_compile? = Arm-Linux-// 164th rows
Arch? = Arm // 189th rows
(3) Configure busybox
Tip: the friendly arm has provided the busybox source code package in the CD \ Linux directory, the busybox-1.17.2-20101120.tgz after decompression contains the friendly arm provided by the default configuration file: fa_config (enter the command "CP fa. config. config "can call this configuration). Generally, you can use the default file directly, so that the generated busybox and root_qtopia_qt4 are completely consistent. To learn more about its configuration, refer to the following steps in the mini2440 Linux transplant Development Practice Guide:

Enter make menuconfig for configuration

The configuration below is basically the same as that of busybox1.17.2, and is not the same in some places.

Busybox settings ---> general configuration ---> [*] Show verbose applet usage messages // This is the details of the real program. [*] store applet usage messages in compressed form [*] Support -Install [-S] to install applet links at runtime [*] Enable locale support (system needs locale for this to work) [*] support for-Long-options [*] use the devpts filesystem for unix98 ptys [*] Support writing pidfiles [*] runtime SUID/s GID configuration via/etc/busybox. config [*] suppress warning message If/etc/busybox. conf is not readable // This configuration is If/etc/busybox. if conf is unreadable, the user will be prompted with the warning information build options ---> // I am mainly concerned about this is the compilation option [*] Build busybox as a static binary (no shared libs) // static link, if you want to use a static link library, this option must be selected. 
LINUX module utilities ---> // This is the setting of LIB/modules (/lib/modules) default directory containing modules // The default kernel module is installed in this directory (modules. dep) default name of modules. dep [*] insmod // These are supported commands [*] rmmod [*] lsmod [*] modprobe ----- options common to multiple modutils [] Support Version 2.2/2.4 linux kernels [*] Support tainted module checking with new kernels [*] Support for module. aliases file [*] Support for modules. symbols File

7. Prepare the dev Device File

There are many device files, and they are complicated. Therefore, the preparation includes two parts: static creation of device files and use mdev to create device files.

(1) Static Device File Creation

In fact, in the directory where the file system is created, the device files of two required devices have been created statically: console and null. These two device nodes must exist during kernel boot.

mknod -m 600 dev/console  c 5 1mknod -m 600 dev/null     c 1 3

(2). Use mdev to create a device file

Udev: a user program that dynamically updates device files, including creating and deleting device files, based on the status of hardware devices in the system. It is relatively complex but flexible.

Mdev is a simplified udev that comes with busybox and is suitable for Embedded Application merge. It is easy to use. It automatically generates the node files required by the driver when the system starts and hot swapping or dynamically loads the driver. It is the best choice to build an embedded linux root file system based on busybox. In the busybox configuration, the following options will support mdev.

Linux System Utilities  --->                         [*]Support /etc/mdev.conf                   [*]Support command execution at device addition/removal

8. Compile and install busybox

After completing step 6 and Step 7, you can compile and install busybox.

Compile: Make arch = arm cross_compile = arm-linux. In fact, you only need to execute make. I have added arch and cross_compile here, but it does not work, just for insurance purposes. If the compilation is not an ARM-based busybox, the system cannot run.

Install: make install config_prefix =/opt/friendlyarm/mini6410/rootfs /. You can also set the location where the config_prefix is installed during configuration. The specific location is:

Busybox Settings->    Installation Options->        (/***/***)Busybox Installation Prefix

9. Compile and install the kernel module.

In step 2, after the dynamic link library is installed, the LIB/modules directory already contains the kernel module. However, this kernel module and I use a different kernel version, so we will re-compile and install it.

Go to the kernel directory and ensure that the kernel has been correctly configured and compiled once before compiling and installing the kernel module. It is assumed that no compilation has been made.

(1) We want to make the default Target Platform of Linux-2.6.38 become ARM platform.
Modify the makefile in the directory

Original

export KBUILD_BUILDHOST := $(SUBARCH)ARCH ?= $(SUBARCH)CROSS_COMPILE ?=

Change

export KBUILD_BUILDHOST := $(SUBARCH)ARCH ?= armCROSS_COMPILE ?= arm-linux-

Among them, arch specifies the target platform as arm, and cross_compile specifies the cross compiler. Here the default cross compiler is specified. If you want to use other, write the full path of the compiler here.

(2) configure and compile the kernel module

You can copy the friendly built-in configuration file in the kernel. Then execute:

make menuconfigmake zImage

(3) Compile the kernel module

make modules ARCH=arm CROSS_COMPILE=arm-linux-

(4) install the kernel module

make modules_install ARCH=arm INSTALL_MOD_PATH=/opt/FriendlyARM/mini6410/rootfs

10. Create a configuration file under the etc directory <these configuration information is basically something that does not need to be changed, so you can directly copy it from the host or friendly built-in file system>
A. Create the ETC/mdev. conf file. The content is blank.
B. Copy the passwd, group, and shadow files under the etc directory of the host to the rootfs/etc directory.
C. Create a new file hostname in the ETC/sysconfig directory, and write your favorite name in the content.
D. ETC/inittab file:

#etc/inittab::sysinit:/etc/init.d/rcS::askfirst:-/bin/sh::ctrlaltdel:/sbin/reboot::shutdown:/bin/umount -a –r

E, etc/init. d/RCS file:

#!/bin/shPATH=/sbin:/bin:/usr/sbin:/usr/binrunlevel=Sprevlevel=Numask 022export PATH runlevel prevlevelecho "----------munt all----------------"mount -aecho /sbin/mdev>/proc/sys/kernel/hotplugmdev -secho "***********************************************echo "****************Studying ARM*********************"echo "Kernel version:linux-2.6.38"echo "Student"echo "Date:2012.05.08"echo "***********************************************"/bin/hostname -F /etc/sysconfig/HOSTNAME

Run the following command to change the execution permission of the RCS:

Chmod +x rcS

F, etc/fstab file:

#device    mount-point     type     option     dump   fsck   orderproc          /proc        proc     defaults    0        0none          /tmp        ramfs    defaults    0        0sysfs         /sys          sysfs    defaults    0        0mdev          /dev        ramfs    defaults    0        0

G, etc/profile file:

#Ash profile#vim:syntax=sh#No core file by defaults#ulimit -S -c 0>/dev/null 2>&1USER="id -un"LOGNAME=$USERPS1='[\u@\h=W]#'PATH=$PATHHOSTNAME='/bin/hostname'export USER LOGNAME PS1 PATH

At this point, the root file system has been built, and the following will be made into a ubi image file and burned down.

11. Create a root file system image
Run the following command:

tar zxvf mktools-20110720.tar.gz -C /

Note: C is in upper case, and C is followed by a space. c Indicates changing the installation directory.
This will create a corresponding tool set in the/usr/sbin directory.

Then execute

mkubimage-slc rootfs rootfs.ubi

Run the ubi image file on 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.