summaryrefslogtreecommitdiff
path: root/f2fs_utils
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@google.com>2021-06-13 09:00:31 -0700
committerJaegeuk Kim <jaegeuk@google.com>2021-06-24 22:30:12 -0700
commit41190085e089e98d695b21cf453b361608f48655 (patch)
treeabe0686ca5df728566e32e637cf2a65c44c9cc42 /f2fs_utils
parentf1eba1275482481620d047fea6e3010424b4538d (diff)
downloadextras-41190085e089e98d695b21cf453b361608f48655.tar.gz
Support block map for f2fs
Bug: 190760483 Signed-off-by: Jaegeuk Kim <jaegeuk@google.com> Change-Id: I9c382695595a31c0438af35be0effa9b3a7b5b49
Diffstat (limited to 'f2fs_utils')
-rwxr-xr-xf2fs_utils/mkf2fsuserimg.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/f2fs_utils/mkf2fsuserimg.sh b/f2fs_utils/mkf2fsuserimg.sh
index 013ff543..59f9eea5 100755
--- a/f2fs_utils/mkf2fsuserimg.sh
+++ b/f2fs_utils/mkf2fsuserimg.sh
@@ -7,7 +7,7 @@ cat<<EOT
Usage:
${0##*/} OUTPUT_FILE SIZE
[-S] [-C FS_CONFIG] [-f SRC_DIR] [-D PRODUCT_OUT]
- [-s FILE_CONTEXTS] [-t MOUNT_POINT] [-T TIMESTAMP]
+ [-s FILE_CONTEXTS] [-t MOUNT_POINT] [-T TIMESTAMP] [-B block_map]
[-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
@@ -21,6 +21,8 @@ echo "in mkf2fsuserimg.sh PATH=$PATH"
MKFS_OPTS=""
SLOAD_OPTS=""
+BLOCK_MAP_FILE=""
+BLOCK_MAP_OPT=""
if [ $# -lt 2 ]; then
usage
@@ -35,6 +37,7 @@ SPARSE_IMG="false"
if [[ "$1" == "-S" ]]; then
MKFS_OPTS+=" -S $SIZE"
SLOAD_OPTS+=" -S"
+ BLOCK_MAP_OPT+=" -S -M"
SPARSE_IMG="true"
shift
fi
@@ -76,6 +79,11 @@ if [[ "$1" == "-T" ]]; then
shift; shift
fi
+if [[ "$1" == "-B" ]]; then
+ BLOCK_MAP_FILE="$2"
+ shift; shift
+fi
+
if [[ "$1" == "-L" ]]; then
MKFS_OPTS+=" -l $2"
shift; shift
@@ -168,13 +176,17 @@ function _build()
_truncate
_build
-# readonly + compress can reduce the image
-if [ "$READONLY" ] && [ "$COMPRESS_SUPPORT" ]; then
+# readonly can reduce the image
+if [ "$READONLY" ]; then
if [ "$SPARSE_IMG" = "true" ]; then
MKFS_OPTS+=" -S $SIZE"
rm -f $OUTPUT_FILE && touch $OUTPUT_FILE
fi
_truncate
_build
+ # build block map
+ if [ "$BLOCK_MAP_FILE" ]; then
+ fsck.f2fs $BLOCK_MAP_OPT $OUTPUT_FILE > $BLOCK_MAP_FILE
+ fi
fi
exit 0