4. 制作ramdisk
a. 解压busybox-1.2.2.1.tar.bz2
# cd /busybox-1.2.2.1
# make menuconfig 根据需要修改配置
busybox settings à
build options à
[ * ]build busybox as a static binary(no shared libs)
do you want to build busybox with a cross compiler?
填上你的交叉编译器的路径
/usr/local/arm/3.4.1/arm-linux-
另外shells中要选上 choose your default shell (ash)
#make ;make install
c. 制作空的ramdisk:
# dd if=/dev/zero of=ramdisk bs=1k count=8000
在本地目录下出现一个rmdisk的块文件
# losetup /dev/loop2 ramdisk
# mkfs.ext2 /dev/loop2
挂载ramdisk至/mnt下
# mount -t ext2 /dev/loop2 /mnt
c.准备lib库文件
# cd /mnt
# mkdir lib
# cd /usr/local/arm/3.4.1/arm-linux/lib
# for file in libc libcrypt libdl libm libpthread libresolv libutil
> do
> cp $file-*.so /mnt/lib
> cp -d $file.so.[*0-9] /mnt/lib
> done
# cp -d ld*.so* /mnt/lib
d. 复制busybox文件至ramdisk中:
# cp –rf /busybox-1.2.2.1/_install/* /mnt/
这样在ramdisk中就有:usr sbin linuxrc lib (将linuxrc文件删除)
# cd /mnt
# mkdir dev home root usr etc mnt sys tmp
#cd dev
#mknod -m 660 console c 5 1
#mknod -m 660 null c 1 3
# umount /dev/loop2
# losetup -d /dev/loop2
# gzip -9 ramdisk
以下为制作根文件系统的补充:
a. 建立设备文件名
可以用mknod手工建立,也可以直接从原系统的/dev目录下拷贝
b.建立etc目录下的配置文件
Busybox.conf motd mtab 都为空文件
Inittab内容如下:
Console::sysinit:/etc/init.d/rcS
ttyS0 :respawn :-/bin/sh
tty2 ::askfirst :-/bin/sh
tty0 ::askfirst :-/bin/sh
tty3 ::askfirst :-/bin/sh
tty4 ::askfirst :-/bin/sh
::restart:/sbin/init
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount –a –r
::shutdown:/sbin/swapoff –a
fstab内容如下:
/dev/fd0 / ext2 defaults 0 0
none /proc proc defaults 0 0
none /dev/pts devpts mode=0622 0 0
group内容如下:
root::0:root
