I. Basic Concepts
File Management: Data Management Algorithms
File System: Carrier for file Algorithm Management
File System Function: Manage data on partitions (add, delete, query, modify, and delete data)
File System classification: FAT32/NTFS/ext3/ext4/yaffs/jffs/cramfs /.....
File System:
Window ---------> Forest
Linux ------------> tree -------> file directory standards
File System and root file system:
Root file system: The Help File System loaded at system startup
Other file systems: other file systems mounted after the root system is started
Ii. required tools
Busybox-1.20.2.tar,yaffs2-source,bash-4.0.tar
: Http://pan.baidu.com/s/1ntmMh5Z
Iii. root file system Image Design
1) create a standard Linux File directory (required)
/Sbin -------> superuser tool command
/Etc ---------> System Configuration File
/Bin ----------> common tool commands
/Dev ----------> device file directory
/Lib ------------> library file directory ---------------> static library and dynamic library
Command:
1 mkdir/home/GEC/build_rootfs2 3 CD/home/GEC/build_rootfs4 mkdir rootfs -----> Create the root file system home directory ----->/5 6 CD rootfs7 mkdir {sbin, bin, Dev, lib, etc}
View code
2) Configure busybox
1. decompress the package and enter the directory.
# tar jxvf busybox-1.20.2.tar.bz2# cd busybox-1.20.2
2. Modify the architecture arch and cross-compiler prefix cross_compile in makefile.
# Vim makefile
Modify: cross_compile =/usr/local/ARM/arm-2009q3/bin/ARM-None-Linux-gnueabi-arch = arm
3. Configure busybox through menuconfig
The configuration method of busybox is exactly the same as that of Linux kernel menu items. Users who are familiar with using make menuconfig to configure the Linux kernel can easily get started.
# Make menuconfig: busybox settings ---> general configuration ---> [*] Don't use/usr build options ---> [*] Build busybox as a static binary (no shared libs) this option must be selected so that busybox can be compiled into a static link executable file and run independently of other function libraries. Otherwise, busybox can be run only in other library files. Busybox library tuning ---> [*] vi-style line editing commands selects the Vi-style line editor command. [*] Fancy shell prompts Installation Options ("make install" behavior) ---> (/home/GEC/build_rootfs/rootfs) busybox installation prefix // installation target path LINUX module utilities ---> [] simplified modutils [*] insmod [*] rmmod [*] lsmod [*] modprobe [*] depmod deselect simplified modutils, use the complete module tool commands: insmod, rmmod ......
View code
Make sure that mdev is supported (mdev is the lite version of The udev Device File System) and that the following items are selected:
Linux System Utilities ---> [*] mdev [*] Support /etc/mdev.conf [*] Support subdirs/symlinks [*] Support regular expressions substitutions when renaming dev [*] Support command execution at device addition/removal [*] Support loading of firmwares
View code
Other options are some basic Linux Command Options. You can compile the commands you need. Generally, you can use the default command. After configuration, exit and save the command.
4. Compile and install busybox.
Compile: # Make-J2 // J2 indicates creating two threads for compilation and installation: # make install
View code
You can find the _ install subdirectory under the busybox-1.20.2 Directory, which is the installation directory just now.
The following operations are performed in the rootfs directory:
3) copy the dynamic link library in the cross compiler to the lib directory.
Just copy the dynamic link library in the cross compiler and Its Soft link to the lib directory. Do not copy the static Link Library:
# cp /usr/local/arm/arm-2009q3/arm-none-linux-gnueabi/libc/armv4t/lib/*so* lib -rdf
View code
Note: To copy a link using the CP tool, you must use the D option to indicate that the copied file has the link attribute.
4) crop the dynamic link library under the lib directory
The dynamic link library contains symbolic information, which can remove unnecessary symbolic information and make it smaller with the Dynamic Link Library:
# arm-none-linux-gnueabi-strip lib/*so*
View code
5) modify the script file
1. the ETC/inittab file is the startup process file.
# Vi ETC/inittab content: sysinit:/etc/init. d/RCS: askfirst:/bin/sh //: respawn:/bin/Bash: Once:/etc/local. RC: ctrlaltdel:/sbin/reboot: shutdown:/bin/umount-a-r: restart:/sbin/init
View code
2./etc/init. d/RCS script.
# Vi etc/init. d/RCS content :#! /Bin/shexport Path =/sbin:/bin:/usr/sbin: /usr/bin // set the variable pathmount-A // Mount-a to read etc/fstab to mount the file system echo/sbin/mdev>/proc/sys/kernel/hotplug/ /call/sbin/mdevmdev-S/when there is a hot plug-in event in the kernel to start mdev # ifconfig eth0 192.168.0.80 // configure the IP address of Ethernet interface 0
View code
3. etc/fstab file.
# <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 tmpfs /dev tmpfs defaults 0 0 tmpfs /tmp tmpfs defaults 0 0 tmpfs /dev tmpfs defaults 0 0
View code
The/proc directory is mounted with the procfs file system, the/sys directory is mounted with the sysfs file system, and the VaR, TMP, and Dev directories are mounted with the tmpfs temporary file system.
Create the mdev. conf file:
touch /rootfs/etc/mdev.conf
View code
Appendix: Modified etc directory:
Http://pan.baidu.com/s/1pJ4sX2j
6) set the dynamic library loading path
Modify etc/init. d/RCs and add:
export LD_LIBRARY_PATH=/mylib:$LD_LIBRARY_PATH
View code
7) add bash
1. Configure, compile, and generate.
Configure Bash :#. /configure -- Host = arm-Linux Compilation: # Make generation: # make install get bash -----> put it in the/bin directory of the Development Board file system and check whether the dynamic library required by the program has
View code
2. Modify the inittab script
#!/bin/bash::askfirst:/bin/bash
View code
3. Modify the declaration of other scripts
#!/bin/sh --> #!/bin/bash
View code
4. Add etc/profile ----> the default execution script when Bash is started.
# Ash profile# No core files by defaultulimit -S -c 0 > /dev/null 2>&1USER="`id -un`"LOGNAME=$USERPS1=‘[\[email protected]\h \W]# ‘PATH=$PATHHOSTNAME=`/bin/hostname` export USER LOGNAME PS1 PATHexport LD_LIBRARY_PATH=lib:/usr/lib:$LD_LIBRARY_PATH
View code
4. Create a root file system image
1. Obtain the mkyaffs2image source code package.
:
Http://fatplus.googlecode.com/files/yaffs2-source.tar
2. Compile the mkyaffs2image Tool
# tar xvf yaffs2-source.tar# cd yaffs2/utils# make # cp mkyaffs2image /usr/local/bin/
View code
3. Create a root file system image
Enter the/root directory
# mkyaffs2image rootfs rootfs.img
View code
5. Download and download the root file system image rootfs. img
The following operations are performed in the U-boot download phase after the Development Board is reset:
Smdkv210 # NAND erase 0xe00000 0xf200000smdkv210 # TFTP 0x40000000 rootfs. imgsmdkv210 # NAND write. yaffs 0x40000000 0xe00000 0x6aa340 (change the last number to the actual number of bytes for U-boot download and transfer) smdkv210 # Set bootargs root =/dev/mtdblock4 rootfstype = yaffs2 RW console = ttysac0. 115200
View code
S5pv210 file system creation (1)