Add support installing to root of filesystem image
If the partition of a spec is "root", that spec will be installed to
root instead. Normally that spec will be from prebuilt_root module with
install_in_root property.
Bug: 351258461
Test: USE_SOONG_DEFINED_SYSTEM_IMAGE=true m && cvd start
Change-Id: Iaaa9c2fb8a81fe0ba4710c641e1b65c5b71ad4a4
diff --git a/filesystem/system_image.go b/filesystem/system_image.go
index 15cacfb..69d922d 100644
--- a/filesystem/system_image.go
+++ b/filesystem/system_image.go
@@ -94,9 +94,10 @@
return output
}
-// Filter the result of GatherPackagingSpecs to discard items targeting outside "system" partition.
-// Note that "apex" module installs its contents to "apex"(fake partition) as well
+// Filter the result of GatherPackagingSpecs to discard items targeting outside "system" / "root"
+// partition. Note that "apex" module installs its contents to "apex"(fake partition) as well
// for symbol lookup by imitating "activated" paths.
func (s *systemImage) filterPackagingSpec(ps android.PackagingSpec) bool {
- return s.filesystem.filterInstallablePackagingSpec(ps) && ps.Partition() == "system"
+ return s.filesystem.filterInstallablePackagingSpec(ps) &&
+ (ps.Partition() == "system" || ps.Partition() == "root")
}