Merge "Using a dir /avb for DSU avb keys"

This commit is contained in:
Treehugger Robot 2019-12-11 23:56:09 +00:00 committed by Gerrit Code Review
commit 1ef36b7491

View file

@ -582,8 +582,7 @@ bool EraseFstabEntry(Fstab* fstab, const std::string& mount_point) {
} // namespace } // namespace
void TransformFstabForDsu(Fstab* fstab, const std::vector<std::string>& dsu_partitions) { void TransformFstabForDsu(Fstab* fstab, const std::vector<std::string>& dsu_partitions) {
static constexpr char kGsiKeys[] = static constexpr char kDsuKeysDir[] = "/avb";
"/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey";
// Convert userdata // Convert userdata
// Inherit fstab properties for userdata. // Inherit fstab properties for userdata.
FstabEntry userdata; FstabEntry userdata;
@ -629,29 +628,18 @@ void TransformFstabForDsu(Fstab* fstab, const std::vector<std::string>& dsu_part
.fs_type = "ext4", .fs_type = "ext4",
.flags = MS_RDONLY, .flags = MS_RDONLY,
.fs_options = "barrier=1", .fs_options = "barrier=1",
.avb_keys = kGsiKeys, .avb_keys = kDsuKeysDir,
}; };
entry.fs_mgr_flags.wait = true; entry.fs_mgr_flags.wait = true;
entry.fs_mgr_flags.logical = true; entry.fs_mgr_flags.logical = true;
entry.fs_mgr_flags.first_stage_mount = true; entry.fs_mgr_flags.first_stage_mount = true;
// Use the system key which may be in the vbmeta or vbmeta_system
// TODO: b/141284191
entry.vbmeta_partition = "vbmeta";
fstab->emplace_back(entry);
entry.vbmeta_partition = "vbmeta_system";
fstab->emplace_back(entry);
} else { } else {
// If the corresponding partition exists, transform all its Fstab // If the corresponding partition exists, transform all its Fstab
// by pointing .blk_device to the DSU partition. // by pointing .blk_device to the DSU partition.
for (auto&& entry : entries) { for (auto&& entry : entries) {
entry->blk_device = partition; entry->blk_device = partition;
if (entry->avb_keys.size() > 0) { // AVB keys for DSU should always be under kDsuKeysDir.
entry->avb_keys += ":"; entry->avb_keys += kDsuKeysDir;
}
// If the DSU is signed by OEM, the original Fstab already has the information
// required by avb, otherwise the DSU is GSI and will need the avb_keys as listed
// below.
entry->avb_keys += kGsiKeys;
} }
// Make sure the ext4 is included to support GSI. // Make sure the ext4 is included to support GSI.
auto partition_ext4 = auto partition_ext4 =