diff options
author | David Anderson <dvander@google.com> | 2019-02-28 23:36:09 -0800 |
---|---|---|
committer | David Anderson <dvander@google.com> | 2019-03-01 12:08:01 -0800 |
commit | d81e1256f2be8181882191a4f6b92e1854cc8e72 (patch) | |
tree | 1f28b079c86c5684cf6140d4fb66ce3c5ddcb03e /gsi_service.h | |
parent | 646b4b22db43dd36d044646385166ffae16c2231 (diff) | |
download | gsid-d81e1256f2be8181882191a4f6b92e1854cc8e72.tar.gz |
Track image sizes separately from image files.
If FiemapWriter needs to bump up the image file size due to alignment,
gsid must track the actual requested size separately for AVB to work.
Otherwise, libavb will be unable to find the vbmeta footer at the end of
the partition.
The actual size can be recovered from /metadata/gsi/lp_metadata, as long
as the extent list is truncated appropriately.
Bug: 126230649
Test: gsi install works
Change-Id: If5b580691d9399dfefceef89cc7e574d422f06e2
Diffstat (limited to 'gsi_service.h')
-rw-r--r-- | gsi_service.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gsi_service.h b/gsi_service.h index c70618c..d2a87bd 100644 --- a/gsi_service.h +++ b/gsi_service.h @@ -62,7 +62,12 @@ class GsiService : public BinderService<GsiService>, public BnGsiService { private: using LpMetadata = android::fs_mgr::LpMetadata; using MetadataBuilder = android::fs_mgr::MetadataBuilder; - using ImageMap = std::map<std::string, android::fiemap_writer::FiemapUniquePtr>; + + struct Image { + android::fiemap_writer::FiemapUniquePtr writer; + uint64_t actual_size; + }; + using ImageMap = std::map<std::string, Image>; int StartInstall(int64_t gsi_size, int64_t userdata_size, bool wipe_userdata); int PerformSanityChecks(); @@ -76,8 +81,7 @@ class GsiService : public BinderService<GsiService>, public BnGsiService { int ReenableGsi(); bool DisableGsiInstall(); bool AddPartitionFiemap(android::fs_mgr::MetadataBuilder* builder, - android::fs_mgr::Partition* partition, - android::fiemap_writer::FiemapWriter* writer); + android::fs_mgr::Partition* partition, const Image& image); std::unique_ptr<LpMetadata> CreateMetadata(const ImageMap& partitions); fiemap_writer::FiemapUniquePtr CreateFiemapWriter(const std::string& path, uint64_t size, int* error); @@ -88,6 +92,7 @@ class GsiService : public BinderService<GsiService>, public BnGsiService { void StartAsyncOperation(const std::string& step, int64_t total_bytes); void UpdateProgress(int status, int64_t bytes_processed); android::base::unique_fd OpenPartition(const std::string& name); + int GetExistingImage(const LpMetadata& metadata, const std::string& name, Image* image); enum class AccessLevel { System, |