From 88a233d5faa82e51050bdfacfebaf9624b073797 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Fri, 11 Nov 2011 00:41:57 -0800 Subject: [PATCH] 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 --- bmlutils/bmlutils.c | 16 +++++++--------- utilities/Android.mk | 10 +++------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/bmlutils/bmlutils.c b/bmlutils/bmlutils.c index c5de8b9b3..a7b09b416 100644 --- a/bmlutils/bmlutils.c +++ b/bmlutils/bmlutils.c @@ -172,8 +172,6 @@ int cmd_bml_get_partition_device(const char *partition, char *device) 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 @@ int format_rfs_device (const char *device, const char *path) { } // 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 14dace0cc..7d9544979 100755 --- a/utilities/Android.mk +++ b/utilities/Android.mk @@ -58,12 +58,10 @@ else 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_CLASS := RECOVERY_EXECUTABLES LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin LOCAL_SRC_FILES := $(LOCAL_MODULE) include $(BUILD_PREBUILT) - -endif - +endif \ No newline at end of file