1:Ubuntu 10.10
2:u-boot-2010.03
3:linux-2.6.35
4:busybox-1.17.3
5:优龙FS2410
6:交叉编译器:arm-none-linux-gnueabi-gcc version 4.3.2
1)解压缩busybox
tar xjvf busybox-1.17.3.tar.bz2
2)配置源码
tony@Ubuntu:~/win/busybox-1.17.3$make menuconfig
BusyboxSettings --->
BuildOptions --->
[*] BuildBusyBox as a static binary (no shared libs)
[ ] Force NOMMU build (NEW)
[ ] Build with Large File Support (foraccessing files > 2 GB)
(/home/tony/toolchain/bin/arm-none-linux-gnueabi-)Cross Compiler prefix
() Additional CFLAGS (NEW)
3)编译
tony@Ubuntu:~/win/busybox-1.17.3$make
4)安装
busybox默认安装路径为源码目录下的_install
tony@Ubuntu:~/win/busybox-1.17.3$make install
bin linuxrc sbin usr
6)添加其他所需目录
tony@Ubuntu:~/win/busybox-1.17.3/_install$mkdir dev etc mnt proc var tmp sys root lib
7)添加库
tony@Ubuntu:~/win/busybox-1.17.3/_install/lib$cp /home/tony/toolchain/arm-none-linux-gnueabi/lib/*so* ./lib/ -a
8)在管理员模式对库瘦身
tony@Ubuntu:~/win/busybox-1.17.3/_install$sudo su
root@Ubuntu:/home/tony/win/busybox-1.17.3/_install#source /home/tony/.bashrc //如果在etc/profile中不用
root@Ubuntu:/home/tony/win/busybox-1.17.3/_install#arm-none-linux-gnueabi-strip./lib/*
root@Ubuntu:/home/tony/win/busybox-1.17.3/_install#exit
9)添加系统启动文件
tony@Ubuntu:~/win/busybox-1.17.3/_install/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
10)在etc下添加fstab
tony@Ubuntu:~/win/busybox-1.17.3/_install/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
11)这里我们挂载的文件系统有三个:proc、sysfs和tmpfs,在内核中proc和sysfs默认都支持,
而tmpfs是没有支持的,检查内核有没有支持tmpfs,如果没有请设置
tony@Ubuntu:~/win/linux-2.6.35$make menuconfig
File systems --->
Pseudo filesystems --->
[*] Virtual memory file system support(former shm fs)
[*] Tmpfs POSIX Access Control Lists
重新编译内核
12)在etc下创建init.d目录,并在该目录下创建rcS文件
tony@Ubuntu:~/win/busybox-1.17.3/_install/etc$mkdir init.d
tony@Ubuntu:~/win/busybox-1.17.3/_install/etc/init.d$vim rcS
添加如下内容:
#!/bin/sh
#This is the firstscript called by init process
/bin/mount -a
为rcS添加可执行权限
tony@Ubuntu:~/win/busybox-1.17.3/_install/etc/init.d$chmod +x rcS
13)在etc下创建profile文件
tony@Ubuntu:~/win/busybox-1.17.3/_install/etc$vim profile
添加如下内容:
#!/bin/sh
exportHOSTNAME=tony
export USER=root
export HOME=root
#exportPS1="[$USER@$HOSTNAME \W]#"
PATH=/bin:/sbin:/usr/bin:/usr/sbin
LD_LIBRARY_PATH=lib:/usr/lib:$LD_LIBRARY_PATH
export PATHLD_LIBRARY_PATH
14)在dev下创建console节点(这个设备节点是必须的)
tony@Ubuntu:~/win/busybox-1.17.3/_install$sudo mknod dev/console c 5 1
15)制作已完成,在NFS中进行测试
①将OK的文件系统拷贝到/opt/filesystem下
tony@Ubuntu:~/win/busybox-1.17.3$cp _install/* /opt/filesystem -a
②设置U-Boot环境变量
setenv bootcmd tftp 30800000 uImage \; bootm
setenv bootargs console=ttySAC0,115200 init=/linuxrc root=nfs nfsroot=192.168.7.103:/opt/filesystem ip=192.168.7.163
重新启动开发板,查看是否能够正常挂载