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_MAP_FILE] [-b BLOCK_SIZE] [-z COMPRESSOR] [-zo COMPRESSOR_OPT] [-t COMPRESS_THRESHOLD] [-a]
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
64 if [[ "$1" == "-b" ]]; then
71 if [[ "$1" == "-z" ]]; then
77 if [[ "$1" == "-zo" ]]; then
83 if [[ "$1" == "-t" ]]; then
89 DISABLE_4K_ALIGN=false
90 if [[ "$1" == "-a" ]]; then
96 if [ -n "$MOUNT_POINT" ]; then
97 OPT="$OPT -mount-point $MOUNT_POINT"
99 if [ -n "$PRODUCT_OUT" ]; then
100 OPT="$OPT -product-out $PRODUCT_OUT"
102 if [ -n "$FS_CONFIG" ]; then
103 OPT="$OPT -fs-config-file $FS_CONFIG"
105 if [ -n "$FILE_CONTEXTS" ]; then
106 OPT="$OPT -context-file $FILE_CONTEXTS"
108 if [ -n "$BLOCK_MAP_FILE" ]; then
109 OPT="$OPT -block-map $BLOCK_MAP_FILE"
111 if [ -n "$BLOCK_SIZE" ]; then
112 OPT="$OPT -b $BLOCK_SIZE"
114 if [ -n "$COMPRESS_THRESHOLD" ]; then
115 OPT="$OPT -t $COMPRESS_THRESHOLD"
117 if [ "$DISABLE_4K_ALIGN" = true ]; then
118 OPT="$OPT -disable-4k-align"
121 MAKE_SQUASHFS_CMD="mksquashfs $SRC_DIR/ $OUTPUT_FILE -no-progress -comp $COMPRESSOR $COMPRESSOR_OPT -no-exports -noappend -no-recovery -no-fragments -no-duplicates -android-fs-config $OPT"
122 echo $MAKE_SQUASHFS_CMD
125 if [ $? -ne 0 ]; then
129 SPARSE_SUFFIX=".sparse"
130 if [ "$SPARSE" = true ]; then
131 img2simg $OUTPUT_FILE $OUTPUT_FILE$SPARSE_SUFFIX
132 if [ $? -ne 0 ]; then
135 mv $OUTPUT_FILE$SPARSE_SUFFIX $OUTPUT_FILE