分类:
2008-04-27 13:18:50
其他的情况类似如此了,下面里面给了一个lunksys的GPL项目的target。
四、生成一个ramdisk
#!/bin/sh
MODULE_NAME=ramdisk
RAMPATH=`pwd`
TMPPATH=${RAMPATH}/tmp
SOURCE=${RAMPATH}/../target
if [ ! -d ${TMPPATH} ]
then
mkdir ${TMPPATH}
fi
if [ `whoami` != 'root' ]
then {
echo "You should run the shell as root, Please rerun as a root."
echo "Aborting."
exit 1
}
fi
# Clear in tmp path
rm -rf ${TMPPATH}/tmpmnt
rm -rf ${TMPPATH}/ramrootfs
mkdir ${TMPPATH}/tmpmnt
# Clear the old ramdisk
rm -f ${RAMPATH}/$MODULE_NAME
# Make a temp file which size is suitable
dd if=/dev/zero of=${TMPPATH}/ramrootfs bs=1k count=6144
# Create a ext2 filesystem
mke2fs -F -m 0 -i 2000 ${TMPPATH}/ramrootfs
# Mount it to tmpmnt/
mount -o loop -t ext2 ${TMPPATH}/ramrootfs ${TMPPATH}/tmpmnt
# Copy everything from kernel to this.
cd ${TMPPATH}/tmpmnt
echo ${SOURCE}
cp -av ${SOURCE}/* .
cd ${TMPPATH}
# Unmount it the ext2 filesystem
umount ${TMPPATH}/tmpmnt
cat ${TMPPATH}/ramrootfs | gzip -9 > /${RAMPATH}/ramdisk
echo Copying ramdisk image to ${RAMPATH}
sync
这里给出一个自动生成脚本!
五、生成一个cramfs
找到cramfs的toolchain。/mkcramfs -r $(FS1_DIR) $(FS_NAME).1
六、生成一个mksquashfs
找到squashfs的toolchain。/mksquashfs $(FS_DIR) $(FS_NAME) -noappend -be -lzma -no-fragments -noI
做文件系统最困难和最可能出问题的地方是在/lib库和/dev方面,请大家多注意这两方面。