yaffs2根文件系统的构建过程

简介: 基于BusyBox-1.19.2 (以其它作者的作为参考)    1. 下载BusyBox的源码 http://busybox.net/    2. 解压#tar xvzf busybox-1.19.

基于BusyBox-1.19.2

 (以其它作者的作为参考)

    1. 下载BusyBox的源码 http://busybox.net/

    2. 解压#tar xvzf busybox-1.19.2.tgz (命令参数搞忘了,查一下tgz文件解压命令)

    3. 进入解压目录,对BusyBox进行配置

#make menuconfig

Busybox Settings  --->

         General Configuration  --->

                   [*]Don’t use /usr

BuildOptions  --->

             [] BuildBusyBox as a static binary (no shared libs)

(此项代表文件系统是否要共享libs库函数,如果选上,到最后就可以不用人为地添加libs库文件了,但是如果不添加libs库文件,以后的应用程序也要静态编译了)

             [*]Build shared libbusybox

             (/usr/local/arm/4.4.3/bin/arm-linux-)Cross Compiler prefix    

                       

Installation Options (“make install” behavior) --->

(./_install) Busybox installation prefix (指定busybox的安装路径)

Busybox Library Tuning --->

       [*] vi-style line editing commands

       [*] Fancy shell prompts

(要选择这个选项:“Fancy shell prompts”,否则挂载文件系统后,无法正常显示命令提示符:“[\u@\h \W]#”)

添加mdev(可以实现设备节点的自动创建和设备的自动挂载,mdev具体可以查看http://blog.chinaunix.net/uid-26806098-id-3140548.html )的支持

Linux System Utilities --->

         [*]mdev

[*]Support/etc/mdev.conf

[*]Supportcommand execution at device addition/removal

 

Linux Module Utilities--->

[ ]simplified modutils

[*]insmod

[*]rmmod

[*]lsmod

[*]modprobe   

 

    4. 交叉编译,生成busybox文件

  #make

    5. #make install

  生成_install目录(此目录也就是根目录了),里面有子目录bin各sbin,还有一个文件linuxrc; 并且命令还会将上面生成的busybox文件复制到_install/bin/下

    6. 在_install目录下建立基本的目录结构

  #mkdir etc dev mnt proc tmp usr var tmp sys root lib

 

bin 存放所有用户都可以使用的、基本的命令。

sbin 存放的是基本的系统命令,它们用于启动系统、修复系统等。

usr 里面存放的是共享、只读的程序和数据。

proc 这是个空目录,常作为proc文件系统的挂载点。

dev 该目录存放设备文件和其它特殊文件。

etc 存放系统配置文件,包括启动文件。

lib 存放共享库和可加载块(即驱动程序),共享库用于启动系统、运行根文件系统中的可执行程序。

boot 引导加载程序使用的静态文件

home 用户主目录,包括供服务账号锁使用的主目录,如FTP

mnt 用于临时挂接某个文件系统的挂接点,通常是空目录。也可以在里面创建空的子目录。

opt 给主机额外安装软件所摆放的目录。

root root用户的主目录

tmp 存放临时文件,通常是空目录。

var 存放可变的数据。

 

    7. (如果在上面选择了[*]BuildBusyBox as a static binary (no shared libs),此步骤可以省去)

  添加库

lib$cp /usr/local/arm/4.4.3/arm-none-linux-gnueabi/ lib/*so* ./ -a

再在管理员模式对库瘦身(可以不用做)

    8. 在_install/etc/目录下创建目录和文件:inittab, /init.d/rcS, profile, fstab。

(

添加系统启动文件

etc$vim inittab

添加如下内容:

#this is run first except when booting insingle-user mode.
 
::sysinit:/etc/init.d/rcS
 
# /bin/sh invocations on selected ttys
 
# Start an "askfirst" shell on theconsole (whatever that may be)
 
::askfirst:-/bin/sh
 
# Stuff to do when restarting the init process
 
::restart:/sbin/init
 
#Stuff to do before rebooting
 
::ctrlaltdel:/sbin/reboot

  


 

添加可执行权限

etc#chmod +x inittab

 

etc下添加fstab

etc$vim fstab

添加如下内容:

#device mount-point type options dump fsch order
 
proc /proc proc defaults 0 0
 
tmpfs /tmp tmpfs defaults 0 0
 
sysfs /sys sysfs defaults 0 0
 
tmpfs /dev tmpfs defaults 0 0

  

 

这里挂载的文件系统有三个:procsysfstmpfs,在内核中procsysfs默认都支持,而tmpfs是没有支持的(好像有支持哦),检查内核有没有支持tmpfs,如果没有请如下设置

linux-2.6.35$make menuconfig

File systems --->

Pseudo filesystems --->

  [*] Virtual memory file system support(former shm fs)

  [*] Tmpfs POSIX Access Control Lists

重新编译内核

 

_install/etc下创建init.d目录,并在该目录下创建rcS文件

etc$mkdir init.d

etc/init.d$vim rcS

添加如下内容:

#!/bin/sh
 
#This is the firstscript called by init process
 
/bin/mount -a
 
mdev -s

  

 

为rcS添加可执行权限

etc/init.d$chmod +x rcS

 

etc下创建profile文件

etc$vim profile

添加如下内容:

#!/bin/sh
 
export HOSTNAME=tony
 
export USER=root
 
export HOME=root
 
export PS1= "[$USER@$HOSTNAME \W]#"
 
PATH=/bin:/sbin:/usr/bin:/usr/sbin
 
LD_LIBRARY_PATH=lib:/usr/lib:$LD_LIBRARY_PATH
 
export PATHLD_LIBRARY_PATH

  

  )

    9. 在_install/dev目录dev目录呀,看清楚了,我就是这样出问题的)下创建console节点(这个设备节点是必须的)

dev# mknod –m 660 console c 5 1

(也做了这步:dev# mknod –m 660 null c 1 3)

    10. 在busybox目录下,利用mkyaffs2image工具创建根文件系统映像文件

#mkyaffs2image-128M _install ./root_yaffs2.bin

(如果没有mkyaffs2image命令就先安装)

    11. 修改root_yaffs2.bin文件的权限,否则该文件无法被复制

  #chmod 777 root_yaffs2.bin

    12. 将上面生成的root_yaffs2.bin映像文件下载到开发板中。

目录
相关文章
|
15天前
|
存储 Ubuntu Linux
嵌入式Linux系统中根文件系统构建方式
嵌入式Linux系统中根文件系统构建方式
74 0
|
9月前
|
Ubuntu Linux 编译器
根文件系统移植:bulidroot根文件系统搭建详细步骤
根文件系统移植:bulidroot根文件系统搭建详细步骤
340 0
|
Linux Shell 测试技术
在tinycolinux上组建子目录引导和混合32位64位的rootfs系统
本文关键字:mount subdirectory as linux root,boot linux from root subdirectory,从子目录引导linux root,separated system and usr extend under linux root
247 0
在tinycolinux上组建子目录引导和混合32位64位的rootfs系统
|
Shell 开发工具 Linux
yaffs2根文件系统的构建过程
基于BusyBox-1.19.2  (以其它作者的作为参考)     1. 下载BusyBox的源码 http://busybox.net/     2. 解压#tar xvzf busybox-1.19.
848 0
|
Linux 数据安全/隐私保护 调度