1.)製作簡易根文件系統/tftpboot/nfs
>mkdir -p bin dev etc lib mnt proc sbin sys tmp usr/bin var usr/lib
>mknod -m 600 /dev/console c 5 1
>mknod -m 666 /dev/null c 1 3
2.)編譯busybox-1.24.0
目錄:/home/jimmy/news5pv210/busybox-1.24.0
>make menuconfig ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
Busybox Settings--->
Build Options--->
[*]Build BusyBox as a static binary(no shared libs)
Busybox Library Tuning--->
[*]vi-style line editing commands
[*]Fancy shell prompts
Linux Module Utilities--->
[ ]Simplified modutils
[*]insmod
[*]rmmod
[*]lsmod
[*]modprobe
[*]depmod
Linux System Utilities--->[*]mdev
[*]Support /etc/mdev.conf
[*]Support subdirs/symlinks
[*]Support regular expressions substitutions when renaming dev
[*]Support command execution at device addition/removal
[*]Support loading of firmwares
>make
>make install (我的安裝在nfs根目錄下 /tftpboot/nfs)
3.)編寫/etc/inittab文件:
::sysinit:/etc/init.d/rcS
::askfirst:-/bin/sh
::ctrlaltdel:-/bin/reboot
::shutdown:/bin/umount -a -r
::restart:sbin/init
4)編寫/etc/init.d/rcS文件,這裏我改寫爲調用/etc/init.d/S*所有S開頭的文件,最後調用mount -a 掛載fstab裏的文件系統
#!/bin/sh
# Start all init scripts in /etc/init.d
# executing them in numerical order.
#
for i in /etc/init.d/S??* ;do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
mount -a
5.)/etc/fstab, 其中/proc和/sys最重要,因爲裏面有驅動要用的結構
# /etc/fstab: static file system information.
# <file system> <mount pt> <type> <options> <dump> <pass>
/dev/root / ext2 rw,noauto 0 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs mode=0777 0 0
tmpfs /tmp tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
6)/etc/init.d/S10mdev 啓動mdev
#!/bin/sh
#
# Start mdev....
#
case "$1" in
start)
echo "Starting mdev..."
/sbin/mdev -s
;;
stop)
;;
restart|reload)
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?