From 3c0a042d2056f35ffa7859c72d0aea1c9592e449 Mon Sep 17 00:00:00 2001 From: Inseob Kim Date: Tue, 5 Nov 2024 17:21:37 +0900 Subject: Add GSI support for android_system_image GSI's system.img includes system_ext and product artifacts. This patches android_system_image module so it can include such artifacts when building GSI. Bug: 370351758 Test: m android_gsi Change-Id: Id29678b1101e787e88dbedae38cdbf6d82d1cb95 --- filesystem/system_image.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'filesystem/system_image.go') diff --git a/filesystem/system_image.go b/filesystem/system_image.go index 672458c53..4d176ae45 100644 --- a/filesystem/system_image.go +++ b/filesystem/system_image.go @@ -18,6 +18,9 @@ import ( "android/soong/android" "android/soong/linkerconfig" + "path/filepath" + "strings" + "github.com/google/blueprint/proptools" ) @@ -58,5 +61,14 @@ func (s *systemImage) BuildLinkerConfigFile(ctx android.ModuleContext, builder * // for symbol lookup by imitating "activated" paths. func (s *systemImage) FilterPackagingSpec(ps android.PackagingSpec) bool { return !ps.SkipInstall() && - (ps.Partition() == "system" || ps.Partition() == "root") + (ps.Partition() == "system" || ps.Partition() == "root" || + strings.HasPrefix(ps.Partition(), "system/")) +} + +func (s *systemImage) ModifyPackagingSpec(ps *android.PackagingSpec) { + if strings.HasPrefix(ps.Partition(), "system/") { + subPartition := strings.TrimPrefix(ps.Partition(), "system/") + ps.SetPartition("system") + ps.SetRelPathInPackage(filepath.Join(subPartition, ps.RelPathInPackage())) + } } -- cgit v1.2.3-59-g8ed1b