3 # To call this script, make sure mksquashfs is somewhere in PATH
8 ${0##*/} SRC_DIR OUTPUT_FILE [-s] [-m MOUNT_POINT] [-d PRODUCT_OUT] [-C FS_CONFIG ] [-c FILE_CONTEXTS] [-b BLOCK_SIZE] [-z COMPRESSOR] [-zo COMPRESSOR_OPT]
12 echo "in mksquashfsimage.sh PATH=$PATH"
20 if [ ! -d $SRC_DIR ]; then
21 echo "Can not find directory $SRC_DIR!"
28 if [[ "$1" == "-s" ]]; then
34 if [[ "$1" == "-m" ]]; then
40 if [[ "$1" == "-d" ]]; then
46 if [[ "$1" == "-C" ]]; then
52 if [[ "$1" == "-c" ]]; then
58 if [[ "$1" == "-b" ]]; then
65 if [[ "$1" == "-z" ]]; then
71 if [[ "$1" == "-zo" ]]; then
77 if [ -n "$MOUNT_POINT" ]; then
78 OPT="$OPT -mount-point $MOUNT_POINT"
80 if [ -n "$PRODUCT_OUT" ]; then
81 OPT="$OPT -product-out $PRODUCT_OUT"
83 if [ -n "$FS_CONFIG" ]; then
84 OPT="$OPT -fs-config-file $FS_CONFIG"
86 if [ -n "$FILE_CONTEXTS" ]; then
87 OPT="$OPT -context-file $FILE_CONTEXTS"
89 if [ -n "$BLOCK_SIZE" ]; then
90 OPT="$OPT -b $BLOCK_SIZE"
93 MAKE_SQUASHFS_CMD="mksquashfs $SRC_DIR/ $OUTPUT_FILE -no-progress -comp $COMPRESSOR $COMPRESSOR_OPT -no-exports -noappend -no-recovery -android-fs-config -no-fragments $OPT"
94 echo $MAKE_SQUASHFS_CMD
101 SPARSE_SUFFIX=".sparse"
102 if [ "$SPARSE" = true ]; then
103 img2simg $OUTPUT_FILE $OUTPUT_FILE$SPARSE_SUFFIX
104 if [ $? -ne 0 ]; then
107 mv $OUTPUT_FILE$SPARSE_SUFFIX $OUTPUT_FILE