512G EMMC擦写时间比较长问题

平台:RK3588

现象描述:烧录系统,或者恢复出厂设置,会卡在erasing界面,大概六七分钟才能开机

Android13:

external/f2fs-tools
diff --git a/mkfs/f2fs_format_utils.c b/mkfs/f2fs_format_utils.c
index bf9ffbd..92feb33 100644
--- a/mkfs/f2fs_format_utils.c
+++ b/mkfs/f2fs_format_utils.c
@@ -76,7 +76,7 @@
 static int trim_device(int i)
                        free(stat_buf);
                        return f2fs_reset_zones(i);
                }
-#ifdef BLKSECDISCARD
+#if 0//def BLKSECDISCARD
                if (ioctl(fd, BLKSECDISCARD, &range) < 0) {
                        MSG(0, "Info: This device doesn't support BLKSECDISCARD\n");
                } else {

 

Android14按照以上修改发现没有作用。recovery里面再格式化存储的时候调用了安全擦除,个别型号EMMC实现安全擦除比较耗时。解决办法:把安全擦除修改为非安全擦除,参考代码如下:

Android14:

diff --git a/system/extras/ext4_utils/wipe.cpp b/system/extras/ext4_utils/wipe.cpp
index 445c9739152..b70230b947c 100644
--- a/system/extras/ext4_utils/wipe.cpp
+++ b/system/extras/ext4_utils/wipe.cpp
@@ -48,7 +48,7 @@ int wipe_block_device(int fd, s64 len) {
 
     range[0] = 0;
     range[1] = len;
-    ret = ioctl(fd, BLKSECDISCARD, &range);
+    ret = ioctl(fd, BLKDISCARD, &range);
     if (ret < 0) {
         range[0] = 0;
         range[1] = len;


diff --git a/bootable/recovery/install/wipe_device.cpp b/bootable/recovery/install/wipe_device.cpp
index 2656580fe03..e8fd8c5c308 100644
--- a/bootable/recovery/install/wipe_device.cpp
+++ b/bootable/recovery/install/wipe_device.cpp
@@ -107,7 +107,7 @@ static bool SecureWipePartition(const std::string& partition) {
   LOG(INFO) << "Secure-wiping \"" << partition << "\" from " << range[0] << " to " << range[1];
 
   LOG(INFO) << "  Trying BLKSECDISCARD...";
-  if (ioctl(fd, BLKSECDISCARD, &range) == -1) {
+  if (ioctl(fd, BLKDISCARD, &range) == -1) {
     PLOG(WARNING) << "  Failed";
 
     // Use BLKDISCARD if it zeroes out blocks, otherwise use BLKZEROOUT.

 

posted @ 2026-03-03 19:23  M-kobe  阅读(1)  评论(0)    收藏  举报