summaryrefslogtreecommitdiff
path: root/dexopt_chroot_setup
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2024-07-11 17:31:00 +0100
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-07-11 17:44:25 +0000
commitbeb0105d8085bac1da65c767ce0659c8f0371594 (patch)
treeb02504a2c4c8795a7dfa6beb1fbc29992669d315 /dexopt_chroot_setup
parente1f58a747f43447744902500830c5f98641a8a55 (diff)
Also bind-mount "/system" when setting up chroot.
Bug: 351764558 Test: - 1. Remount readonly partitions read-write. 2. atest art_standalone_dexopt_chroot_setup_tests Change-Id: I0eece1d369b78b2546107bf124aab1fd27789208
Diffstat (limited to 'dexopt_chroot_setup')
-rw-r--r--dexopt_chroot_setup/dexopt_chroot_setup.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/dexopt_chroot_setup/dexopt_chroot_setup.cc b/dexopt_chroot_setup/dexopt_chroot_setup.cc
index 71acfcd0d2..ff016d64d5 100644
--- a/dexopt_chroot_setup/dexopt_chroot_setup.cc
+++ b/dexopt_chroot_setup/dexopt_chroot_setup.cc
@@ -407,6 +407,11 @@ Result<void> DexoptChrootSetup::SetUpChroot(const std::optional<std::string>& ot
if (!IsOtaUpdate(ota_slot)) { // Mainline update
OR_RETURN(BindMount("/", CHROOT_DIR));
+ // Normally, we don't need to bind-mount "/system" because it's a part of the image mounted at
+ // "/". However, when readonly partitions are remounted read-write, an overlay is created at
+ // "/system", so we need to bind-mount "/system" to handle this case. On devices where readonly
+ // partitions are not remounted, bind-mounting "/system" doesn't hurt.
+ OR_RETURN(BindMount("/system", PathInChroot("/system")));
for (const std::string& partition : additional_system_partitions) {
// Some additional partitions are optional, but that's okay. The root filesystem (mounted at
// `/`) has empty directories for additional partitions. If additional partitions don't exist,