depmod
退出并保存配置。
编译:
# make
安装:
# make install
在busybox-1.15.0目录下可以找到_install子目录,这就是刚才的安装目录。
二)加入必要的目录与文件
改名为最小化根文件系统目录:
# mv _install mini_rootfs
进入最小化根文件系统目录:
# cd mini_rootfs
在mini_rootfs目录里建立一个名为create_rootfs.sh的脚本文件:
#!/bin/sh
#root dir
mkdir bin sbin lib etc dev sys proc tmp var opt mnt usr home root media
#usr sub dir
cd usr
mkdir bin sbin lib local
#usr/local sub dir
cd local
mkdir bin sbin lib
cd ../..
#etc sub dir
cd etc
touch inittab
touch fstab
touch profile
touch passwd
touch group
touch shadow
touch resolv.conf
touch mdev.conf
mkdir rc.d
mkdir init.d
touch init.d/rcS
chmod +x init.d/rcS
mkdir sysconfig
touch sysconfig/HOSTNAME
cd ..
#dev sub dir
cd dev
mknod console c 5 1
chmod 777 console
mknod null c 1 3
chmod 777 null
cd ..
#var sub dir
cd var
mkdir log
cd ..
为create_rootfs.sh加上可执行权限:
# chmod +x create_rootfs.sh执行该脚本以生成最小化根文件系统所需要的目录与文件:# ./create_rootfs.sh
拷贝交叉编译器里的动态链接库到最小化根文件系统的 lib 和 usr/lib 目录:
# cp -f /opt/arm-2009q1/arm-none-linux-gnueabi/libc/armv4t/lib/*so* lib -a
# cp -f /opt/arm-2009q1/arm-none-linux-gnueabi/libc/armv4t/usr/lib/*so* usr/lib -a
etc/fatab文件的内容为:
# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# file system> mount point> type> options> dump> pass>
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /var tmpfs defaults 0 0
tmpfs /tmp tmpfs defaults 0 0
tmpfs /dev tmpfs defaults 0 0
etc/inittab文件的内容为:
::sysinit:/etc/init.d/rcS
s3c2410_serial0::askfirst:-/bin/sh
::ctrlaltdel:-/sbin/reboot
::shutdown:/bin/umount -a -r
::restart:/sbin/init
etc/profile文件的内容为:
# Ash profile
# vim: syntax=sh
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
PS1='[\u@\h \W]\# '
PATH=$PATH
HOSTNAME=`/bin/hostname`
export USER LOGNAME PS1 PATH
export LD_LIBRARY_PATH=lib:/usr/lib:$LD_LIBRARY_PATH
etc/init.d/rcS的内容:
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
runlevel=S
prevlevel=N
umask 022
export PATH runlevel prevlevel
mount -a
mkdir /dev/pts
mount -t devpts devpts /dev/pts
echo /bin/mdev > /proc/sys/kernel/hotplug
mdev -s
/bin/hostname -F /etc/sysconfig/HOSTNAME
ifconfig eth0 192.168.0.80
resolv.conf文件的内容为: