1#!/bin/bash
2#
3# To call this script, make sure make_f2fs is somewhere in PATH
4
5function usage() {
6cat<<EOT
7Usage:
8${0##*/} OUTPUT_FILE SIZE
9EOT
10}
11
12echo "in mkf2fsuserimg.sh PATH=$PATH"
13
14if [ $# -lt 2 ]; then
15  usage
16  exit 1
17fi
18
19OUTPUT_FILE=$1
20SIZE=$2
21shift; shift
22
23
24if [ -z $SIZE ]; then
25  echo "Need size of filesystem"
26  exit 2
27fi
28
29MAKE_F2FS_CMD="make_f2fs -S $SIZE $OUTPUT_FILE"
30echo $MAKE_F2FS_CMD
31$MAKE_F2FS_CMD
32if [ $? -ne 0 ]; then
33  exit 4
34fi
35