diff options
-rwxr-xr-x | ext4_utils/mkuserimg_mke2fs.sh | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/ext4_utils/mkuserimg_mke2fs.sh b/ext4_utils/mkuserimg_mke2fs.sh index 64b1fe3f..ea73ff70 100755 --- a/ext4_utils/mkuserimg_mke2fs.sh +++ b/ext4_utils/mkuserimg_mke2fs.sh @@ -8,7 +8,8 @@ Usage: mkuserimg.sh [-s] SRC_DIR OUTPUT_FILE EXT_VARIANT MOUNT_POINT SIZE [-j <journal_size>] [-T TIMESTAMP] [-C FS_CONFIG] [-D PRODUCT_OUT] [-B BLOCK_LIST_FILE] [-d BASE_ALLOC_FILE_IN ] [-A BASE_ALLOC_FILE_OUT ] [-L LABEL] - [-i INODES ] [-e ERASE_BLOCK_SIZE] [-o FLASH_BLOCK_SIZE] [FILE_CONTEXTS] + [-i INODES ] [-e ERASE_BLOCK_SIZE] [-o FLASH_BLOCK_SIZE] + [-U MKE2FS_UUID] [-S MKE2FS_HASH_SEED] [FILE_CONTEXTS] EOT } @@ -17,6 +18,7 @@ BLOCKSIZE=4096 MKE2FS_OPTS="" MKE2FS_EXTENDED_OPTS="" E2FSDROID_OPTS="" +E2FSPROGS_FAKE_TIME="" if [ "$1" = "-s" ]; then MKE2FS_EXTENDED_OPTS+="android_sparse" @@ -53,6 +55,7 @@ fi if [[ "$1" == "-T" ]]; then E2FSDROID_OPTS+=" -T $2" + E2FSPROGS_FAKE_TIME=$2 shift; shift fi @@ -108,6 +111,19 @@ if [[ "$1" == "-o" ]]; then shift; shift fi +if [[ "$1" == "-U" ]]; then + MKE2FS_OPTS+=" -U $2" + shift; shift +fi + +if [[ "$1" == "-S" ]]; then + if [[ $MKE2FS_EXTENDED_OPTS ]]; then + MKE2FS_EXTENDED_OPTS+="," + fi + MKE2FS_EXTENDED_OPTS+="hash_seed=$2" + shift; shift +fi + if [[ $MKE2FS_EXTENDED_OPTS ]]; then MKE2FS_OPTS+=" -E $MKE2FS_EXTENDED_OPTS" fi @@ -141,16 +157,25 @@ SIZE=$((SIZE / BLOCKSIZE)) # truncate output file since mke2fs will keep verity section in existing file cat /dev/null >$OUTPUT_FILE +MAKE_EXT4FS_ENV="MKE2FS_CONFIG=./system/extras/ext4_utils/mke2fs.conf" +if [[ $E2FSPROGS_FAKE_TIME ]]; then + MAKE_EXT4FS_ENV+=" E2FSPROGS_FAKE_TIME=$E2FSPROGS_FAKE_TIME" +fi + MAKE_EXT4FS_CMD="mke2fs $MKE2FS_OPTS -t $EXT_VARIANT -b $BLOCKSIZE $OUTPUT_FILE $SIZE" -echo $MAKE_EXT4FS_CMD -MKE2FS_CONFIG=./system/extras/ext4_utils/mke2fs.conf $MAKE_EXT4FS_CMD +echo $MAKE_EXT4FS_ENV $MAKE_EXT4FS_CMD +env $MAKE_EXT4FS_ENV $MAKE_EXT4FS_CMD if [ $? -ne 0 ]; then exit 4 fi +if [[ $E2FSPROGS_FAKE_TIME ]]; then + E2FSDROID_ENV="E2FSPROGS_FAKE_TIME=$E2FSPROGS_FAKE_TIME" +fi + E2FSDROID_CMD="e2fsdroid $E2FSDROID_OPTS -f $SRC_DIR -a $MOUNT_POINT $OUTPUT_FILE" -echo $E2FSDROID_CMD -$E2FSDROID_CMD +echo $E2FSDROID_ENV $E2FSDROID_CMD +env $E2FSDROID_ENV $E2FSDROID_CMD if [ $? -ne 0 ]; then rm -f $OUTPUT_FILE exit 4 |