fastboot: make_f2fs call by linux/darwin

Bug: 69298953
Change-Id: I6a7483e8617b649666247c4ca985384d086f15f8
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
diff --git a/fastboot/Android.mk b/fastboot/Android.mk
index 7723ec6..b0b2337 100644
--- a/fastboot/Android.mk
+++ b/fastboot/Android.mk
@@ -39,7 +39,7 @@
 LOCAL_MODULE_TAGS := debug
 LOCAL_MODULE_HOST_OS := darwin linux windows
 LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code
-LOCAL_REQUIRED_MODULES := mke2fs e2fsdroid
+LOCAL_REQUIRED_MODULES := mke2fs e2fsdroid make_f2fs
 
 LOCAL_SRC_FILES_linux := usb_linux.cpp
 LOCAL_STATIC_LIBRARIES_linux := libselinux
@@ -66,8 +66,6 @@
     libcutils \
     libgtest_host \
 
-LOCAL_CFLAGS_linux := -DUSE_F2FS
-
 LOCAL_CXX_STL := libc++_static
 
 # Don't add anything here, we don't want additional shared dependencies
@@ -80,6 +78,7 @@
 my_dist_files := $(LOCAL_BUILT_MODULE)
 my_dist_files += $(HOST_OUT_EXECUTABLES)/mke2fs$(HOST_EXECUTABLE_SUFFIX)
 my_dist_files += $(HOST_OUT_EXECUTABLES)/e2fsdroid$(HOST_EXECUTABLE_SUFFIX)
+my_dist_files += $(HOST_OUT_EXECUTABLES)/make_f2fs$(HOST_EXECUTABLE_SUFFIX)
 $(call dist-for-goals,dist_files sdk win_sdk,$(my_dist_files))
 ifdef HOST_CROSS_OS
 # Archive fastboot.exe for win_sdk build.
diff --git a/fastboot/fs.cpp b/fastboot/fs.cpp
index 8877b09..4141a3b 100644
--- a/fastboot/fs.cpp
+++ b/fastboot/fs.cpp
@@ -154,10 +154,10 @@
     return 0;
 }
 
-#ifdef USE_F2FS
 static int generate_f2fs_image(const char* fileName, long long partSize, const std::string& initial_dir,
                                unsigned /* unused */, unsigned /* unused */)
 {
+#ifndef WIN32
     const std::string exec_dir = android::base::GetExecutableDirectory();
     const std::string mkf2fs_path = exec_dir + "/make_f2fs";
     std::vector<const char*> mkf2fs_args = {mkf2fs_path.c_str()};
@@ -180,12 +180,15 @@
     }
 
     if (!initial_dir.empty()) {
-        fprintf(stderr, "Unable to set initial directory on F2FS filesystem: %s\n", strerror(errno));
-        return -1;
+        fprintf(stderr, "sload.f2s not supported yet\n");
+        return 0;
     }
     return 0;
-}
+#else
+    fprintf(stderr, "make_f2fs not supported on Windows\n");
+    return -1;
 #endif
+}
 
 static const struct fs_generator {
     const char* fs_type;  //must match what fastboot reports for partition type
@@ -196,9 +199,7 @@
 
 } generators[] = {
     { "ext4", generate_ext4_image},
-#ifdef USE_F2FS
     { "f2fs", generate_f2fs_image},
-#endif
 };
 
 const struct fs_generator* fs_get_generator(const std::string& fs_type) {