Assemble ROOT/ files of target_files.zip

rsync will be used to copy the root files of the system_image dep

Test: verified that ROOT/ in target_files.zip is same when built with
make and soong
Bug: 385383524

Change-Id: I84279109308d36ec147a63000bb1912c2ffb1273
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index 406f47c..8e2b9f7 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -202,6 +202,10 @@
 			Textf("-rd %s/. %s/%s", rootDirString, targetFilesDir, subdir).
 			Implicit(fsInfo.Output) // so that the staging dir is built
 
+		if subdir == "SYSTEM" {
+			// Create the ROOT partition in target_files.zip
+			builder.Command().Textf("rsync --links --exclude=system/* %s/ -r %s/ROOT", fsInfo.RootDir, targetFilesDir.String())
+		}
 	}
 	// Copy cmdline, kernel etc. files of boot images
 	if a.partitionProps.Vendor_boot_partition_name != nil {