Skip to content

Commit

Permalink
updater: Allow devices to suppress BLKDISCARD
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
andi34 authored and mikeNG committed Oct 15, 2016
1 parent c07204f commit f4f6705
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions updater/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,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 libbase libotafault libedify libmtdutils libminzip libz
LOCAL_STATIC_LIBRARIES += libbz
Expand Down
2 changes: 2 additions & 0 deletions updater/blockimg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1334,10 +1334,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));
return -1;
}
#endif
}
}

Expand Down

0 comments on commit f4f6705

Please sign in to comment.