1. 建立一個工作目錄nfs_root_work
2. 用vi建立一個mkroot.sh,並將下列複製到mkroot.sh裡存檔
echo “creatint rootfs dir……"
mkdir rootfs
cd rootfsecho “making dir : bin dev etc lib proc sbin sys usr"
mkdir bin dev etc lib proc sbin sys usr
# Don’t use mknod ,unless you run this Script as root !
# 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/jffs2 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
cd dev
mknod -m 600 console c 5 1;mknod -m 666 null c 1 3
cd ..
cd ..
#=====================================================
echo “copy files from busybox …"
cp -af busybox-1.12.1/_install/* rootfs/
cp -af busybox-1.12.1/examples/bootfloppy/etc rootfs
#=====================================================
echo “copy files from etc …"
cp -af etc/* rootfs/etc
#=====================================================
echo “copy files from lib …"
cp -af lib/* rootfs/lib
#=====================================================
#echo “modify login file form TinyLogin …"
#cd tinylogin-1.4
#make PREFIX=../rootfs/ install
#cd ..
echo “filesystem make finish!"
3. 建立lib目錄,並把需要的library拷貝到該目錄裡
4. 建立etc目錄,並建立以下內容檔案
etc/fstab
proc /proc proc defaults 0 0
none /tmp ramfs defaults 0 0
mdev /dev ramfs defaults 0 0
sysfs /sys sysfs defaults 0 0
etc/inittab
::sysinit:/etc/init.d/rcS
::respawn:/bin/login root
::restart:/sbin/init
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
::shutdown:/sbin/swapoff -a
etc/profile
# /etc/profile: system-wide .profile file for the Bourne shells
echoecho “Processing /etc/profile… "
# no-op
# Set search library path
echo “Set search library path in /etc/profile"
export LD_LIBRARY_PATH=/lib:/usr/lib
# Set user path
echo “Set user path in /etc/profile"
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH
# Set PS1
#注意:ash 除了SHELL變量外,支持\u、\h、\W、\$、\!、\n、\w 、\nnn(ASCII字符對應的八進制數)
#以及\e[xx;xxm (彩色特效)等等!
#而且前面還要多加一個 ‘\’!
echo “Set PS1 in /etc/profile"
export PS1="[$USER@Comtrend]#"
echo “Done"
echo
etc/passwd
root:x:0:0:root:/root:/bin/sh
etc/group
root:x:0:root
etc/shadow
root::13888:0:99999:7:::
etc/mdev.conf
(要有檔案但內容是空的)
etc/init.d/rcS
#! /bin/sh
echo “———-mount all"
/bin/mount -aecho “———-Starting mdev……"
#/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s
echo “*********************************************************"
echo " Rootfs 2008/10/15″
echo " Love Linux ! ! ~Awaysu~ "
echo “********************************************************"
#! /bin/sh
echo “———-mount all"
/bin/mount -aecho “———-Starting mdev……"
#/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s
echo “*********************************************************"
echo " Rootfs 2008/10/15″
echo " Love Linux ! ! ~Awaysu~ "
echo “********************************************************"
5. 下載busybox並解壓縮, http://www.busybox.net/downloads/
(注意版本名稱,mkroot.sh需相同)
6. 進入busybox目錄,使用vi修改Makefile
ARCH = mips
CROSS_COMPILE = mipsel-uclibc-
7. 執行make menuconfig
Mscellaneous Utilities
[ ] readahead
[ ] tasksetLinux System Utilities
[*] Support mounting NFS file systems
Networking Utilities
[ ] ether-wake
[*] Support RPC services
Linux Module Utilities
[ ] Simplified modutils
後面全都要勾
Miscellaneous Utilities
[ ] inotifyd
8. 建立busybox-1.12.1/arch/mips/Makefile
CFLAGS += -mips32 -mtune=mips32
9. 執行make,執行完後再執行make install,完成後會產生_install目錄,請刪除目錄裡的linuxrc檔案.
10. 完成後回到nfs_root_work執行mkroot.sh就會自動幫你建好filesystem.
11.拷貝lib檔案,一定要有
ld-uClibc-0.9.29.so
libm-0.9.29.so
libuClibc-0.9.29.so
ld-uClibc-0.9.29.so
libm-0.9.29.so
libuClibc-0.9.29.so
以上我已經包成一個壓縮檔(下載),解開後執行到busybox目錄執行完後再執行make install,會到工作目錄執行make就會產生filesystem到rootfs,再用NFS作為filesystem root執行.
在Bootloader下執行
setenv -p STARTUP “boot -z -elf flash0.kernel1: ‘rootfstype=nfs root=/dev/nfs nfsroot=192.168.168.201:/home/awaysu/rootfs_work/rootfs ip=192.168.168.174 mem=128M'"
reference:
http://ccoolloorr.blogspot.com/2008/05/filesystem.html
http://wiki.jk2410.org/wiki/%E5%8A%A0%E5%85%A5Busybox
http://ccoolloorr.blogspot.com/2008/05/filesystem.html
http://wiki.jk2410.org/wiki/%E5%8A%A0%E5%85%A5Busybox
沒有留言:
張貼留言