diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-06-02 01:09:17 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-06-02 01:09:17 +0000 |
commit | 7419824db5e973acf465f3ee0cc4a054a985b737 (patch) | |
tree | 582297646f439000d35b398cbb6b523d30db2578 | |
parent | 75ae6b58171a343d9c72ba01fe6b5172965386f7 (diff) | |
parent | fc0691cc2c46ec53c035bc227c15ed66a5dbd858 (diff) | |
download | extras-7419824db5e973acf465f3ee0cc4a054a985b737.tar.gz |
Snap for 7414767 from fc0691cc2c46ec53c035bc227c15ed66a5dbd858 to sc-d1-release
Change-Id: If9a5cdab61b0f8d919cd08b7129c119bed1c685d
-rwxr-xr-x | f2fs_utils/mkf2fsuserimg.sh | 63 | ||||
-rw-r--r-- | toolchain-extras/profile-clang-extras.cpp | 10 |
2 files changed, 45 insertions, 28 deletions
diff --git a/f2fs_utils/mkf2fsuserimg.sh b/f2fs_utils/mkf2fsuserimg.sh index 522f9ea4..013ff543 100755 --- a/f2fs_utils/mkf2fsuserimg.sh +++ b/f2fs_utils/mkf2fsuserimg.sh @@ -8,7 +8,7 @@ Usage: ${0##*/} OUTPUT_FILE SIZE [-S] [-C FS_CONFIG] [-f SRC_DIR] [-D PRODUCT_OUT] [-s FILE_CONTEXTS] [-t MOUNT_POINT] [-T TIMESTAMP] - [-L LABEL] [--prjquota] [--casefold] [--compression] + [-L LABEL] [--prjquota] [--casefold] [--compression] [--readonly] [--sldc <num> [sload compression sub-options]] <num>: number of the sload compression args, e.g. -a LZ4 counts as 2 when sload compression args are not given, <num> must be 0, @@ -95,6 +95,11 @@ if [[ "$1" == "--compression" ]]; then MKFS_OPTS+=" -O compression,extra_attr" shift; fi +if [[ "$1" == "--readonly" ]]; then + MKFS_OPTS+=" -O ro" + READONLY=1 + shift; +fi if [[ "$1" == "--sldc" ]]; then if [ -z "$COMPRESS_SUPPORT" ]; then @@ -122,32 +127,54 @@ if [ -z $SIZE ]; then exit 2 fi -if [ "$SPARSE_IMG" = "false" ]; then +function _truncate() +{ + if [ "$SPARSE_IMG" = "true" ]; then + return + fi + TRUNCATE_CMD="truncate -s $SIZE $OUTPUT_FILE" echo $TRUNCATE_CMD $TRUNCATE_CMD if [ $? -ne 0 ]; then exit 3 fi -fi +} -MAKE_F2FS_CMD="make_f2fs -g android $MKFS_OPTS $OUTPUT_FILE" -echo $MAKE_F2FS_CMD -$MAKE_F2FS_CMD -if [ $? -ne 0 ]; then - if [ "$SPARSE_IMG" = "false" ]; then +function _build() +{ + MAKE_F2FS_CMD="make_f2fs -g android $MKFS_OPTS $OUTPUT_FILE" + echo $MAKE_F2FS_CMD + $MAKE_F2FS_CMD + if [ $? -ne 0 ]; then + if [ "$SPARSE_IMG" = "false" ]; then + rm -f $OUTPUT_FILE + fi + exit 4 + fi + + SLOAD_F2FS_CMD="sload_f2fs $SLOAD_OPTS $OUTPUT_FILE" + echo $SLOAD_F2FS_CMD + MB_SIZE=`$SLOAD_F2FS_CMD | grep "Max image size" | awk '{print $5}'` + # allow 1: Filesystem errors corrected + ret=$? + if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then rm -f $OUTPUT_FILE + exit 4 fi - exit 4 -fi + SIZE=$(((MB_SIZE + 6) * 1024 * 1024)) +} + +_truncate +_build -SLOAD_F2FS_CMD="sload_f2fs $SLOAD_OPTS $OUTPUT_FILE" -echo $SLOAD_F2FS_CMD -$SLOAD_F2FS_CMD -# allow 1: Filesystem errors corrected -ret=$? -if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then - rm -f $OUTPUT_FILE - exit 4 +# readonly + compress can reduce the image +if [ "$READONLY" ] && [ "$COMPRESS_SUPPORT" ]; then + if [ "$SPARSE_IMG" = "true" ]; then + MKFS_OPTS+=" -S $SIZE" + rm -f $OUTPUT_FILE && touch $OUTPUT_FILE + fi + _truncate + _build fi exit 0 diff --git a/toolchain-extras/profile-clang-extras.cpp b/toolchain-extras/profile-clang-extras.cpp index 4e5aca97..89c18b2a 100644 --- a/toolchain-extras/profile-clang-extras.cpp +++ b/toolchain-extras/profile-clang-extras.cpp @@ -36,16 +36,6 @@ static void llvm_signal_handler(__unused int signum) { } } -#if __ANDROID_API__ >= 21 -void writeFileWithoutReturn() { - __llvm_profile_write_file(); -} - -__attribute__((constructor)) void register_quick_exit_handler(void) { - at_quick_exit(writeFileWithoutReturn); -} -#endif // #if __ANDROID_API__ >= 21 - __attribute__((weak)) int init_profile_extras_once = 0; // Initialize libprofile-extras: |