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
重新啓動開發板,查看是否能夠正常掛載