Add cmdline file to target_files.zip

This contains the cmdline used to build boot and vendor_boot

Bug: 385383524
Test: diff'd the target_files.zip created by make and soong
Change-Id: I47d3fd5debad25c31ee84bf4a4d3d879621220f7
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index 1af9af9..840ed8c 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -15,6 +15,8 @@
 package filesystem
 
 import (
+	"strings"
+
 	"android/soong/android"
 
 	"github.com/google/blueprint"
@@ -148,6 +150,19 @@
 			Implicit(fsInfo.Output) // so that the staging dir is built
 
 	}
+	// Copy cmdline files of boot images
+	if a.partitionProps.Vendor_boot_partition_name != nil {
+		bootImg := ctx.GetDirectDepWithTag(proptools.String(a.partitionProps.Vendor_boot_partition_name), filesystemDepTag)
+		bootImgInfo, _ := android.OtherModuleProvider(ctx, bootImg, BootimgInfoProvider)
+		builder.Command().Textf("echo %s > %s/%s/cmdline", proptools.ShellEscape(strings.Join(bootImgInfo.Cmdline, " ")), targetFilesDir, "VENDOR_BOOT")
+		builder.Command().Textf("echo %s > %s/%s/vendor_cmdline", proptools.ShellEscape(strings.Join(bootImgInfo.Cmdline, " ")), targetFilesDir, "VENDOR_BOOT")
+	}
+	if a.partitionProps.Boot_partition_name != nil {
+		bootImg := ctx.GetDirectDepWithTag(proptools.String(a.partitionProps.Boot_partition_name), filesystemDepTag)
+		bootImgInfo, _ := android.OtherModuleProvider(ctx, bootImg, BootimgInfoProvider)
+		builder.Command().Textf("echo %s > %s/%s/cmdline", proptools.ShellEscape(strings.Join(bootImgInfo.Cmdline, " ")), targetFilesDir, "BOOT")
+	}
+
 	builder.Command().
 		BuiltTool("soong_zip").
 		Text("-d").