OSDN Git Service

SquashFS whitelist support.
authorMohan Srinivasan <srmohan@google.com>
Tue, 26 Jul 2016 22:10:29 +0000 (15:10 -0700)
committerDaniel Rosenberg <drosen@google.com>
Thu, 9 Feb 2017 02:00:32 +0000 (18:00 -0800)
Support for specifying a (whole file) whitelist to mksquashfs, so that
frequently read in files will not be compressed.
Bug: 28605313
Signed-off-by: Mohan Srinivasan <srmohan@google.com>
Change-Id: I07c848266ed656b7df3daf7f0e3569f5c9012280

squashfs_utils/mksquashfsimage.sh

index 6a2ec1c..8357415 100755 (executable)
@@ -5,7 +5,7 @@
 function usage() {
 cat<<EOT
 Usage:
-${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]
+${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]
 EOT
 }
 
@@ -85,6 +85,11 @@ if [[ "$1" == "-t" ]]; then
     shift; shift
 fi
 
+WHITELIST_FILE=
+if [[ "$1" == "-w" ]]; then
+    WHITELIST_FILE=$2
+    shift; shift
+fi
 
 DISABLE_4K_ALIGN=false
 if [[ "$1" == "-a" ]]; then
@@ -117,6 +122,9 @@ fi
 if [ "$DISABLE_4K_ALIGN" = true ]; then
   OPT="$OPT -disable-4k-align"
 fi
+if [ -n "$WHITELIST_FILE" ]; then
+    OPT="$OPT -whitelist $WHITELIST_FILE"
+fi
 
 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"
 echo $MAKE_SQUASHFS_CMD