Fix write_raw_image on mtd devices.

Change-Id: I0fa64d4f4deaf8f067be3bd0b0bb963cf5af3f3f
This commit is contained in:
Koushik Dutta 2010-12-13 19:26:03 -08:00
parent 134ead7537
commit 16c0ace22b
3 changed files with 19 additions and 13 deletions

View File

@ -40,6 +40,7 @@
#include "roots.h"
#include "extendedcommands.h"
#include "flashutils/flashutils.h"
static int gDidShowProgress = 0;
@ -653,7 +654,11 @@ static int
cmd_write_raw_image(const char *name, void *cookie,
int argc, const char *argv[], PermissionRequestList *permissions)
{
#ifdef BOARD_USES_MTDUTILS
if (device_flash_type() != MTD) {
LOGE("Board does not support mtd utils.");
return -1;
}
UNUSED(cookie);
CHECK_WORDS();
//xxx permissions
@ -739,10 +744,6 @@ cmd_write_raw_image(const char *name, void *cookie,
return -1;
}
return 0;
#else
LOGE("Board does not support mtd utils.");
return -1;
#endif
}
/* mark <resource> dirty|clean

View File

@ -5,14 +5,6 @@
#include "flashutils/flashutils.h"
enum flash_type {
UNSUPPORTED = -1,
UNKNOWN = 0,
MTD = 1,
MMC = 2,
BML = 3
};
int the_flash_type = UNKNOWN;
int device_flash_type()

View File

@ -1,3 +1,6 @@
#ifndef FLASHUTILS_H
#define FLASHUTILS_H
int restore_raw_partition(const char *partition, const char *filename);
int backup_raw_partition(const char *partition, const char *filename);
int erase_raw_partition(const char *partition);
@ -35,4 +38,14 @@ extern int cmd_bml_erase_partition(const char *partition, const char *filesystem
extern int cmd_bml_mount_partition(const char *partition, const char *mount_point, const char *filesystem, int read_only);
extern int cmd_bml_get_partition_device(const char *partition, char *device);
extern int device_flash_type();
enum flash_type {
UNSUPPORTED = -1,
UNKNOWN = 0,
MTD = 1,
MMC = 2,
BML = 3
};
#endif