【CHICHI ETUTOR@ARM/MIPS/PPC】FILE SYSTEM 4 _ Make File system Images
1. Make different type File system images
1-1 Cramfs image
1-1 Cramfs image
#/bin/sh
CURRDIR=`pwd`
MKTOP=$CURRDIR/rootfs
FILEIMG=cramfs.img
rm -rf $FILEIMG 2>/dev/null
./tools/mkcramfs $MKTOP $FILEIMG
1-2 Jffs2 image
#/bin/sh
CURRDIR=`pwd`
MKTOP=$CURRDIR/rootfs
FILEIMG=jffs2.img
rm -rf $FILEIMG 2>/dev/null
./tools/mkfs.jffs2 -r $MKTOP -e 0x4000 -o $FILEIMG --pad=0xf00000 -n
1-3 ramdisk file
#/bin/sh
CURRDIR=`pwd`
MKTOP=$CURRDIR/rootfs
RAMDISKSIZE=8192
FILEIMG=$CURRDIR/initrd.gz
TMPIMG=$CURRDIR/initrd.tmp
MOUNTPOINT=$CURRDIR/mnt
USE_GZIP=1
sudo dd if=/dev/zero of=$TMPIMG bs=1k count=$RAMDISKSIZE
sudo /sbin/mke2fs -F -v -m0 $TMPIMG $RAMDISKSIZE
sudo mount -o loop $TMPIMG $MOUNTPOINT
sudo cp -a $MKTOP/* $MOUNTPOINT
cd $MOUNTPOINT
sudo chown -R root.root *
cd $CURRDIR
sudo umount $MOUNTPOINT || exit 1
sudo rm -rf $FILEIMG
if [ "$USE_GZIP" = "1" ]; then
gzip -c -9 $TMPIMG> $FILEIMG
else
FILEIMG=$CURRDIR/initrd.lzma
rm -rf $FILEIMG
./tools/lzma e $TMPIMG $FILEIMG
fi
rm -rf $MOUNTPOINT $TMPIMG
ls -lh $FILEIMG
2 Running the script files and generated the images
jessicatai@ubuntu:rootfs_build/toolfs$ lsinitrd.gz make_cramfs.sh make_jffs2.sh make_ramdisk.sh rootfs cramfs.img jffs2.img
0 意見:
張貼留言