Use the correct binary path for f2fs tools, and set the right flags.

Using a raw "bin/x" path only works on acloud / GCE instances where the
build artifacts are all placed in the home directory. The wrapper
function was introduced to make it work both locally and on GCE.

make_f2fs also needs to be passed "-g android", following
https://cs.android.com/android/_/android/platform/system/core/+/017a0acdcaf8eae1f2aabc59263b1a712c79f08b:fs_mgr/fs_mgr_format.cpp;l=139

Bug: 150654269
Bug: 156286088
Test: `launch_cvd -data_policy=always_create -blank_data_image_mb=2048`
Change-Id: I0579bc39112a6c8533b9ee1b3ff8cabcbe9b8d50
Merged-In: I0579bc39112a6c8533b9ee1b3ff8cabcbe9b8d50
diff --git a/host/commands/assemble_cvd/data_image.cc b/host/commands/assemble_cvd/data_image.cc
index 76d9892..e184cb8 100644
--- a/host/commands/assemble_cvd/data_image.cc
+++ b/host/commands/assemble_cvd/data_image.cc
@@ -15,7 +15,8 @@
 const int FSCK_ERROR_CORRECTED_REQUIRES_REBOOT = 2;
 
 bool ForceFsckImage(const char* data_image) {
-  int fsck_status = cvd::execute({"bin/fsck.f2fs", "-y", "-f", data_image});
+  auto fsck_path = vsoc::DefaultHostArtifactsPath("bin/fsck.f2fs");
+  int fsck_status = cvd::execute({fsck_path, "-y", "-f", data_image});
   if (fsck_status & ~(FSCK_ERROR_CORRECTED|FSCK_ERROR_CORRECTED_REQUIRES_REBOOT)) {
     LOG(ERROR) << "`fsck.f2fs -y -f " << data_image << "` failed with code "
                << fsck_status;
@@ -46,7 +47,8 @@
     if (!fsck_success) {
       return false;
     }
-    int resize_status = cvd::execute({"bin/resize.f2fs", data_image});
+    auto resize_path = vsoc::DefaultHostArtifactsPath("bin/resize.f2fs");
+    int resize_status = cvd::execute({resize_path, data_image});
     if (resize_status != 0) {
       LOG(ERROR) << "`resize.f2fs " << data_image << "` failed with code "
                  << resize_status;
@@ -72,7 +74,8 @@
   std::string bs = "bs=" + block_size;
   cvd::execute({"/bin/dd", "if=/dev/zero", of, bs, count});
   if (image_fmt != "none") {
-    cvd::execute({"bin/make_f2fs", "-t", image_fmt, image}, {"PATH=bin"});
+    auto make_f2fs_path = vsoc::DefaultHostArtifactsPath("bin/make_f2fs");
+    cvd::execute({make_f2fs_path, "-t", image_fmt, image, "-g", "android"});
   }
 }