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)编译
make
4)安装
make install
bin linuxrc sbin usr
6)添加其他所需目录
mkdir dev etc mnt proc var tmp sys root lib
7)添加库
cp /home/tony/toolchain/arm-none-linux-gnueabi/lib/*so* ./lib/ -a
8)在管理员模式对库瘦身
sudo su
source /home/tony/.bashrc //如果在etc/profile中不用
arm-none-linux-gnueabi-strip./lib/*
exit
9)添加系统启动文件
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
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,如果没有请设置
make menuconfig
File systems --->
Pseudo filesystems --->
[*] Virtual memory file system support(former shm fs)
[*] Tmpfs POSIX Access Control Lists
重新编译内核
12)在etc下创建init.d目录,并在该目录下创建rcS文件
mkdir ./etc/init.d
vim ./etc/init.d/rcS
添加如下内容:
#!/bin/sh
#This is the firstscript called by init process
/bin/mount -a
为rcS添加可执行权限
chmod +x ./etc/init.d/rcS
13)在etc下创建profile文件
vim ./etc/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节点(这个设备节点是必须的)
sudo mknod ./dev/console c 5 1
16)把整个文件夹准备好了之后再用./mkyaffs2image root-fs root-fs-yaffs2.bin