summaryrefslogtreecommitdiffstats
path: root/mtdutils/bml_over_mtd.c
diff options
context:
space:
mode:
authorSergey 'Jin' Bostandzhyan <jin@mediatomb.cc>2013-01-04 02:29:03 +0100
committerSergey 'Jin' Bostandzhyan <jin@mediatomb.cc>2013-01-05 00:23:06 +0100
commit80a90edd47d20141cfb7b18ededc9a3090fba58c (patch)
tree024a118fbcbc357158b74862e3381b265076a9b5 /mtdutils/bml_over_mtd.c
parentIncrease array size to fix crashes on some devices (diff)
downloadandroid_bootable_recovery-80a90edd47d20141cfb7b18ededc9a3090fba58c.tar
android_bootable_recovery-80a90edd47d20141cfb7b18ededc9a3090fba58c.tar.gz
android_bootable_recovery-80a90edd47d20141cfb7b18ededc9a3090fba58c.tar.bz2
android_bootable_recovery-80a90edd47d20141cfb7b18ededc9a3090fba58c.tar.lz
android_bootable_recovery-80a90edd47d20141cfb7b18ededc9a3090fba58c.tar.xz
android_bootable_recovery-80a90edd47d20141cfb7b18ededc9a3090fba58c.tar.zst
android_bootable_recovery-80a90edd47d20141cfb7b18ededc9a3090fba58c.zip
Diffstat (limited to 'mtdutils/bml_over_mtd.c')
-rw-r--r--mtdutils/bml_over_mtd.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mtdutils/bml_over_mtd.c b/mtdutils/bml_over_mtd.c
index c40179281..a68950e40 100644
--- a/mtdutils/bml_over_mtd.c
+++ b/mtdutils/bml_over_mtd.c
@@ -31,6 +31,10 @@
#include "mtdutils.h"
+#ifdef RK3066
+ #include "rk30hack.h"
+#endif
+
typedef struct BmlOverMtdReadContext {
const MtdPartition *partition;
char *buffer;
@@ -518,11 +522,19 @@ static ssize_t bml_over_mtd_write_block(int fd, ssize_t erase_size, char* data)
erase_info.length = size;
int retry;
for (retry = 0; retry < 2; ++retry) {
+#ifdef RK3066
+ if (rk30_zero_out(fd, pos, size) < 0) {
+ fprintf(stderr, "mtd: erase failure at 0x%08lx (%s)\n",
+ pos, strerror(errno));
+ continue;
+ }
+#else
if (ioctl(fd, MEMERASE, &erase_info) < 0) {
fprintf(stderr, "mtd: erase failure at 0x%08lx (%s)\n",
pos, strerror(errno));
continue;
}
+#endif
if (lseek(fd, pos, SEEK_SET) != pos ||
write(fd, data, size) != size) {
fprintf(stderr, "mtd: write error at 0x%08lx (%s)\n",