remount: Use /data for backing scratch storage.
Currently, this is only enabled for Virtual A/B devices. When /data uses
F2FS, then proper pinning support must be enabled.
Because /data cannot be mounted in recovery, we can't delete the scratch
image backed by /data while in fastbootd. Instead, we mark it as
disabled in /metadata. The remount command now has an init script that
checks for and removes a disabled scratch partition.
Bug: 134949511
Test: adb remount on V A/B device with patched F2FS
Change-Id: Ifc8720378259654472d3822e97059b6c366f601d
diff --git a/fs_mgr/Android.bp b/fs_mgr/Android.bp
index 34c64d2..7a88aa3 100644
--- a/fs_mgr/Android.bp
+++ b/fs_mgr/Android.bp
@@ -91,6 +91,7 @@
},
header_libs: [
"libfiemap_headers",
+ "libstorage_literals_headers",
],
export_header_lib_headers: [
"libfiemap_headers",
@@ -165,7 +166,7 @@
"libcrypto",
"libext4_utils",
"libfec",
- "libfs_mgr",
+ "libfs_mgr_binder",
"liblog",
"liblp",
"libselinux",
@@ -187,4 +188,26 @@
],
},
},
+ required: [
+ "clean_scratch_files",
+ ],
+}
+
+cc_binary {
+ name: "clean_scratch_files",
+ defaults: ["fs_mgr_defaults"],
+ shared_libs: [
+ "libbase",
+ "libfs_mgr_binder",
+ ],
+ srcs: [
+ "clean_scratch_files.cpp",
+ ],
+ product_variables: {
+ debuggable: {
+ init_rc: [
+ "clean_scratch_files.rc",
+ ],
+ },
+ },
}