diff options
author | andi34 <skate4life@gmx.de> | 2015-05-09 10:48:52 -0700 |
---|---|---|
committer | Tom Marshall <tdm.code@gmail.com> | 2017-09-17 16:59:26 +0000 |
commit | f79b32bf77fde59dec762655cf2bf35a96064fe4 (patch) | |
tree | e3bc0fd81e3eb9b22d6cfa71315300937b2cd4f1 | |
parent | 225bb0f8b2641f665fb0f0d991733aa7a34b39da (diff) | |
download | android_bootable_recovery-f79b32bf77fde59dec762655cf2bf35a96064fe4.tar.gz android_bootable_recovery-f79b32bf77fde59dec762655cf2bf35a96064fe4.tar.bz2 android_bootable_recovery-f79b32bf77fde59dec762655cf2bf35a96064fe4.zip |
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.mk | 4 | ||||
-rw-r--r-- | updater/blockimg.cpp | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/updater/Android.mk b/updater/Android.mk index ed9aba70..f6bcaff2 100644 --- a/updater/Android.mk +++ b/updater/Android.mk @@ -93,6 +93,10 @@ LOCAL_CFLAGS := \ -Wno-unused-parameter \ -Werror +ifeq ($(BOARD_SUPPRESS_EMMC_WIPE),true) + LOCAL_CFLAGS += -DSUPPRESS_EMMC_WIPE +endif + LOCAL_STATIC_LIBRARIES := \ libupdater \ $(TARGET_RECOVERY_UPDATER_LIBS) \ diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp index c614ccc4..81eeabf1 100644 --- a/updater/blockimg.cpp +++ b/updater/blockimg.cpp @@ -1383,10 +1383,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) { PLOG(ERROR) << "BLKDISCARD ioctl failed"; return -1; } +#endif } } |