Fix up bmlutils to include fat.format automatically if rfs is found in the recovery.fstab. Use __system rather than run_exec_process.
Change-Id: I669bfb75cf0cc00364b815b54130c01786866406
diff --git a/bmlutils/bmlutils.c b/bmlutils/bmlutils.c
index c5de8b9..a7b09b4 100644
--- a/bmlutils/bmlutils.c
+++ b/bmlutils/bmlutils.c
@@ -172,8 +172,6 @@
return -1;
}
-int run_exec_process ( char **argv);
-
int format_rfs_device (const char *device, const char *path) {
const char *fatsize = "32";
const char *sectorsize = "1";
@@ -188,17 +186,17 @@
}
// dump 10KB of zeros to partition before format due to fat.format bug
- char ofdevice[PATH_MAX];
- snprintf(ofdevice, sizeof(ofdevice), "of=%s", device);
- const char *rfszerodump[] = {"/sbin/dd", "if=/dev/zero", ofdevice, "bs=4096", "count=10", NULL};
- if(run_exec_process((char **)rfszerodump)) {
- printf("failure while running rfszerodump\n");
+ char cmd[PATH_MAX];
+
+ sprintf(cmd, "/sbin/dd if=/dev/zero of=%s bs=4096 count=10", device);
+ if(__system(cmd)) {
+ printf("failure while zeroing rfs partition.\n");
return -1;
}
// Run fat.format
- const char *fatformat[] = {"/sbin/fat.format", "-F", fatsize, "-S", "4096", "-s", sectorsize, device, NULL};
- if(run_exec_process((char **)fatformat)) {
+ sprintf(cmd, "/sbin/fat.format -F %s -S 4096 -s %s %s", fatsize, sectorsize, device);
+ if(__system(cmd)) {
printf("failure while running fat.format\n");
return -1;
}
diff --git a/utilities/Android.mk b/utilities/Android.mk
index 14dace0..7d95449 100755
--- a/utilities/Android.mk
+++ b/utilities/Android.mk
@@ -58,12 +58,10 @@
LOCAL_SRC_FILES := ../../../$(BOARD_MKE2FS)
endif
include $(BUILD_PREBUILT)
-
-
endif
-ifdef BOARD_HAS_RFS_FILESYSTEM
-
+BOARD_RECOVERY_RFS_CHECK := $(shell grep rfs $(TARGET_DEVICE_DIR)/recovery.fstab)
+ifneq ($(BOARD_RECOVERY_RFS_CHECK),)
include $(CLEAR_VARS)
LOCAL_MODULE := fat.format
LOCAL_MODULE_TAGS := eng
@@ -71,6 +69,4 @@
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
-
-endif
-
+endif
\ No newline at end of file