From 6bbe9477f3ee3aff890e4db334b8eaad95654e39 Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Thu, 13 Dec 2018 10:58:37 -0800 Subject: [PATCH] fs_mgr: allow boot_devices to be supplies on the kernel commandline boot_devices in device tree is our last remaining device tree entry for specifying the kernel commandline. Since this doesn't make sense to be included in the fstab, especially as there is no way to differentiate between different boot devices within a single device tree as some devices do, it is moved to the kernel commandline. Bug: 117933812 Test: boot blueline without boot_devices in DT Change-Id: If498836ae2ef14e68ff761338ef352c20c4a7b3d --- fs_mgr/fs_mgr_fstab.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index e761e56d4..d3cd459d8 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -33,6 +33,7 @@ #include "fs_mgr_priv.h" +using android::base::Split; using android::base::StartsWith; 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 fs_mgr_get_boot_devices() { - // boot_devices can be specified in device tree. - std::string dt_value; - std::string file_name = get_android_dt_dir() + "/boot_devices"; - if (read_dt_file(file_name, &dt_value)) { - auto boot_devices = android::base::Split(dt_value, ","); + // First check the kernel commandline, then try the device tree otherwise + std::string dt_file_name = get_android_dt_dir() + "/boot_devices"; + std::string value; + if (fs_mgr_get_boot_config_from_kernel_cmdline("boot_devices", &value) || + read_dt_file(dt_file_name, &value)) { + auto boot_devices = Split(value, ","); return std::set(boot_devices.begin(), boot_devices.end()); }