从 http://sourceforge.net/projects/e2fsprogs/ 下载 e2fsprogs 源代码包
bash# cd /usr/src/e2fsprogs-1.35 bash# export CC="gcc -mcpu=i386" bash# ./configure --host=i386-pc-linux-gnu bash# make bash# cd e2fsck bash# cp e2fsck.shared ~/staging/sbin/e2fsck bash# ln -s e2fsck ~/staging/sbin/fsck.ext2 bash# cd ../misc bash# cp fsck mke2fs ~/staging/sbin bash# ln -s mke2fs ~/staging/sbin/mkfs.ext2 |
从 ftp://ftp.win.tue.nl/pub/linux-local/utils/util-linux/ 获取最新的 util-linux 源代码
bash# cd /usr/src/util-linux-2.12h |
使用文本编辑器进行以下更改,修改MCONFIG:
将 “CPU=$(shell uname -m)” 更改为 “CPU=i386”
将 “HAVE_SHADOW=yes” 更改为 “HAVE_SHADOW=no”
bash# ./configure bash# make bash# cp disk-utils/mkfs ~/staging/sbin bash# cp fdisk/fdisk ~/staging/sbin bash# cp login-utils/agetty ~/staging/sbin bash# ln -s agetty ~/staging/sbin/getty bash# cp login-utils/login ~/staging/bin bash# cp misc-utils/kill ~/staging/bin bash# cp mount/mount ~/staging/bin bash# cp mount/umount ~/staging/bin bash# cp mount/swapon ~/staging/sbin bash# cp sys-utils/dmesg ~/staging/bin |
bash# ldd ~/staging/bin/* | more bash# ldd ~/staging/sbin/* | more bash# ls ~/staging/lib |
通过 ldd 命令显示的所有依赖项都是暂存区中已存在的库,因此无需复制任何新内容。
bash# mknod ~/staging/dev/ram0 b 1 0 bash# mknod ~/staging/dev/fd0 b 2 0 bash# mknod ~/staging/dev/null c 1 3 |
bash# cd ~/staging/etc |
使用像 vi、emacs 或 pico 这样的编辑器创建以下文件并将其保存为~/staging/etc/fstab.
proc /proc proc defaults 0 0 /dev/ram0 / ext2 defaults 1 1 |
创建一个空的 mtab 文件。
bash# echo -n >mtab |
使用编辑器创建以下 shell 脚本并将其保存为~/staging/etc/init.d/local_fs:
#!/bin/sh # # local_fs - check and mount local filesystems # PATH=/sbin:/bin ; export PATH fsck -ATCp if [ $? -gt 1 ]; then echo "Filesystem errors still exist! Manual intervention required." /bin/sh else echo "Remounting / as read-write." mount -n -o remount,rw / echo -n >/etc/mtab mount -f -o remount,rw / echo "Mounting local filesystems." mount -a -t nonfs,nosmbfs fi # # end of local_fs |
设置脚本的执行权限。
bash# chmod +x local_fs |