根据实际情况来修改下面的脚本文件:
cd ~
if [ -d ~/rootfs ] ;then #判断家目录下是否有rootfs文件夹,如果话就退出程序
echo "The home is have rootfs directory!!"
echo "Can\`t create rootfs ,program exit. "
else
mkdir rootfs
cd rootfs
for file in bin dev etc lib proc sbin usr var tmp #用for循环来创建文件夹
do
mkdir $file
echo "The $file is create......"
done
chmod 1777 tmp
echo "tmp directory right is 1777"
echo "none /proc proc defaults 0 0" > etc/fstab
chmod 755 etc/fstab
echo "The fstab is create,the right is 755 ."
echo "::sysinit:/etc/init.d/rcS" > etc/inittab
echo "::sysinit:/bin/sh" >> etc/inittab
chmod 755 etc/inittab
echo "The inittab is create,the right is 755 ."
touch etc/busybox.conf
mkdir etc/init.d
echo "#!/bin/sh" > etc/init.d/rcS
echo "/bin/mount -a" >> etc/init.d/rcS
chmod 755 etc/init.d/rcS
echo " rcS is create,the right is 755"
echo "#!/bin/sh" > etc/profile
echo "PS1=[\\w]#" >> etc/profile
echo "alias ll='ls -l'" >> etc/profile
chmod 755 etc/profile
echo "The profile is create.the right is 755."
mknod -m 600 dev/console c 5 1
mknod -m 666 dev/null c 1 3
echo "console driver is create.c 5 1 the right is 600"
echo "null driver is create. c 13 the right is 666"
cd /armtools/arm-linux/lib
for file in libc libcrypt libdl libm libpthread libresolv libutil
do
cp $file-*.so ~/rootfs/lib
cp -d $file.so.[*0-9] ~/rootfs/lib
done
cp -d ld*.so* ~/rootfs/lib
if [ "$1" = "" ] ;then #判断 busybox 的路径
echo ""
echo "You don\`t input the busybox path."
echo "Please copy busybox file for youself."
echo ""
else
if [ -d $1/_install ] ;then #复制busybox产生的文件
echo "copy busybox file ...... "
cd $1/_install
cp -Rvf $1/_install/* ~/rootfs/ > /dev/null
echo "copy busybox file is done."
cd ~
if [ -f ~/root.cramfs ] ;then
echo "the root.cramfs is have.Please input the other name."
read name
echo "makeing file system ......"
mkcramfs rootfs $name.cramfs
echo "The file system is done."
echo ""
echo "The root.cramfs is at ~/$name.cramfs."
echo ""
else
echo "makeing file system ......"
mkcramfs rootfs root.cramfs
echo "The file system is done."
echo ""
echo "The root.cramfs is at ~/root.cramfs."
echo ""
fi
else
echo ""
echo "You input the path is wrong.do not copy busybox file."
echo ""
fi
fi
fi