From 3d561da3d9f9a5d690a68c96be29d65f0a4d55bb Mon Sep 17 00:00:00 2001 From: andi34 Date: Sat, 9 May 2015 10:48:52 -0700 Subject: 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 --- updater/Android.mk | 4 ++++ updater/blockimg.c | 2 ++ 2 files changed, 6 insertions(+) (limited to 'updater') 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 } } -- cgit v1.1