diff options
-rw-r--r-- | fs_mgr/fs_mgr_remount.cpp | 15 | ||||
-rwxr-xr-x | fs_mgr/tests/adb-remount-test.sh | 14 |
2 files changed, 22 insertions, 7 deletions
diff --git a/fs_mgr/fs_mgr_remount.cpp b/fs_mgr/fs_mgr_remount.cpp index e2a4d1607..24044d873 100644 --- a/fs_mgr/fs_mgr_remount.cpp +++ b/fs_mgr/fs_mgr_remount.cpp @@ -176,6 +176,15 @@ int main(int argc, char* argv[]) { fstab_read = android::fs_mgr::ReadFstabFromFile(fstab_file, &fstab); } else { fstab_read = android::fs_mgr::ReadDefaultFstab(&fstab); + // Manufacture a / entry from /proc/mounts if missing. + if (!GetEntryForMountPoint(&fstab, "/system") && !GetEntryForMountPoint(&fstab, "/")) { + android::fs_mgr::Fstab mounts; + if (android::fs_mgr::ReadFstabFromFile("/proc/mounts", &mounts)) { + if (auto entry = GetEntryForMountPoint(&mounts, "/")) { + if (entry->fs_type != "rootfs") fstab.emplace_back(*entry); + } + } + } } if (!fstab_read || fstab.empty()) { PLOG(ERROR) << "Failed to read fstab"; @@ -211,21 +220,21 @@ int main(int argc, char* argv[]) { // Do we know about the partition? auto it = std::find_if(fstab.begin(), fstab.end(), find_part); if (it == fstab.end()) { - LOG(ERROR) << "Unknown partition " << partition << ", skipping"; + LOG(ERROR) << "Unknown partition " << argv[optind] << ", skipping"; retval = UNKNOWN_PARTITION; continue; } // Is that one covered by an existing overlayfs? auto wrap = is_wrapped(overlayfs_candidates, *it); if (wrap) { - LOG(INFO) << "partition " << partition << " covered by overlayfs for " + LOG(INFO) << "partition " << argv[optind] << " covered by overlayfs for " << wrap->mount_point << ", switching"; partition = system_mount_point(*wrap); } // Is it a remountable partition? it = std::find_if(all.begin(), all.end(), find_part); if (it == all.end()) { - LOG(ERROR) << "Invalid partition " << partition << ", skipping"; + LOG(ERROR) << "Invalid partition " << argv[optind] << ", skipping"; retval = INVALID_PARTITION; continue; } diff --git a/fs_mgr/tests/adb-remount-test.sh b/fs_mgr/tests/adb-remount-test.sh index ec6eb5252..b95e54ea6 100755 --- a/fs_mgr/tests/adb-remount-test.sh +++ b/fs_mgr/tests/adb-remount-test.sh @@ -514,8 +514,8 @@ skip_administrative_mounts() { cat - fi | grep -v \ - -e "^\(overlay\|tmpfs\|none\|sysfs\|proc\|selinuxfs\|debugfs\) " \ - -e "^\(bpf\|cg2_bpf\|pstore\|tracefs\|adb\|mtp\|ptp\|devpts\) " \ + -e "^\(overlay\|tmpfs\|none\|sysfs\|proc\|selinuxfs\|debugfs\|bpf\) " \ + -e "^\(binfmt_misc\|cg2_bpf\|pstore\|tracefs\|adb\|mtp\|ptp\|devpts\) " \ -e "^\(/data/media\|/dev/block/loop[0-9]*\) " \ -e "^rootfs / rootfs rw," \ -e " /\(cache\|mnt/scratch\|mnt/vendor/persist\|persist\|metadata\) " @@ -608,7 +608,7 @@ fi D=`get_property ro.serialno` [ -n "${D}" ] || D=`get_property ro.boot.serialno` -[ -z "${D}" ] || ANDROID_SERIAL=${D} +[ -z "${D}" -o -n "${ANDROID_SERIAL}" ] || ANDROID_SERIAL=${D} USB_SERIAL= [ -z "${ANDROID_SERIAL}" ] || USB_SERIAL=`find /sys/devices -name serial | grep usb | @@ -998,8 +998,14 @@ echo "${GREEN}[ OK ]${NORMAL} /system/lib/bootstrap/libc.so content remain echo "${GREEN}[ RUN ]${NORMAL} flash vendor, confirm its content disappears" >&2 H=`adb_sh echo '${HOSTNAME}' </dev/null 2>/dev/null` +is_bootloader_fastboot=false +# cuttlefish? +[ X"${H}" != X"${H#vsoc}" ] || is_bootloader_fastboot=true is_userspace_fastboot=false -if [ -z "${ANDROID_PRODUCT_OUT}" ]; then + +if ! ${is_bootloader_fastboot}; then + echo "${ORANGE}[ WARNING ]${NORMAL} does not support fastboot, skipping" +elif [ -z "${ANDROID_PRODUCT_OUT}" ]; then echo "${ORANGE}[ WARNING ]${NORMAL} build tree not setup, skipping" elif [ ! -s "${ANDROID_PRODUCT_OUT}/vendor.img" ]; then echo "${ORANGE}[ WARNING ]${NORMAL} vendor image missing, skipping" |