Merge branch 'gingerbread' of git://github.com/CyanogenMod/android_bootable_recovery into gingerbread

This commit is contained in:
Arif Ali 2011-11-12 01:30:08 +00:00
commit 63fb0eedbd
5 changed files with 63 additions and 3 deletions

View File

@ -171,3 +171,35 @@ int cmd_bml_get_partition_device(const char *partition, char *device)
{
return -1;
}
int format_rfs_device (const char *device, const char *path) {
const char *fatsize = "32";
const char *sectorsize = "1";
if (strcmp(path, "/datadata") == 0 || strcmp(path, "/cache") == 0) {
fatsize = "16";
}
// Just in case /data sector size needs to be altered
else if (strcmp(path, "/data") == 0 ) {
sectorsize = "1";
}
// dump 10KB of zeros to partition before format due to fat.format bug
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
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;
}
return 0;
}

6
bmlutils/bmlutils.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef BMLUTILS_H_
#define BMLUTILS_H_
int format_rfs_device (const char *device, const char *path);
#endif // BMLUTILS_H_

View File

@ -41,6 +41,7 @@
#include "edify/expr.h"
#include <libgen.h>
#include "mtdutils/mtdutils.h"
#include "bmlutils/bmlutils.h"
int signature_check_enabled = 1;
@ -441,6 +442,18 @@ int format_device(const char *device, const char *path, const char *fs_type) {
return -1;
}
if (strcmp(fs_type, "rfs") == 0) {
if (ensure_path_unmounted(path) != 0) {
LOGE("format_volume failed to unmount \"%s\"\n", v->mount_point);
return -1;
}
if (0 != format_rfs_device(device, path)) {
LOGE("format_volume: format_rfs_device failed on %s\n", device);
return -1;
}
return 0;
}
if (strcmp(v->mount_point, path) != 0) {
return format_unknown_device(v->device, path, NULL);
}
@ -723,7 +736,7 @@ void show_nandroid_advanced_restore_menu(const char* path)
};
char tmp[PATH_MAX];
sprintf(tmp, "%s/clockworkmod/backup", path);
sprintf(tmp, "%s/clockworkmod/backup/", path);
char* file = choose_file_menu(tmp, NULL, advancedheaders);
if (file == NULL)
return;

View File

@ -58,6 +58,15 @@ else
LOCAL_SRC_FILES := ../../../$(BOARD_MKE2FS)
endif
include $(BUILD_PREBUILT)
endif
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

BIN
utilities/fat.format Executable file

Binary file not shown.