一.    主机环境
Red Hat Linux 9.0 gcc version 3.4.5
二.    Busybox创建文件系统
1.解压busybox-1.12.2.tar.bz2,路径为:
[root@localhost 2410-s]# pwd
/root/2410-s
[root@localhost 2410-s]# cp /mnt/hgfs/arm/rootfs/busybox-1.12.2.tar.bz2 ./
[root@localhost 2410-s]# tar -xjvf busybox-1.12.2.tar.bz2
[root@localhost 2410-s]# cd busybox-1.12.2
[root@localhost busybox-1.12.2]# vi Makefile
修改Makefile中的ARCHCROSS_COMPILE与本机的路径一致:
CROSS_COMPILE ?= arm-softfloat-linux-
。。。。。。。。。。。。。。。。。。。。。。。
ARCH ?= arm
2.编译busybox。先make menuconfig,修改以下:
[root@localhost 2410-s]#make menuconfig
Busybox Settings  --->
Build Options  --->
    [*] Build BusyBox as a static binary (no shared libs)
//直接编译成静态库,省事点
()  Cross Compiler prefix
/opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux/bin/arm-softfloat-linux-与编译文件Makefile里保持一致,应该写的一处就这行了
Installation Options  ---> 
[ ] Don't use /usr 
//使用usr目录
Busybox Library Tuning  --->
[*]   Fancy shell prompts 
//一定要选上,否则很多转意字符无法识别
 
Shells  --->
  Choose your default shell (ash)  --->                              
//这里选择shellash,应该是默认选中的
   --- ash
//ash这档的选项全部选上
Miscellaneous Utilities  --->
[ ] inotifyd
//不选
保存退出直接
[root@localhost 2410-s]#make
[root@localhost busybox-1.12.2]# make install
执行make install安装
安装成功后在_install目录下可以看到如下目录:
[root@localhost busybox-1.12.2]# ls _install/
bin  linuxrc  sbin  usr
[root@localhost busybox-1.12.2]#
3.shell脚本创建根文件系统的目录结构,并在想要建立根文件系统的地方运行此脚本。我的用root用户登陆的,直接创建来了设备节点。
[root@localhost 2410-s]# mkdir root_stand
[root@localhost 2410-s]# cd root_stand/
[root@localhost root_stand]# pwd
/root/2410-s/root_stand
[root@localhost root_stand]# vi build_fs.sh
#!/bin/sh
echo "making rootdir"
mkdir rootfs
cd rootfs
                                                                                   
echo "making dir:bin dev etc lib proc sbin sys usr"
mkdir bin dev etc lib proc sbin sys usr #8 dirs
mkdir usr/bin usr/lib usr/sbin lib/modules
                                                                                   
#Don't use mknod, unless you run this Script as
mknod -m 600 dev/console c 5 1
mknod -m 666 dev/null c 1 3
                                                                                    
echo "making dir:mnt tmp var"
mkdir mnt tmp var
chmod 1777 tmp
mkdir mnt/etc mnt/jiffs2 mnt/yaffs mnt/data mnt/temp
mkdir var/lib var/lock var/log var/run var/tmp
chmod 1777 var/tmp
                                                                                    
echo "making dir:home root boot"
mkdir home root boot
echo "done
执行这个sh:
[root@localhost root_stand]# sh build_fs.sh
创建出一个主文件夹rootfs,里面有一批文件:
[root@localhost root_stand]# cd rootfs/
[root@localhost rootfs]# ls
bin  boot  dev  etc  home  lib  mnt  proc  root  sbin  sys  tmp  usr  var
[root@localhost rootfs]#
[root@localhost rootfs]# cd etc/
[root@localhost etc]# ls
[root@localhost etc]# cp -a /root/2410-s/busybox-1.12.2/examples/bootfloppy/etc/* ./[root@localhost etc]# ls
fstab  init.d  inittab  profile
[root@localhost etc]#