Merge "fs_mgr: allow boot_devices to be supplies on the kernel commandline"

This commit is contained in:
Treehugger Robot 2018-12-13 22:28:34 +00:00 committed by Gerrit Code Review
commit 8f1fcd5b94

View file

@ -33,6 +33,7 @@
#include "fs_mgr_priv.h" #include "fs_mgr_priv.h"
using android::base::Split;
using android::base::StartsWith; using android::base::StartsWith;
const std::string kDefaultAndroidDtDir("/proc/device-tree/firmware/android"); const std::string kDefaultAndroidDtDir("/proc/device-tree/firmware/android");
@ -850,11 +851,12 @@ struct fstab_rec* fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const st
} }
std::set<std::string> fs_mgr_get_boot_devices() { std::set<std::string> fs_mgr_get_boot_devices() {
// boot_devices can be specified in device tree. // First check the kernel commandline, then try the device tree otherwise
std::string dt_value; std::string dt_file_name = get_android_dt_dir() + "/boot_devices";
std::string file_name = get_android_dt_dir() + "/boot_devices"; std::string value;
if (read_dt_file(file_name, &dt_value)) { if (fs_mgr_get_boot_config_from_kernel_cmdline("boot_devices", &value) ||
auto boot_devices = android::base::Split(dt_value, ","); read_dt_file(dt_file_name, &value)) {
auto boot_devices = Split(value, ",");
return std::set<std::string>(boot_devices.begin(), boot_devices.end()); return std::set<std::string>(boot_devices.begin(), boot_devices.end());
} }