Merge "fs_mgr: reorder getting boot config" am: d0687a8aec
am: 66e7d99fa7
Change-Id: I579b4948a8455066eb32b6bf41ee22677b58e060
This commit is contained in:
commit
c40e06db63
1 changed files with 15 additions and 15 deletions
|
|
@ -84,24 +84,13 @@ bool fs_mgr_get_boot_config_from_kernel_cmdline(const std::string& key, std::str
|
|||
return fs_mgr_get_boot_config_from_kernel(cmdline, key, out_val);
|
||||
}
|
||||
|
||||
// Tries to get the boot config value in properties, kernel cmdline and
|
||||
// device tree (in that order). returns 'true' if successfully found, 'false'
|
||||
// otherwise
|
||||
// Tries to get the boot config value in device tree, properties and
|
||||
// kernel cmdline (in that order). Returns 'true' if successfully
|
||||
// found, 'false' otherwise.
|
||||
bool fs_mgr_get_boot_config(const std::string& key, std::string* out_val) {
|
||||
FS_MGR_CHECK(out_val != nullptr);
|
||||
|
||||
// first check if we have "ro.boot" property already
|
||||
*out_val = android::base::GetProperty("ro.boot." + key, "");
|
||||
if (!out_val->empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// fallback to kernel cmdline, properties may not be ready yet
|
||||
if (fs_mgr_get_boot_config_from_kernel_cmdline(key, out_val)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// lastly, check the device tree
|
||||
// firstly, check the device tree
|
||||
if (is_dt_compatible()) {
|
||||
std::string file_name = get_android_dt_dir() + "/" + key;
|
||||
if (android::base::ReadFileToString(file_name, out_val)) {
|
||||
|
|
@ -112,5 +101,16 @@ bool fs_mgr_get_boot_config(const std::string& key, std::string* out_val) {
|
|||
}
|
||||
}
|
||||
|
||||
// next, check if we have "ro.boot" property already
|
||||
*out_val = android::base::GetProperty("ro.boot." + key, "");
|
||||
if (!out_val->empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// finally, fallback to kernel cmdline, properties may not be ready yet
|
||||
if (fs_mgr_get_boot_config_from_kernel_cmdline(key, out_val)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue