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] [-w WHITELIST_FILE] [-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 if [[ "$1" == "-w" ]]; then
94 DISABLE_4K_ALIGN=false
95 if [[ "$1" == "-a" ]]; then
101 if [ -n "$MOUNT_POINT" ]; then
102 OPT="$OPT -mount-point $MOUNT_POINT"
104 if [ -n "$PRODUCT_OUT" ]; then
105 OPT="$OPT -product-out $PRODUCT_OUT"
107 if [ -n "$FS_CONFIG" ]; then
108 OPT="$OPT -fs-config-file $FS_CONFIG"
110 if [ -n "$FILE_CONTEXTS" ]; then
111 OPT="$OPT -context-file $FILE_CONTEXTS"
113 if [ -n "$BLOCK_MAP_FILE" ]; then
114 OPT="$OPT -block-map $BLOCK_MAP_FILE"
116 if [ -n "$BLOCK_SIZE" ]; then
117 OPT="$OPT -b $BLOCK_SIZE"
119 if [ -n "$COMPRESS_THRESHOLD" ]; then
120 OPT="$OPT -t $COMPRESS_THRESHOLD"
122 if [ "$DISABLE_4K_ALIGN" = true ]; then
123 OPT="$OPT -disable-4k-align"
125 if [ -n "$WHITELIST_FILE" ]; then
126 OPT="$OPT -whitelist $WHITELIST_FILE"
129 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"
130 echo $MAKE_SQUASHFS_CMD
133 if [ $? -ne 0 ]; then
137 SPARSE_SUFFIX=".sparse"
138 if [ "$SPARSE" = true ]; then
139 img2simg $OUTPUT_FILE $OUTPUT_FILE$SPARSE_SUFFIX
140 if [ $? -ne 0 ]; then
143 mv $OUTPUT_FILE$SPARSE_SUFFIX $OUTPUT_FILE