3 # To call this script, make sure make_ext4fs is somewhere in PATH
8 mkuserimg.sh [-s] SRC_DIR OUTPUT_FILE EXT_VARIANT MOUNT_POINT SIZE [-j <journal_size>]
9 [-T TIMESTAMP] [-C FS_CONFIG] [-D PRODUCT_OUT] [-B BLOCK_LIST_FILE]
10 [-d BASE_ALLOC_FILE_IN ] [-A BASE_ALLOC_FILE_OUT ] [-L LABEL]
11 [-i INODES ] [-e ERASE_BLOCK_SIZE] [-o FLASH_BLOCK_SIZE] [FILE_CONTEXTS]
16 if [ "$1" = "-s" ]; then
17 ENABLE_SPARSE_IMAGE="-s"
27 if [ ! -d $SRC_DIR ]; then
28 echo "Can not find directory $SRC_DIR!"
36 shift; shift; shift; shift; shift
39 if [ "$1" = "-j" ]; then
40 if [ "$2" = "0" ]; then
49 if [[ "$1" == "-T" ]]; then
55 if [[ "$1" == "-C" ]]; then
61 if [[ "$1" == "-D" ]]; then
67 if [[ "$1" == "-B" ]]; then
73 if [[ "$1" == "-d" ]]; then
79 if [[ "$1" == "-A" ]]; then
80 BASE_ALLOC_FILE_OUT=$2
85 if [[ "$1" == "-L" ]]; then
91 if [[ "$1" == "-i" ]]; then
97 if [[ "$1" == "-e" ]]; then
103 if [[ "$1" == "-o" ]]; then
111 *) echo "Only ext4 is supported!"; exit 3 ;;
114 if [ -z $MOUNT_POINT ]; then
115 echo "Mount point is required"
119 if [ -z $SIZE ]; then
120 echo "Need size of filesystem"
125 if [ -n "$FC" ]; then
128 if [ -n "$FS_CONFIG" ]; then
129 OPT="$OPT -C $FS_CONFIG"
131 if [ -n "$BLOCK_LIST" ]; then
132 OPT="$OPT -B $BLOCK_LIST"
134 if [ -n "$BASE_ALLOC_FILE_IN" ]; then
135 OPT="$OPT -d $BASE_ALLOC_FILE_IN"
137 if [ -n "$BASE_ALLOC_FILE_OUT" ]; then
138 OPT="$OPT -D $BASE_ALLOC_FILE_OUT"
140 if [ -n "$LABEL" ]; then
143 if [ -n "$INODES" ]; then
144 OPT="$OPT -i $INODES"
146 if [ -n "$ERASE_SIZE" ]; then
147 OPT="$OPT -e $ERASE_SIZE"
149 if [ -n "$FLASH_BLOCK_SIZE" ]; then
150 OPT="$OPT -o $FLASH_BLOCK_SIZE"
153 MAKE_EXT4FS_CMD="make_ext4fs $ENABLE_SPARSE_IMAGE -T $TIMESTAMP $OPT -l $SIZE $JOURNAL_FLAGS -a $MOUNT_POINT $OUTPUT_FILE $SRC_DIR $PRODUCT_OUT"
154 echo $MAKE_EXT4FS_CMD
156 if [ $? -ne 0 ]; then