Mount a filesystem on the crypt block device
Encryptedstore binary will format an ext4 fs (if required) in the crypt
device & mount it.
This patch also adds "ENCRYPTEDSTORE" as Partition type & formatting the
raw device with appropriate magic to identify this device is not yet
formatted with a filesystem.
Bug: 241541860
Test: Run a vm -> create a file
Test: Re-run the VM (with the same vm-instance) & check that it
persists.
Change-Id: I0ec92042f3f5f35f2735108cc68b68c022493c85
diff --git a/microdroid_manager/src/main.rs b/microdroid_manager/src/main.rs
index 4ebcc2e..a53b401 100644
--- a/microdroid_manager/src/main.rs
+++ b/microdroid_manager/src/main.rs
@@ -88,6 +88,7 @@
const ENCRYPTEDSTORE_BIN: &str = "/system/bin/encryptedstore";
const ENCRYPTEDSTORE_KEY_IDENTIFIER: &str = "encryptedstore_key";
const ENCRYPTEDSTORE_KEYSIZE: u32 = 64;
+const ENCRYPTEDSTORE_MOUNTPOINT: &str = "/mnt/encryptedstore";
#[derive(thiserror::Error, Debug)]
enum MicrodroidError {
@@ -820,6 +821,7 @@
.arg(ENCRYPTEDSTORE_BACKING_DEVICE)
.arg("--key")
.arg(hex::encode(&*key))
+ .args(["--mountpoint", ENCRYPTEDSTORE_MOUNTPOINT])
.spawn()
.context("encryptedstore failed")
}