aboutsummaryrefslogtreecommitdiffstats
path: root/flashutils
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2011-03-17 11:37:21 -0700
committerKoushik Dutta <koushd@gmail.com>2011-03-17 11:37:21 -0700
commit67fa0c375f08986d4007862e1a4b941140939df3 (patch)
treec3e51d27902743a79a805402253848ff860beb46 /flashutils
parent92796ec949f80021cdc11508346489ae1af814c1 (diff)
downloadbootable_recovery-67fa0c375f08986d4007862e1a4b941140939df3.zip
bootable_recovery-67fa0c375f08986d4007862e1a4b941140939df3.tar.gz
bootable_recovery-67fa0c375f08986d4007862e1a4b941140939df3.tar.bz2
fix erroneous detection of device flash type when device is explicitly provided. fix bugs in mount generation.
Change-Id: I54a35390550b1384f12c4b12267029d77bef8fa3
Diffstat (limited to 'flashutils')
-rw-r--r--flashutils/flashutils.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/flashutils/flashutils.c b/flashutils/flashutils.c
index b71d4fa..0b1467e 100644
--- a/flashutils/flashutils.c
+++ b/flashutils/flashutils.c
@@ -69,9 +69,21 @@ __system(const char *command)
return (pid == -1 ? -1 : pstat);
}
-int restore_raw_partition(const char *partition, const char *filename)
+static int detect_partition(const char *partition)
{
int type = device_flash_type();
+ if (strstr(partition, "/dev/block/mtd") != NULL)
+ type = MTD;
+ else if (strstr(partition, "/dev/block/mmc") != NULL)
+ type = MMC;
+ else if (strstr(partition, "/dev/block/bml") != NULL)
+ type = BML;
+
+ return type;
+}
+int restore_raw_partition(const char *partition, const char *filename)
+{
+ int type = detect_partition(partition);
switch (type) {
case MTD:
return cmd_mtd_restore_raw_partition(partition, filename);
@@ -86,7 +98,7 @@ int restore_raw_partition(const char *partition, const char *filename)
int backup_raw_partition(const char *partition, const char *filename)
{
- int type = device_flash_type();
+ int type = detect_partition(partition);
switch (type) {
case MTD:
return cmd_mtd_backup_raw_partition(partition, filename);
@@ -101,7 +113,7 @@ int backup_raw_partition(const char *partition, const char *filename)
int erase_raw_partition(const char *partition)
{
- int type = device_flash_type();
+ int type = detect_partition(partition);
switch (type) {
case MTD:
return cmd_mtd_erase_raw_partition(partition);
@@ -116,7 +128,7 @@ int erase_raw_partition(const char *partition)
int erase_partition(const char *partition, const char *filesystem)
{
- int type = device_flash_type();
+ int type = detect_partition(partition);
switch (type) {
case MTD:
return cmd_mtd_erase_partition(partition, filesystem);
@@ -131,7 +143,7 @@ int erase_partition(const char *partition, const char *filesystem)
int mount_partition(const char *partition, const char *mount_point, const char *filesystem, int read_only)
{
- int type = device_flash_type();
+ int type = detect_partition(partition);
switch (type) {
case MTD:
return cmd_mtd_mount_partition(partition, mount_point, filesystem, read_only);