根文件系统制作步骤
第一步:文件系统下载:http://busybox.net/downloads/
第二步: 解压源码 $
tar xvf busybox-1.22.1.tar.bz2
第三步: 进入源码目录 $
cd busybox-1.22.1
第四步: 配置源码 $ make menuconfig(同样需要menuconfig系统支持)
Busybox Settings --->
Build Options --->
[*] Build BusyBox as a static binary (no shared libs)
[ ] Force NOMMU build
[ ] Build with Large File Support (for accessing files > 2 GB)
**(arm-linux-) Cross Compiler prefix(主要修改位置)**
() Additional CFLAGS
第五步: 执行 $
make
第六步: $
make install
编译成功后会在当前目录下面生成一个_insall文件
第七步: 进入安装目录下
$cd _install
$ls
文件夹中应该会有如下四个文件夹
bin linuxrc sbin usr
第八步: 创建其他需要的目录(除了编译后自动生成的还需要我们手动添加如下目录)
$mkdir dev etc mnt proc var tmp sys root
第九步:添加库 将工具链中的库拷贝到_install目录下
$cp /home/farsight/gcc-4.6.4/arm-arm1176jzfssf-linux-gnueabi/lib/ . -a
说明:需要将arm-linux32编译器下面的lib的动态库拷到_install目录下才能运行Linux命令
第十步: 添加系统启动文件 在etc下添加文件inittab,文件内容如下:
vim etc/inittab
#this is run first except when booting in single-user mode.
::sysinit:/etc/init.d/rcS
# /bin/sh invocations on selected ttys
# start an "askfirst" shell on the console (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下添加文件fstab,文件内容如下:
vim etc/fstab
#device mount-point type options dump fsck 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
在etc下创建init.d目录,并在init.d下创建rcS文件,rcS文件内容为:
mkdir etc/init.d
vim etc/init.d/rcS
#!/bin/sh
# This is the first script called by init process
/bin/mount -a
echo /sbin/mdev > /proc/sys/kernel/hotplug
/sbin/mdev -s
为rcS添加可执行权限:
$chmod +x init.d/rcS
在etc下添加profile文件,文件内容为:
vim etc/profile
#!/bin/sh
export HOSTNAME=farsight
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 PATH LD_LIBRARY_PATH
最后将_install中的所有文件拷贝到tftp服务器指定的文件下面即可,查看文件路径:
vim /etc/exports