From fabc36445ebe618c9686666fc1c98a71e46bf692 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 1 Apr 2020 19:46:42 -0700 Subject: [PATCH] fs_mgr: Allow commas in boot device paths. If the value of androidboot.boot_devices has a comma in its path, it'll get split and /dev/block/by-name symlinks won't work. As a workaround, add "androidboot.boot_device" as a valid command-line parameter. It can be repeated multiple times to retain multiple-boot-device semantics. Bug: 153024538 Test: device boots with androidboot.boot_device= set Change-Id: I1be5aeec287ba198768c3452b1930d59b2f13463 --- fs_mgr/fs_mgr_fstab.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index a836d3be7..b218f21b2 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -829,6 +829,20 @@ std::set GetBootDevices() { return std::set(boot_devices.begin(), boot_devices.end()); } + std::string cmdline; + if (android::base::ReadFileToString("/proc/cmdline", &cmdline)) { + std::set boot_devices; + const std::string cmdline_key = "androidboot.boot_device"; + for (const auto& [key, value] : fs_mgr_parse_boot_config(cmdline)) { + if (key == cmdline_key) { + boot_devices.emplace(value); + } + } + if (!boot_devices.empty()) { + return boot_devices; + } + } + // Fallback to extract boot devices from fstab. Fstab fstab; if (!ReadDefaultFstab(&fstab)) {