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
This commit is contained in:
Koushik Dutta 2011-11-11 00:41:57 -08:00
parent 2291705c41
commit 88a233d5fa
2 changed files with 10 additions and 16 deletions

View File

@ -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;
}

View File

@ -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