summaryrefslogtreecommitdiffstats
path: root/mtdutils/bml_over_mtd.c
diff options
context:
space:
mode:
authorDees Troy <dees_troy@teamw.in>2013-01-07 19:54:47 +0100
committerGerrit Code Review <gerrit@5.9.244.119>2013-01-07 19:54:47 +0100
commit37407646b957b880876c56c19032b07a1c028656 (patch)
treef8274f194bbda84057b90aada803a5a20bf61712 /mtdutils/bml_over_mtd.c
parentAdd mode when open(O_CREAT) is used. (diff)
parentWork around MEMERASE ioctl for rk3066 compatibility (diff)
downloadandroid_bootable_recovery-37407646b957b880876c56c19032b07a1c028656.tar
android_bootable_recovery-37407646b957b880876c56c19032b07a1c028656.tar.gz
android_bootable_recovery-37407646b957b880876c56c19032b07a1c028656.tar.bz2
android_bootable_recovery-37407646b957b880876c56c19032b07a1c028656.tar.lz
android_bootable_recovery-37407646b957b880876c56c19032b07a1c028656.tar.xz
android_bootable_recovery-37407646b957b880876c56c19032b07a1c028656.tar.zst
android_bootable_recovery-37407646b957b880876c56c19032b07a1c028656.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",