summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fastboot/Android.mk11
-rw-r--r--fastboot/fs.c12
-rw-r--r--fs_mgr/fs_mgr.c15
3 files changed, 33 insertions, 5 deletions
diff --git a/fastboot/Android.mk b/fastboot/Android.mk
index 73794a0..8fc1f0b 100644
--- a/fastboot/Android.mk
+++ b/fastboot/Android.mk
@@ -17,7 +17,8 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../mkbootimg \
- $(LOCAL_PATH)/../../extras/ext4_utils
+ $(LOCAL_PATH)/../../extras/ext4_utils \
+ $(LOCAL_PATH)/../../extras/f2fs_utils
LOCAL_SRC_FILES := protocol.c engine.c bootimg.c fastboot.c util.c fs.c
LOCAL_MODULE := fastboot
LOCAL_MODULE_TAGS := debug
@@ -50,14 +51,20 @@ ifeq ($(HOST_OS),windows)
LOCAL_C_INCLUDES += development/host/windows/usb/api
endif
+# The following libf2fs_* are from system/extras/f2fs_utils,
+# and do not use code in external/f2fs-tools.
LOCAL_STATIC_LIBRARIES := \
$(EXTRA_STATIC_LIBS) \
libzipfile \
libunz \
libext4_utils_host \
+ libf2fs_utils_host \
+ libf2fs_dlutils_host \
libsparse_host \
libz
-
+# libf2fs_dlutils_host will dlopen("libf2fs_fmt_host_dyn")
+LOCAL_LDLIBS := -ldl
+LOCAL_SHARED_LIBRARIES := libf2fs_fmt_host_dyn
ifneq ($(HOST_OS),windows)
LOCAL_STATIC_LIBRARIES += libselinux
endif # HOST_OS != windows
diff --git a/fastboot/fs.c b/fastboot/fs.c
index cd4b880..11e391b 100644
--- a/fastboot/fs.c
+++ b/fastboot/fs.c
@@ -1,5 +1,6 @@
#include "fastboot.h"
#include "make_ext4fs.h"
+#include "make_f2fs.h"
#include "fs.h"
#include <errno.h>
@@ -28,15 +29,20 @@ static int generate_ext4_image(int fd, long long partSize)
return 0;
}
+int generate_f2fs_image(int fd, long long partSize)
+{
+ make_f2fs_sparse_fd(fd, partSize, NULL, NULL);
+ return 0;
+}
+
static const struct fs_generator {
char *fs_type; //must match what fastboot reports for partition type
int (*generate)(int fd, long long partSize); //returns 0 or error value
} generators[] = {
-
- { "ext4", generate_ext4_image}
-
+ { "ext4", generate_ext4_image},
+ { "f2fs", generate_f2fs_image},
};
const struct fs_generator* fs_get_generator(const char *fs_type)
diff --git a/fs_mgr/fs_mgr.c b/fs_mgr/fs_mgr.c
index ee3cbf9..d2938cf 100644
--- a/fs_mgr/fs_mgr.c
+++ b/fs_mgr/fs_mgr.c
@@ -46,6 +46,7 @@
#define KEY_IN_FOOTER "footer"
#define E2FSCK_BIN "/system/bin/e2fsck"
+#define F2FS_FSCK_BIN "/system/bin/fsck.f2fs"
#define MKSWAP_BIN "/system/bin/mkswap"
#define FSCK_LOG_FILE "/dev/fscklogs/log"
@@ -135,6 +136,20 @@ static void check_fs(char *blk_device, char *fs_type, char *target)
ERROR("Failed trying to run %s\n", E2FSCK_BIN);
}
}
+ } else if (!strcmp(fs_type, "f2fs")) {
+ char *f2fs_fsck_argv[] = {
+ F2FS_FSCK_BIN,
+ blk_device
+ };
+ INFO("Running %s on %s\n", F2FS_FSCK_BIN, blk_device);
+
+ ret = android_fork_execvp_ext(ARRAY_SIZE(f2fs_fsck_argv), f2fs_fsck_argv,
+ &status, true, LOG_KLOG | LOG_FILE,
+ true, FSCK_LOG_FILE);
+ if (ret < 0) {
+ /* No need to check for error in fork, we can't really handle it now */
+ ERROR("Failed trying to run %s\n", F2FS_FSCK_BIN);
+ }
}
return;