blob: f81268c77ef7f36dd350c71a31a8c8cb7ca79938 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001#!/bin/bash
2
3
4usage()
5{
6 printf "The right format is:\n"
7 printf "./pack_one_image.sh <PATH_TO_IMAGE_DIR> <PARTITION_SIZE> <EXT4_IMAGE_NAME> \n"
8 exit
9}
10
11
12
13OUTDIR=`pwd`
14if [ -d "$1" ]; then
15 TARDIR=$OUTDIR/out/
16 if [ $2 ] && [ $3 ]; then
17 set -e
18 $OUTDIR/tools/make_ext4fs -s -j 1 -l $2 $TARDIR/one_sparse.img $1 1> /dev/null
19 $OUTDIR/tools/simg2img $TARDIR/one_sparse.img $TARDIR/$3
20 set +e
21 else
22 usage
23 fi
24else
25 usage
26fi
27
28
29rm -f $TARDIR/one_sparse.img
30
31
32