Transplantation of linux-2.6.32 on mini2440 Development Board (19) yaffs2 File System

Source: Internet
Author: User

Transplantation of the yaffs2 File System

Editor: The previous file systems are all friendly built-in file systems. The GUI is based on qtopia. This file system has powerful functions. Here we can port a root file system by ourselves, but this is only the most basic system, which helps to understand embedded development. The file system production process is similar, but the production tools used are different. The file system created here mainly refers to the transplantation manual and the book "practical development of ARM Embedded System transplantation.

 

The following describes the porting process in the manual: the original article link is as follows:

Http://huang-tomey.blog.163.com/blog/static/1247505732009916437175/

Detailed steps for using busybox to create a basic root file system

1. Download The busybox source code.
Download busybox from http://www.busybox.net/downloads/, where the download is the busy busybox-1.13.3.tar.gz, which is consistent with the current version used by the mini2440 Development Board.

2 file system directory description
In Embedded Linux, you need to build the root file system. The rules for building the root file system are in the FHS (filesystemhierarchy standard) document. below is the top-level directory of the root file system.
Contents
Bin stores basic commands that can be used by all users.
Sbin stores basic system commands for starting and repairing systems.
USR stores shared and read-only programs and data.
Proc is an empty directory and is often used as a mount point for the proc file system.
Dev: This directory stores device files and other special files.
ETC stores system configuration files, including startup files.
Lib stores shared libraries and loaded blocks (drivers). The shared libraries are used to start the system and run executable programs in the root file system.
Static files used by the boot loader
Home user's home directory, including the Home directory used by the Service account lock, such as ftp
MNT is used to temporarily mount the mount point of a file system, usually an empty directory. You can also create an empty subdirectory in it.
Opt directory for additional software installation on the host.
Root root user's home directory
TMP stores temporary files, which are usually empty directories.
VaR stores variable data.

3. Create a root file system directory
Go to the/opt/studyarm directory and create the script file create_rootfs_bash in the root file system directory. Run the command chmod + x create_rootfs_bash to change the executable permission of the file ,. /create_rootfs_bash run the script to create the root file system directory.
#! /Bin/sh
Echo "------ create rootfs directons start ...--------"
Mkdir rootfs
CD rootfs
Echo "-------- create root, Dev ....----------"
Mkdir root Dev etc boot TMP var sys proc lib MNT home
Mkdir etc/init. d etc/rc. d ETC/sysconfig
Mkdir usr/sbin usr/bin usr/lib usr/modules
Echo "make node in Dev/console DEV/null"
Mknod-m 600 DEV/console C 5 1
Mknod-m 600 DEV/null C 1 3
Mkdir MNT/etc MNT/jffs2 MNT/yaffs MNT/Data MNT/temp
Mkdir var/lib var/lock var/run var/tmp
Chmod 1777 TMP
Chmod 1777 var/tmp
Echo "------- make direction done ---------"
Change the right to use the tmp directory, enable the sticky bit, and enable this bit for the right to use the tmp directory. This ensures that only the user who creates the tmp directory has the right to delete the files created under the tmp directory. 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.

4. Create a dynamic link library
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.
CD/mnt/HGFS/share
Tar-zxvf root_qtopia.tgz-C/opt/studyarm
CP-RfD/opt/studyarm/root_qtopia/lib/*/opt/studyarm/rootfs/lib /*

5. Cross-compile bosybox
Bosybox 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.
5.1 decompress busybox
CD/mnt/HGFS/share
Tar-zxvf busybox-1.13.3.tar.tgz-C/opt/studyarm
5.2 go to the source code and modify the MAKEFILE file:
CD/opt/studyarm/busybox-1.13.3
Modify:
Cross_compile? = Arm-Linux-// 164th rows
Arch? = Arm // 189th rows
5.3 configure busybox
Enter make menuconfig for configuration
(1) busybox settings --->
General configuration --->
[*] Show verbose applet usage messages
[*] 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/SGID configuration via/etc/busybox. config
[*] Suppress warning message If/etc/busybox. conf is not readable
Build options --->
[*] Build busybox as a static binary (no shared libs)
[*] Build with large file support (for accessing files> 2 GB)
Installation Options->
[] Don't use/usr
Applets links (as soft-links) --->
(./_ Install) busybox installation prefix
Busybox library tuning --->
(6) Minimum Password legth
(2) MD5: Trade bytes for speed
[*] Fsater/proc scanning code (+ 100 bytes)
[*] Command line editing
(1024) Maximum length of input
[*] Vi-style line editing commands
(15) History Size
[*] History saving
[*] Tab completion
[*] Fancy shell prompts
(4) Copy buffer size, in kilobytes
[*] Use IOCTL names rather than hex values in error messages
[*] Support InfiniBand HW
(2) LINUX module utilities --->
(/Lib/modules) default directory containing modules
(Modules. Dep) default name of modules. Dep
[*] Insmod
[*] 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
(3) Configure support for the device types under Dev in busybox
There are three methods to create Dev:
Manual creation: when creating the root file system, create the device file to be used in the dev directory. After the system mounts the root file system, you can use the device files in the dev directory.
Using the devfs File System: This method is outdated, with uncertain device ing, insufficient primary/secondary device numbers, and devfs consumes a lot of memory.
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.
The following options will support mdev.
Linux system utilities --->
[*] Support/etc/mdev. conf
[*] Support Command Execution At device addition/removal
4. Compile busybox
Compile busybox to the specified directory:
CD/opt/studyarm/busybox-1.13.3
Make config_prefix =/opt/studyarm/rootfs install
The contents of bin, sbin, USR, and linuxrc files are generated under the rootfs directory.

6. Create a configuration file under the etc directory
1. ETC/mdev. conf file. The content is blank.
2. Copy the passwd, group, and shadow files under the etc directory of the host to the rootfs/etc directory.
3, ETC/sysconfig directory to create a new file hostname, the content is "H3-Studio ".
4. ETC/inittab file:
# ETC/inittab
: Sysinit:/etc/init. d/RCS
S3c2410_serial0: askfirst:-/bin/sh
: Ctrlaltdel:/sbin/reboot
: Shutdown:/bin/umount-a-r
5. etc/init. d/RCS file:
#! /Bin/sh
Path =/sbin:/bin:/usr/sbin:/usr/bin
Runlevel = s
Prevlevel = N
Umask 022
Export path runlevel prevlevel
Echo "---------- munt all ----------------"
Mount-
Echo/sbin/mdev>/proc/sys/kernel/hotplug
Mdev-S
Echo "************************************** *********"
Echo "***************** studying arm ******************** *"
Echo "kernel version: linux-2.6.29.1"
Echo "Student: Huang Xiaohai"
Echo "Date: 2009.10.1"
Echo "************************************** *********"
/Bin/hostname-F/etc/sysconfig/hostname
(Or directly/bin/hostname H3-Studio)
Run the following command to change the execution permission of the RCS:
Chmod + x RCS
6. etc/fstab file:
# Device Mount-point type option dump fsck order
Proc/proc defaults 0 0
None/tmp ramfs defaults 0 0
Sysfs/sys sysfs defaults 0 0
Mdev/dev ramfs defaults 0 0
7. etc/profile file:
# Ash Profile
# VIM: syntax = sh
# No core file by defaults
# Ulimit-s-c 0>/dev/null 2> & 1
User = "ID-UN"
LOGNAME = $ user
PS1 = '[\ U @ \ H = W] #'
Path = $ path
Hostname = '/bin/hostname'
Export user LOGNAME PS1 path
7. Create a root file system image file
Run the following command to install the yaffs file system creation tool:
CD/mnt/HGFS/share
Tar-zxvf mkyaffs2image. tgz-C/
In the/opt/studyarm directory, run the mkyaffs2image rootfs. IMG command to generate the root file system image file. You can run it after writing it to the Development Board.

PS: The above introduction is based entirely on the manual, and I also made it step by step. There are several problems in the middle:

First, after the above file system is burned in, it runs and is displayed as old. tty2, tty3, and tty4 cannot be opened. I feel very strange, because I have also transplanted it and there is no problem. I thought about it. The problem must be in the configuration file, that is, under etc, I implemented the inittab file, which is the configuration file of the INIT process. The default configuration file is generated. Is that the problem? I modified the default configuration file in busybox and implemented it myself. Then the problem was solved.

Second, in shell, the position displayed by the cursor is always incorrect. It is easy to think of the profile file problem, which has been adjusted and solved.

Third, the compiled yaffs2 file system cannot run. This may be the reason. The mkyaffs2image tool provided by the friendly arm can only be used in the fodera 9.0 system when creating a file system for 128mflash. If you are using another system, this tool may not work properly. At this time, you can only find the source code for proper modification and re-compile the tool to use it.

Look at my article http://blog.csdn.net/ssdsafsdsd/article/details/8702269

 

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.