2023-12-18 AndroidR RK356X 新增一个分区,这个分区可写入读取,恢复出厂后数据也不会被删除。

发布时间:2023年12月18日

一、整个过程需要修改的内容,不多解释,直接看源码吧 read the fuck code。

diff --git a/bootable/recovery/install/include/install/wipe_data.h b/bootable/recovery/install/include/install/wipe_data.h
old mode 100644
new mode 100755
index c177f59274..6e1987d990
--- a/bootable/recovery/install/include/install/wipe_data.h
+++ b/bootable/recovery/install/include/install/wipe_data.h
@@ -30,5 +30,7 @@ bool WipeCache(RecoveryUI* ui, const std::function<bool()>& confirm);
 bool WipeData(Device* device, bool convert_fbe);
 
 void SureMetadataMount();
+void SurePrivateMount();
+
 void WipeFrp();
 int ResizeData(Device* device);
diff --git a/bootable/recovery/install/wipe_data.cpp b/bootable/recovery/install/wipe_data.cpp
old mode 100644
new mode 100755
index a16e62c1d7..6017f807e1
--- a/bootable/recovery/install/wipe_data.cpp
+++ b/bootable/recovery/install/wipe_data.cpp
@@ -36,6 +36,7 @@
 constexpr const char* CACHE_ROOT = "/cache";
 constexpr const char* DATA_ROOT = "/data";
 constexpr const char* METADATA_ROOT = "/metadata";
+constexpr const char* PRIVATE_ROOT = "/cameradata";
 
 /**
  * reset hdmi after restore factory.
@@ -152,6 +153,11 @@ bool WipeData(Device* device, bool convert_fbe) {
     if (has_cache) {
       success &= EraseVolume(CACHE_ROOT, ui, false);
     }
+/*
+	if (volume_for_mount_point(PRIVATE_ROOT) != nullptr) {
+	   success &= EraseVolume(PRIVATE_ROOT, ui, false);
+	 }
+*/
     if (volume_for_mount_point(METADATA_ROOT) != nullptr) {
       success &= EraseVolume(METADATA_ROOT, ui, false);
     }
@@ -172,6 +178,16 @@ void SureMetadataMount() {
     ensure_path_mounted(METADATA_ROOT);
   }
 }
+
+void SurePrivateMount() {
+  if (ensure_path_mounted(PRIVATE_ROOT)) {
+    printf("mount private fail,so formate...\n");
+    reset_tmplog_offset();
+    format_volume(PRIVATE_ROOT);
+    ensure_path_mounted(PRIVATE_ROOT);
+  }
+}
文章来源:https://blog.csdn.net/qq_37858386/article/details/135069509
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。