blob: f81268c77ef7f36dd350c71a31a8c8cb7ca79938 [file] [log] [blame]
#!/bin/bash
usage()
{
printf "The right format is:\n"
printf "./pack_one_image.sh <PATH_TO_IMAGE_DIR> <PARTITION_SIZE> <EXT4_IMAGE_NAME> \n"
exit
}
OUTDIR=`pwd`
if [ -d "$1" ]; then
TARDIR=$OUTDIR/out/
if [ $2 ] && [ $3 ]; then
set -e
$OUTDIR/tools/make_ext4fs -s -j 1 -l $2 $TARDIR/one_sparse.img $1 1> /dev/null
$OUTDIR/tools/simg2img $TARDIR/one_sparse.img $TARDIR/$3
set +e
else
usage
fi
else
usage
fi
rm -f $TARDIR/one_sparse.img