Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c1c0199 authored by andi34's avatar andi34 Committed by Tom Marshall
Browse files

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
parent 04dec0ff
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -94,6 +94,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) \
+2 −0
Original line number Diff line number Diff line
@@ -1369,10 +1369,12 @@ static int PerformCommandErase(CommandParameters& params) {
      // length in bytes
      blocks[1] = (range.second - range.first) * static_cast<uint64_t>(BLOCKSIZE);

#ifndef SUPPRESS_EMMC_WIPE
      if (ioctl(params.fd, BLKDISCARD, &blocks) == -1) {
        PLOG(ERROR) << "BLKDISCARD ioctl failed";
        return -1;
      }
#endif
    }
  }