Skip to content

Commit

Permalink
Fix up bmlutils to include fat.format automatically if rfs is found i…
Browse files Browse the repository at this point in the history
…n the recovery.fstab. Use __system rather than run_exec_process.

Change-Id: I669bfb75cf0cc00364b815b54130c01786866406
  • Loading branch information
koush committed Nov 11, 2011
1 parent 2291705 commit 88a233d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
16 changes: 7 additions & 9 deletions bmlutils/bmlutils.c
Expand Up @@ -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";
Expand All @@ -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;
}
Expand Down
10 changes: 3 additions & 7 deletions utilities/Android.mk
Expand Up @@ -58,19 +58,15 @@ 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
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)

endif

endif

0 comments on commit 88a233d

Please sign in to comment.