aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandi34 <skate4life@gmx.de>2015-05-09 10:48:52 -0700
committerTom Marshall <tdm@cyngn.com>2015-11-25 15:35:47 -0800
commit3d561da3d9f9a5d690a68c96be29d65f0a4d55bb (patch)
tree2bff499bf3923846c5cd0c186c080447bb2e0807
parentf49b3e382af61e47f7652be03b7f989e72d03e3c (diff)
downloadbootable_recovery-3d561da3d9f9a5d690a68c96be29d65f0a4d55bb.zip
bootable_recovery-3d561da3d9f9a5d690a68c96be29d65f0a4d55bb.tar.gz
bootable_recovery-3d561da3d9f9a5d690a68c96be29d65f0a4d55bb.tar.bz2
updater: Allow devices to suppress BLKDISCARD
* On some devices TRIM is disabled for security reasons. Don't fail flashing the ROM because discard isn't possible in this case. Change-Id: I044619c3e0b01a496d967ef136501d0190240ad4
-rw-r--r--updater/Android.mk4
-rw-r--r--updater/blockimg.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/updater/Android.mk b/updater/Android.mk
index 1ea1fb7..6e224fb 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -35,6 +35,10 @@ ifneq ($(BOARD_RECOVERY_BLDRMSG_OFFSET),)
LOCAL_CFLAGS += -DBOARD_RECOVERY_BLDRMSG_OFFSET=$(BOARD_RECOVERY_BLDRMSG_OFFSET)
endif
+ifeq ($(BOARD_SUPPRESS_EMMC_WIPE),true)
+ LOCAL_CFLAGS += -DSUPPRESS_EMMC_WIPE
+endif
+
LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS)
LOCAL_STATIC_LIBRARIES += libapplypatch libedify libmtdutils libminzip libz
LOCAL_STATIC_LIBRARIES += libmincrypt libbz
diff --git a/updater/blockimg.c b/updater/blockimg.c
index 8b9519d..a93bfcb 100644
--- a/updater/blockimg.c
+++ b/updater/blockimg.c
@@ -1521,10 +1521,12 @@ static int PerformCommandErase(CommandParameters* params) {
// length in bytes
blocks[1] = (tgt->pos[i * 2 + 1] - tgt->pos[i * 2]) * (uint64_t) BLOCKSIZE;
+#ifndef SUPPRESS_EMMC_WIPE
if (ioctl(params->fd, BLKDISCARD, &blocks) == -1) {
fprintf(stderr, "BLKDISCARD ioctl failed: %s\n", strerror(errno));
goto pceout;
}
+#endif
}
}