fs_mgr: Add getter for androidboot.boot_part_uuid
In order to make booting from some media types (like USB) more robust, the bootloader will be extended to support passing the partition UUID that it loaded the kernel from. It can pass this via kernel commandline or via bootconfig. Add a way to get this. Bug: 316324155 Test: Use the getter in a future change Change-Id: Iab04742c0f2666db18dc48bcaaa2869eba405748
This commit is contained in:
parent
71707037b1
commit
519d3f8b36
2 changed files with 26 additions and 0 deletions
|
|
@ -950,6 +950,22 @@ std::set<std::string> GetBootDevices() {
|
|||
return ExtraBootDevices(fstab);
|
||||
}
|
||||
|
||||
std::string GetBootPartUuid() {
|
||||
std::string boot_part_uuid;
|
||||
|
||||
if (GetBootconfig("androidboot.boot_part_uuid", &boot_part_uuid)) {
|
||||
return boot_part_uuid;
|
||||
}
|
||||
|
||||
ImportKernelCmdline([&](std::string key, std::string value) {
|
||||
if (key == "androidboot.boot_part_uuid") {
|
||||
boot_part_uuid = value;
|
||||
}
|
||||
});
|
||||
|
||||
return boot_part_uuid;
|
||||
}
|
||||
|
||||
std::string GetVerityDeviceName(const FstabEntry& entry) {
|
||||
std::string base_device;
|
||||
if (entry.mount_point == "/") {
|
||||
|
|
|
|||
|
|
@ -126,6 +126,16 @@ void TransformFstabForDsu(Fstab* fstab, const std::string& dsu_slot,
|
|||
|
||||
std::set<std::string> GetBootDevices();
|
||||
|
||||
// Get the Partition UUID the kernel loaded from if the bootloader passed it.
|
||||
//
|
||||
// If the kernel's Partition UUID is provided then we can use this to help
|
||||
// identify which block device contains the filesystems we care about.
|
||||
//
|
||||
// NOTE: Nothing secures a UUID other than the convention that two disks
|
||||
// aren't supposed to both have the same UUID. We still need other mechanisms
|
||||
// to ensure we've got the right disk.
|
||||
std::string GetBootPartUuid();
|
||||
|
||||
// Return the name of the dm-verity device for the given fstab entry. This does
|
||||
// not check whether the device is valid or exists; it merely returns the
|
||||
// expected name.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue