From 8638a21ca00e79d74a61497c9fc8088d0b80b955 Mon Sep 17 00:00:00 2001 From: Song Guo Date: Tue, 20 Oct 2026 08:24:36 +0000 Subject: [PATCH] cvd: add acpi_table, device_tree_overlay, and file_backed_mapping to DiskArtifacts proto schema Add optional acpi_table, device_tree_overlay (DeviceTreeOverlayArtifact), and file_backed_mapping (FileBackedMapping) fields to message DiskArtifacts in load_config.proto, along with regenerated Go bindings. In cf_disk_configs.cpp, parse these fields, validate required parameters, and emit the corresponding --crosvm_acpi_table, --crosvm_device_tree_overlay, and --crosvm_file_backed_mapping_base64 flags. Given current usage of these flags, define the fields as optional in DiskArtifacts (they can be promoted to repeated in the future without breaking existing JSON configs). In the proto, only the minimal arguments for the functions are added. Bug: 544996625 Bug: 539399873 Test: bazel test //cuttlefish/host/commands/cvd/cli/parser/... Assisted-by: Jetski:Gemini TAG=agy CONV=9d324de2-493b-495b-8490-a20d8e687190 --- .../cvd/cli/parser/cf_configs_instances.cpp | 2 +- .../cvd/cli/parser/golang/load_config.pb.go | 417 ++++++++---- .../cvd/cli/parser/instance/BUILD.bazel | 4 + .../cli/parser/instance/cf_disk_configs.cpp | 85 ++- .../cvd/cli/parser/instance/cf_disk_configs.h | 3 +- .../cli/parser/instance/disk_configs_test.cc | 595 ++++++++++++++++++ .../commands/cvd/cli/parser/load_config.proto | 21 + 7 files changed, 988 insertions(+), 139 deletions(-) diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/cf_configs_instances.cpp b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/cf_configs_instances.cpp index 2dc06fd594e..73d947c5278 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/cf_configs_instances.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/cf_configs_instances.cpp @@ -62,7 +62,7 @@ std::vector GenerateConfigFlags( Result> GenerateInstancesFlags( const EnvironmentSpecification& cfg) { std::vector res = CF_EXPECT(GenerateBootFlags(cfg)); - res = MergeResults(std::move(res), GenerateDiskFlags(cfg)); + res = MergeResults(std::move(res), CF_EXPECT(GenerateDiskFlags(cfg))); res = MergeResults(std::move(res), CF_EXPECT(GenerateGraphicsFlags(cfg))); res = MergeResults(std::move(res), GenerateSecurityFlags(cfg)); res = MergeResults(std::move(res), GenerateStreamingFlags(cfg)); diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/golang/load_config.pb.go b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/golang/load_config.pb.go index ce2898419ab..ba31072aa8b 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/golang/load_config.pb.go +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/golang/load_config.pb.go @@ -931,16 +931,123 @@ func (x *Display) GetOverlays() []*DisplayOverlay { return nil } -type DiskArtifacts struct { +type DeviceTreeOverlayArtifact struct { + state protoimpl.MessageState `protogen:"open.v1"` + Build string `protobuf:"bytes,1,opt,name=build,proto3" json:"build,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeviceTreeOverlayArtifact) Reset() { + *x = DeviceTreeOverlayArtifact{} + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeviceTreeOverlayArtifact) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceTreeOverlayArtifact) ProtoMessage() {} + +func (x *DeviceTreeOverlayArtifact) ProtoReflect() protoreflect.Message { + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceTreeOverlayArtifact.ProtoReflect.Descriptor instead. +func (*DeviceTreeOverlayArtifact) Descriptor() ([]byte, []int) { + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{11} +} + +func (x *DeviceTreeOverlayArtifact) GetBuild() string { + if x != nil { + return x.Build + } + return "" +} + +type FileBackedMapping struct { state protoimpl.MessageState `protogen:"open.v1"` - VendorBoot *string `protobuf:"bytes,1,opt,name=vendor_boot,json=vendorBoot,proto3,oneof" json:"vendor_boot,omitempty"` + Build string `protobuf:"bytes,1,opt,name=build,proto3" json:"build,omitempty"` + Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` + Size string `protobuf:"bytes,3,opt,name=size,proto3" json:"size,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } +func (x *FileBackedMapping) Reset() { + *x = FileBackedMapping{} + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FileBackedMapping) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileBackedMapping) ProtoMessage() {} + +func (x *FileBackedMapping) ProtoReflect() protoreflect.Message { + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileBackedMapping.ProtoReflect.Descriptor instead. +func (*FileBackedMapping) Descriptor() ([]byte, []int) { + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{12} +} + +func (x *FileBackedMapping) GetBuild() string { + if x != nil { + return x.Build + } + return "" +} + +func (x *FileBackedMapping) GetAddr() string { + if x != nil { + return x.Addr + } + return "" +} + +func (x *FileBackedMapping) GetSize() string { + if x != nil { + return x.Size + } + return "" +} + +type DiskArtifacts struct { + state protoimpl.MessageState `protogen:"open.v1"` + VendorBoot *string `protobuf:"bytes,1,opt,name=vendor_boot,json=vendorBoot,proto3,oneof" json:"vendor_boot,omitempty"` + AcpiTable *string `protobuf:"bytes,2,opt,name=acpi_table,json=acpiTable,proto3,oneof" json:"acpi_table,omitempty"` + DeviceTreeOverlay *DeviceTreeOverlayArtifact `protobuf:"bytes,3,opt,name=device_tree_overlay,json=deviceTreeOverlay,proto3,oneof" json:"device_tree_overlay,omitempty"` + FileBackedMapping *FileBackedMapping `protobuf:"bytes,4,opt,name=file_backed_mapping,json=fileBackedMapping,proto3,oneof" json:"file_backed_mapping,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + func (x *DiskArtifacts) Reset() { *x = DiskArtifacts{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[11] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -952,7 +1059,7 @@ func (x *DiskArtifacts) String() string { func (*DiskArtifacts) ProtoMessage() {} func (x *DiskArtifacts) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[11] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -965,7 +1072,7 @@ func (x *DiskArtifacts) ProtoReflect() protoreflect.Message { // Deprecated: Use DiskArtifacts.ProtoReflect.Descriptor instead. func (*DiskArtifacts) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{11} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{13} } func (x *DiskArtifacts) GetVendorBoot() string { @@ -975,6 +1082,27 @@ func (x *DiskArtifacts) GetVendorBoot() string { return "" } +func (x *DiskArtifacts) GetAcpiTable() string { + if x != nil && x.AcpiTable != nil { + return *x.AcpiTable + } + return "" +} + +func (x *DiskArtifacts) GetDeviceTreeOverlay() *DeviceTreeOverlayArtifact { + if x != nil { + return x.DeviceTreeOverlay + } + return nil +} + +func (x *DiskArtifacts) GetFileBackedMapping() *FileBackedMapping { + if x != nil { + return x.FileBackedMapping + } + return nil +} + type Disk struct { state protoimpl.MessageState `protogen:"open.v1"` DefaultBuild *string `protobuf:"bytes,1,opt,name=default_build,json=defaultBuild,proto3,oneof" json:"default_build,omitempty"` @@ -990,7 +1118,7 @@ type Disk struct { func (x *Disk) Reset() { *x = Disk{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[12] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1002,7 +1130,7 @@ func (x *Disk) String() string { func (*Disk) ProtoMessage() {} func (x *Disk) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[12] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1015,7 +1143,7 @@ func (x *Disk) ProtoReflect() protoreflect.Message { // Deprecated: Use Disk.ProtoReflect.Descriptor instead. func (*Disk) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{12} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{14} } func (x *Disk) GetDefaultBuild() string { @@ -1076,7 +1204,7 @@ type Super struct { func (x *Super) Reset() { *x = Super{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[13] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1088,7 +1216,7 @@ func (x *Super) String() string { func (*Super) ProtoMessage() {} func (x *Super) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[13] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1101,7 +1229,7 @@ func (x *Super) ProtoReflect() protoreflect.Message { // Deprecated: Use Super.ProtoReflect.Descriptor instead. func (*Super) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{13} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{15} } func (x *Super) GetSystem() string { @@ -1122,7 +1250,7 @@ type Security struct { func (x *Security) Reset() { *x = Security{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[14] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1134,7 +1262,7 @@ func (x *Security) String() string { func (*Security) ProtoMessage() {} func (x *Security) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[14] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1147,7 +1275,7 @@ func (x *Security) ProtoReflect() protoreflect.Message { // Deprecated: Use Security.ProtoReflect.Descriptor instead. func (*Security) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{14} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{16} } func (x *Security) GetSerialNumber() string { @@ -1180,7 +1308,7 @@ type Streaming struct { func (x *Streaming) Reset() { *x = Streaming{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[15] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1192,7 +1320,7 @@ func (x *Streaming) String() string { func (*Streaming) ProtoMessage() {} func (x *Streaming) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[15] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1205,7 +1333,7 @@ func (x *Streaming) ProtoReflect() protoreflect.Message { // Deprecated: Use Streaming.ProtoReflect.Descriptor instead. func (*Streaming) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{15} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{17} } func (x *Streaming) GetDeviceId() string { @@ -1224,7 +1352,7 @@ type Media struct { func (x *Media) Reset() { *x = Media{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[16] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1236,7 +1364,7 @@ func (x *Media) String() string { func (*Media) ProtoMessage() {} func (x *Media) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[16] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1249,7 +1377,7 @@ func (x *Media) ProtoReflect() protoreflect.Message { // Deprecated: Use Media.ProtoReflect.Descriptor instead. func (*Media) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{16} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{18} } func (x *Media) GetDevices() []*MediaDevice { @@ -1275,7 +1403,7 @@ type MediaDevice struct { func (x *MediaDevice) Reset() { *x = MediaDevice{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[17] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1287,7 +1415,7 @@ func (x *MediaDevice) String() string { func (*MediaDevice) ProtoMessage() {} func (x *MediaDevice) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[17] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1300,7 +1428,7 @@ func (x *MediaDevice) ProtoReflect() protoreflect.Message { // Deprecated: Use MediaDevice.ProtoReflect.Descriptor instead. func (*MediaDevice) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{17} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{19} } func (x *MediaDevice) GetDevice() isMediaDevice_Device { @@ -1389,7 +1517,7 @@ type V4L2EmulatedCameraSplane struct { func (x *V4L2EmulatedCameraSplane) Reset() { *x = V4L2EmulatedCameraSplane{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[18] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1401,7 +1529,7 @@ func (x *V4L2EmulatedCameraSplane) String() string { func (*V4L2EmulatedCameraSplane) ProtoMessage() {} func (x *V4L2EmulatedCameraSplane) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[18] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1414,7 +1542,7 @@ func (x *V4L2EmulatedCameraSplane) ProtoReflect() protoreflect.Message { // Deprecated: Use V4L2EmulatedCameraSplane.ProtoReflect.Descriptor instead. func (*V4L2EmulatedCameraSplane) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{18} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{20} } type V4L2EmulatedCameraMplane struct { @@ -1425,7 +1553,7 @@ type V4L2EmulatedCameraMplane struct { func (x *V4L2EmulatedCameraMplane) Reset() { *x = V4L2EmulatedCameraMplane{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[19] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1437,7 +1565,7 @@ func (x *V4L2EmulatedCameraMplane) String() string { func (*V4L2EmulatedCameraMplane) ProtoMessage() {} func (x *V4L2EmulatedCameraMplane) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[19] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1450,7 +1578,7 @@ func (x *V4L2EmulatedCameraMplane) ProtoReflect() protoreflect.Message { // Deprecated: Use V4L2EmulatedCameraMplane.ProtoReflect.Descriptor instead. func (*V4L2EmulatedCameraMplane) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{19} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{21} } type V4L2Proxy struct { @@ -1462,7 +1590,7 @@ type V4L2Proxy struct { func (x *V4L2Proxy) Reset() { *x = V4L2Proxy{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[20] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1474,7 +1602,7 @@ func (x *V4L2Proxy) String() string { func (*V4L2Proxy) ProtoMessage() {} func (x *V4L2Proxy) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[20] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1487,7 +1615,7 @@ func (x *V4L2Proxy) ProtoReflect() protoreflect.Message { // Deprecated: Use V4L2Proxy.ProtoReflect.Descriptor instead. func (*V4L2Proxy) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{20} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{22} } func (x *V4L2Proxy) GetDevicePath() string { @@ -1509,7 +1637,7 @@ type V4L2StreamProxy struct { func (x *V4L2StreamProxy) Reset() { *x = V4L2StreamProxy{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[21] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1521,7 +1649,7 @@ func (x *V4L2StreamProxy) String() string { func (*V4L2StreamProxy) ProtoMessage() {} func (x *V4L2StreamProxy) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[21] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1534,7 +1662,7 @@ func (x *V4L2StreamProxy) ProtoReflect() protoreflect.Message { // Deprecated: Use V4L2StreamProxy.ProtoReflect.Descriptor instead. func (*V4L2StreamProxy) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{21} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{23} } func (x *V4L2StreamProxy) GetInputPath() string { @@ -1587,7 +1715,7 @@ type Vm struct { func (x *Vm) Reset() { *x = Vm{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[22] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1599,7 +1727,7 @@ func (x *Vm) String() string { func (*Vm) ProtoMessage() {} func (x *Vm) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[22] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1612,7 +1740,7 @@ func (x *Vm) ProtoReflect() protoreflect.Message { // Deprecated: Use Vm.ProtoReflect.Descriptor instead. func (*Vm) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{22} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{24} } func (x *Vm) GetCpus() uint32 { @@ -1739,7 +1867,7 @@ type Crosvm struct { func (x *Crosvm) Reset() { *x = Crosvm{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[23] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1751,7 +1879,7 @@ func (x *Crosvm) String() string { func (*Crosvm) ProtoMessage() {} func (x *Crosvm) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[23] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1764,7 +1892,7 @@ func (x *Crosvm) ProtoReflect() protoreflect.Message { // Deprecated: Use Crosvm.ProtoReflect.Descriptor instead. func (*Crosvm) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{23} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{25} } func (x *Crosvm) GetEnableSandbox() bool { @@ -1803,7 +1931,7 @@ type Gem5 struct { func (x *Gem5) Reset() { *x = Gem5{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[24] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1815,7 +1943,7 @@ func (x *Gem5) String() string { func (*Gem5) ProtoMessage() {} func (x *Gem5) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[24] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1828,7 +1956,7 @@ func (x *Gem5) ProtoReflect() protoreflect.Message { // Deprecated: Use Gem5.ProtoReflect.Descriptor instead. func (*Gem5) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{24} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{26} } type Qemu struct { @@ -1839,7 +1967,7 @@ type Qemu struct { func (x *Qemu) Reset() { *x = Qemu{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[25] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1851,7 +1979,7 @@ func (x *Qemu) String() string { func (*Qemu) ProtoMessage() {} func (x *Qemu) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[25] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[27] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1864,7 +1992,7 @@ func (x *Qemu) ProtoReflect() protoreflect.Message { // Deprecated: Use Qemu.ProtoReflect.Descriptor instead. func (*Qemu) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{25} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{27} } type CustomAction struct { @@ -1880,7 +2008,7 @@ type CustomAction struct { func (x *CustomAction) Reset() { *x = CustomAction{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[26] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1892,7 +2020,7 @@ func (x *CustomAction) String() string { func (*CustomAction) ProtoMessage() {} func (x *CustomAction) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[26] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[28] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1905,7 +2033,7 @@ func (x *CustomAction) ProtoReflect() protoreflect.Message { // Deprecated: Use CustomAction.ProtoReflect.Descriptor instead. func (*CustomAction) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{26} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{28} } func (x *CustomAction) GetShellCommand() string { @@ -1954,7 +2082,7 @@ type Button struct { func (x *Button) Reset() { *x = Button{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[27] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1966,7 +2094,7 @@ func (x *Button) String() string { func (*Button) ProtoMessage() {} func (x *Button) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[27] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[29] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1979,7 +2107,7 @@ func (x *Button) ProtoReflect() protoreflect.Message { // Deprecated: Use Button.ProtoReflect.Descriptor instead. func (*Button) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{27} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{29} } func (x *Button) GetCommand() string { @@ -2013,7 +2141,7 @@ type DeviceState struct { func (x *DeviceState) Reset() { *x = DeviceState{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[28] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2025,7 +2153,7 @@ func (x *DeviceState) String() string { func (*DeviceState) ProtoMessage() {} func (x *DeviceState) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[28] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[30] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2038,7 +2166,7 @@ func (x *DeviceState) ProtoReflect() protoreflect.Message { // Deprecated: Use DeviceState.ProtoReflect.Descriptor instead. func (*DeviceState) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{28} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{30} } func (x *DeviceState) GetLidSwitchOpen() bool { @@ -2064,7 +2192,7 @@ type Metrics struct { func (x *Metrics) Reset() { *x = Metrics{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[29] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2076,7 +2204,7 @@ func (x *Metrics) String() string { func (*Metrics) ProtoMessage() {} func (x *Metrics) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[29] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[31] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2089,7 +2217,7 @@ func (x *Metrics) ProtoReflect() protoreflect.Message { // Deprecated: Use Metrics.ProtoReflect.Descriptor instead. func (*Metrics) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{29} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{31} } func (x *Metrics) GetEnable() bool { @@ -2109,7 +2237,7 @@ type DisplayOverlay struct { func (x *DisplayOverlay) Reset() { *x = DisplayOverlay{} - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[30] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2121,7 +2249,7 @@ func (x *DisplayOverlay) String() string { func (*DisplayOverlay) ProtoMessage() {} func (x *DisplayOverlay) ProtoReflect() protoreflect.Message { - mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[30] + mi := &file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[32] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2134,7 +2262,7 @@ func (x *DisplayOverlay) ProtoReflect() protoreflect.Message { // Deprecated: Use DisplayOverlay.ProtoReflect.Descriptor instead. func (*DisplayOverlay) Descriptor() ([]byte, []int) { - return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{30} + return file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP(), []int{32} } func (x *DisplayOverlay) GetVmIndex() int32 { @@ -2283,11 +2411,24 @@ const file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDesc = " "\x06_widthB\t\n" + "\a_heightB\x06\n" + "\x04_dpiB\x15\n" + - "\x13_refresh_rate_hertz\"E\n" + + "\x13_refresh_rate_hertz\"1\n" + + "\x19DeviceTreeOverlayArtifact\x12\x14\n" + + "\x05build\x18\x01 \x01(\tR\x05build\"Q\n" + + "\x11FileBackedMapping\x12\x14\n" + + "\x05build\x18\x01 \x01(\tR\x05build\x12\x12\n" + + "\x04addr\x18\x02 \x01(\tR\x04addr\x12\x12\n" + + "\x04size\x18\x03 \x01(\tR\x04size\"\xee\x02\n" + "\rDiskArtifacts\x12$\n" + "\vvendor_boot\x18\x01 \x01(\tH\x00R\n" + - "vendorBoot\x88\x01\x01B\x0e\n" + - "\f_vendor_boot\"\x9a\x04\n" + + "vendorBoot\x88\x01\x01\x12\"\n" + + "\n" + + "acpi_table\x18\x02 \x01(\tH\x01R\tacpiTable\x88\x01\x01\x12e\n" + + "\x13device_tree_overlay\x18\x03 \x01(\v20.cuttlefish.cvd.config.DeviceTreeOverlayArtifactH\x02R\x11deviceTreeOverlay\x88\x01\x01\x12]\n" + + "\x13file_backed_mapping\x18\x04 \x01(\v2(.cuttlefish.cvd.config.FileBackedMappingH\x03R\x11fileBackedMapping\x88\x01\x01B\x0e\n" + + "\f_vendor_bootB\r\n" + + "\v_acpi_tableB\x16\n" + + "\x14_device_tree_overlayB\x16\n" + + "\x14_file_backed_mapping\"\x9a\x04\n" + "\x04Disk\x12(\n" + "\rdefault_build\x18\x01 \x01(\tH\x00R\fdefaultBuild\x88\x01\x01\x12A\n" + "\x0fsuper_partition\x18\x02 \x01(\v2\x1c.cuttlefish.cvd.config.SuperH\x01R\x05super\x88\x01\x01\x12-\n" + @@ -2431,85 +2572,89 @@ func file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDescGZIP( } var file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes = make([]protoimpl.MessageInfo, 31) +var file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes = make([]protoimpl.MessageInfo, 33) var file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_goTypes = []any{ - (UserPageSize)(0), // 0: cuttlefish.cvd.config.UserPageSize - (ModemSimulatorSimType)(0), // 1: cuttlefish.cvd.config.ModemSimulatorSimType - (*EnvironmentSpecification)(nil), // 2: cuttlefish.cvd.config.EnvironmentSpecification - (*EnvironmentOptions)(nil), // 3: cuttlefish.cvd.config.EnvironmentOptions - (*Common)(nil), // 4: cuttlefish.cvd.config.Common - (*Fetch)(nil), // 5: cuttlefish.cvd.config.Fetch - (*Instance)(nil), // 6: cuttlefish.cvd.config.Instance - (*Boot)(nil), // 7: cuttlefish.cvd.config.Boot - (*Build)(nil), // 8: cuttlefish.cvd.config.Build - (*Connectivity)(nil), // 9: cuttlefish.cvd.config.Connectivity - (*Vsock)(nil), // 10: cuttlefish.cvd.config.Vsock - (*Graphics)(nil), // 11: cuttlefish.cvd.config.Graphics - (*Display)(nil), // 12: cuttlefish.cvd.config.Display - (*DiskArtifacts)(nil), // 13: cuttlefish.cvd.config.DiskArtifacts - (*Disk)(nil), // 14: cuttlefish.cvd.config.Disk - (*Super)(nil), // 15: cuttlefish.cvd.config.Super - (*Security)(nil), // 16: cuttlefish.cvd.config.Security - (*Streaming)(nil), // 17: cuttlefish.cvd.config.Streaming - (*Media)(nil), // 18: cuttlefish.cvd.config.Media - (*MediaDevice)(nil), // 19: cuttlefish.cvd.config.MediaDevice - (*V4L2EmulatedCameraSplane)(nil), // 20: cuttlefish.cvd.config.V4l2EmulatedCameraSplane - (*V4L2EmulatedCameraMplane)(nil), // 21: cuttlefish.cvd.config.V4l2EmulatedCameraMplane - (*V4L2Proxy)(nil), // 22: cuttlefish.cvd.config.V4l2Proxy - (*V4L2StreamProxy)(nil), // 23: cuttlefish.cvd.config.V4l2StreamProxy - (*Vm)(nil), // 24: cuttlefish.cvd.config.Vm - (*Crosvm)(nil), // 25: cuttlefish.cvd.config.Crosvm - (*Gem5)(nil), // 26: cuttlefish.cvd.config.Gem5 - (*Qemu)(nil), // 27: cuttlefish.cvd.config.Qemu - (*CustomAction)(nil), // 28: cuttlefish.cvd.config.CustomAction - (*Button)(nil), // 29: cuttlefish.cvd.config.Button - (*DeviceState)(nil), // 30: cuttlefish.cvd.config.DeviceState - (*Metrics)(nil), // 31: cuttlefish.cvd.config.Metrics - (*DisplayOverlay)(nil), // 32: cuttlefish.cvd.config.DisplayOverlay + (UserPageSize)(0), // 0: cuttlefish.cvd.config.UserPageSize + (ModemSimulatorSimType)(0), // 1: cuttlefish.cvd.config.ModemSimulatorSimType + (*EnvironmentSpecification)(nil), // 2: cuttlefish.cvd.config.EnvironmentSpecification + (*EnvironmentOptions)(nil), // 3: cuttlefish.cvd.config.EnvironmentOptions + (*Common)(nil), // 4: cuttlefish.cvd.config.Common + (*Fetch)(nil), // 5: cuttlefish.cvd.config.Fetch + (*Instance)(nil), // 6: cuttlefish.cvd.config.Instance + (*Boot)(nil), // 7: cuttlefish.cvd.config.Boot + (*Build)(nil), // 8: cuttlefish.cvd.config.Build + (*Connectivity)(nil), // 9: cuttlefish.cvd.config.Connectivity + (*Vsock)(nil), // 10: cuttlefish.cvd.config.Vsock + (*Graphics)(nil), // 11: cuttlefish.cvd.config.Graphics + (*Display)(nil), // 12: cuttlefish.cvd.config.Display + (*DeviceTreeOverlayArtifact)(nil), // 13: cuttlefish.cvd.config.DeviceTreeOverlayArtifact + (*FileBackedMapping)(nil), // 14: cuttlefish.cvd.config.FileBackedMapping + (*DiskArtifacts)(nil), // 15: cuttlefish.cvd.config.DiskArtifacts + (*Disk)(nil), // 16: cuttlefish.cvd.config.Disk + (*Super)(nil), // 17: cuttlefish.cvd.config.Super + (*Security)(nil), // 18: cuttlefish.cvd.config.Security + (*Streaming)(nil), // 19: cuttlefish.cvd.config.Streaming + (*Media)(nil), // 20: cuttlefish.cvd.config.Media + (*MediaDevice)(nil), // 21: cuttlefish.cvd.config.MediaDevice + (*V4L2EmulatedCameraSplane)(nil), // 22: cuttlefish.cvd.config.V4l2EmulatedCameraSplane + (*V4L2EmulatedCameraMplane)(nil), // 23: cuttlefish.cvd.config.V4l2EmulatedCameraMplane + (*V4L2Proxy)(nil), // 24: cuttlefish.cvd.config.V4l2Proxy + (*V4L2StreamProxy)(nil), // 25: cuttlefish.cvd.config.V4l2StreamProxy + (*Vm)(nil), // 26: cuttlefish.cvd.config.Vm + (*Crosvm)(nil), // 27: cuttlefish.cvd.config.Crosvm + (*Gem5)(nil), // 28: cuttlefish.cvd.config.Gem5 + (*Qemu)(nil), // 29: cuttlefish.cvd.config.Qemu + (*CustomAction)(nil), // 30: cuttlefish.cvd.config.CustomAction + (*Button)(nil), // 31: cuttlefish.cvd.config.Button + (*DeviceState)(nil), // 32: cuttlefish.cvd.config.DeviceState + (*Metrics)(nil), // 33: cuttlefish.cvd.config.Metrics + (*DisplayOverlay)(nil), // 34: cuttlefish.cvd.config.DisplayOverlay } var file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_depIdxs = []int32{ 6, // 0: cuttlefish.cvd.config.EnvironmentSpecification.instances:type_name -> cuttlefish.cvd.config.Instance 5, // 1: cuttlefish.cvd.config.EnvironmentSpecification.fetch:type_name -> cuttlefish.cvd.config.Fetch - 31, // 2: cuttlefish.cvd.config.EnvironmentSpecification.metrics:type_name -> cuttlefish.cvd.config.Metrics + 33, // 2: cuttlefish.cvd.config.EnvironmentSpecification.metrics:type_name -> cuttlefish.cvd.config.Metrics 4, // 3: cuttlefish.cvd.config.EnvironmentSpecification.common:type_name -> cuttlefish.cvd.config.Common 5, // 4: cuttlefish.cvd.config.EnvironmentOptions.fetch:type_name -> cuttlefish.cvd.config.Fetch - 31, // 5: cuttlefish.cvd.config.EnvironmentOptions.metrics:type_name -> cuttlefish.cvd.config.Metrics + 33, // 5: cuttlefish.cvd.config.EnvironmentOptions.metrics:type_name -> cuttlefish.cvd.config.Metrics 4, // 6: cuttlefish.cvd.config.EnvironmentOptions.common:type_name -> cuttlefish.cvd.config.Common - 24, // 7: cuttlefish.cvd.config.Instance.vm:type_name -> cuttlefish.cvd.config.Vm + 26, // 7: cuttlefish.cvd.config.Instance.vm:type_name -> cuttlefish.cvd.config.Vm 7, // 8: cuttlefish.cvd.config.Instance.boot:type_name -> cuttlefish.cvd.config.Boot - 16, // 9: cuttlefish.cvd.config.Instance.security:type_name -> cuttlefish.cvd.config.Security - 14, // 10: cuttlefish.cvd.config.Instance.disk:type_name -> cuttlefish.cvd.config.Disk + 18, // 9: cuttlefish.cvd.config.Instance.security:type_name -> cuttlefish.cvd.config.Security + 16, // 10: cuttlefish.cvd.config.Instance.disk:type_name -> cuttlefish.cvd.config.Disk 11, // 11: cuttlefish.cvd.config.Instance.graphics:type_name -> cuttlefish.cvd.config.Graphics - 17, // 12: cuttlefish.cvd.config.Instance.streaming:type_name -> cuttlefish.cvd.config.Streaming + 19, // 12: cuttlefish.cvd.config.Instance.streaming:type_name -> cuttlefish.cvd.config.Streaming 9, // 13: cuttlefish.cvd.config.Instance.connectivity:type_name -> cuttlefish.cvd.config.Connectivity - 18, // 14: cuttlefish.cvd.config.Instance.media:type_name -> cuttlefish.cvd.config.Media + 20, // 14: cuttlefish.cvd.config.Instance.media:type_name -> cuttlefish.cvd.config.Media 8, // 15: cuttlefish.cvd.config.Boot.kernel:type_name -> cuttlefish.cvd.config.Build 8, // 16: cuttlefish.cvd.config.Boot.bootloader:type_name -> cuttlefish.cvd.config.Build 8, // 17: cuttlefish.cvd.config.Boot.android_efi_loader:type_name -> cuttlefish.cvd.config.Build 10, // 18: cuttlefish.cvd.config.Connectivity.vsock:type_name -> cuttlefish.cvd.config.Vsock 1, // 19: cuttlefish.cvd.config.Connectivity.modem_simulator_sim_type:type_name -> cuttlefish.cvd.config.ModemSimulatorSimType 12, // 20: cuttlefish.cvd.config.Graphics.displays:type_name -> cuttlefish.cvd.config.Display - 32, // 21: cuttlefish.cvd.config.Display.overlays:type_name -> cuttlefish.cvd.config.DisplayOverlay - 15, // 22: cuttlefish.cvd.config.Disk.super_partition:type_name -> cuttlefish.cvd.config.Super - 13, // 23: cuttlefish.cvd.config.Disk.disk_artifacts:type_name -> cuttlefish.cvd.config.DiskArtifacts - 19, // 24: cuttlefish.cvd.config.Media.devices:type_name -> cuttlefish.cvd.config.MediaDevice - 20, // 25: cuttlefish.cvd.config.MediaDevice.v4l2_emulated_camera_splane:type_name -> cuttlefish.cvd.config.V4l2EmulatedCameraSplane - 21, // 26: cuttlefish.cvd.config.MediaDevice.v4l2_emulated_camera_mplane:type_name -> cuttlefish.cvd.config.V4l2EmulatedCameraMplane - 22, // 27: cuttlefish.cvd.config.MediaDevice.v4l2_proxy:type_name -> cuttlefish.cvd.config.V4l2Proxy - 23, // 28: cuttlefish.cvd.config.MediaDevice.v4l2_stream_proxy:type_name -> cuttlefish.cvd.config.V4l2StreamProxy - 25, // 29: cuttlefish.cvd.config.Vm.crosvm:type_name -> cuttlefish.cvd.config.Crosvm - 26, // 30: cuttlefish.cvd.config.Vm.gem5:type_name -> cuttlefish.cvd.config.Gem5 - 27, // 31: cuttlefish.cvd.config.Vm.qemu:type_name -> cuttlefish.cvd.config.Qemu - 28, // 32: cuttlefish.cvd.config.Vm.custom_actions:type_name -> cuttlefish.cvd.config.CustomAction - 0, // 33: cuttlefish.cvd.config.Vm.page_size:type_name -> cuttlefish.cvd.config.UserPageSize - 29, // 34: cuttlefish.cvd.config.CustomAction.button:type_name -> cuttlefish.cvd.config.Button - 29, // 35: cuttlefish.cvd.config.CustomAction.buttons:type_name -> cuttlefish.cvd.config.Button - 30, // 36: cuttlefish.cvd.config.CustomAction.device_states:type_name -> cuttlefish.cvd.config.DeviceState - 37, // [37:37] is the sub-list for method output_type - 37, // [37:37] is the sub-list for method input_type - 37, // [37:37] is the sub-list for extension type_name - 37, // [37:37] is the sub-list for extension extendee - 0, // [0:37] is the sub-list for field type_name + 34, // 21: cuttlefish.cvd.config.Display.overlays:type_name -> cuttlefish.cvd.config.DisplayOverlay + 13, // 22: cuttlefish.cvd.config.DiskArtifacts.device_tree_overlay:type_name -> cuttlefish.cvd.config.DeviceTreeOverlayArtifact + 14, // 23: cuttlefish.cvd.config.DiskArtifacts.file_backed_mapping:type_name -> cuttlefish.cvd.config.FileBackedMapping + 17, // 24: cuttlefish.cvd.config.Disk.super_partition:type_name -> cuttlefish.cvd.config.Super + 15, // 25: cuttlefish.cvd.config.Disk.disk_artifacts:type_name -> cuttlefish.cvd.config.DiskArtifacts + 21, // 26: cuttlefish.cvd.config.Media.devices:type_name -> cuttlefish.cvd.config.MediaDevice + 22, // 27: cuttlefish.cvd.config.MediaDevice.v4l2_emulated_camera_splane:type_name -> cuttlefish.cvd.config.V4l2EmulatedCameraSplane + 23, // 28: cuttlefish.cvd.config.MediaDevice.v4l2_emulated_camera_mplane:type_name -> cuttlefish.cvd.config.V4l2EmulatedCameraMplane + 24, // 29: cuttlefish.cvd.config.MediaDevice.v4l2_proxy:type_name -> cuttlefish.cvd.config.V4l2Proxy + 25, // 30: cuttlefish.cvd.config.MediaDevice.v4l2_stream_proxy:type_name -> cuttlefish.cvd.config.V4l2StreamProxy + 27, // 31: cuttlefish.cvd.config.Vm.crosvm:type_name -> cuttlefish.cvd.config.Crosvm + 28, // 32: cuttlefish.cvd.config.Vm.gem5:type_name -> cuttlefish.cvd.config.Gem5 + 29, // 33: cuttlefish.cvd.config.Vm.qemu:type_name -> cuttlefish.cvd.config.Qemu + 30, // 34: cuttlefish.cvd.config.Vm.custom_actions:type_name -> cuttlefish.cvd.config.CustomAction + 0, // 35: cuttlefish.cvd.config.Vm.page_size:type_name -> cuttlefish.cvd.config.UserPageSize + 31, // 36: cuttlefish.cvd.config.CustomAction.button:type_name -> cuttlefish.cvd.config.Button + 31, // 37: cuttlefish.cvd.config.CustomAction.buttons:type_name -> cuttlefish.cvd.config.Button + 32, // 38: cuttlefish.cvd.config.CustomAction.device_states:type_name -> cuttlefish.cvd.config.DeviceState + 39, // [39:39] is the sub-list for method output_type + 39, // [39:39] is the sub-list for method input_type + 39, // [39:39] is the sub-list for extension type_name + 39, // [39:39] is the sub-list for extension extendee + 0, // [0:39] is the sub-list for field type_name } func init() { file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_init() } @@ -2528,35 +2673,35 @@ func file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_init() { file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[8].OneofWrappers = []any{} file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[9].OneofWrappers = []any{} file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[10].OneofWrappers = []any{} - file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[11].OneofWrappers = []any{} - file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[12].OneofWrappers = []any{} file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[13].OneofWrappers = []any{} file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[14].OneofWrappers = []any{} file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[15].OneofWrappers = []any{} - file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[17].OneofWrappers = []any{ + file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[16].OneofWrappers = []any{} + file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[17].OneofWrappers = []any{} + file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[19].OneofWrappers = []any{ (*MediaDevice_V4L2EmulatedCameraSplane)(nil), (*MediaDevice_V4L2EmulatedCameraMplane)(nil), (*MediaDevice_V4L2Proxy)(nil), (*MediaDevice_V4L2StreamProxy)(nil), } - file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[20].OneofWrappers = []any{} - file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[22].OneofWrappers = []any{ + file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[22].OneofWrappers = []any{} + file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[24].OneofWrappers = []any{ (*Vm_Crosvm)(nil), (*Vm_Gem5)(nil), (*Vm_Qemu)(nil), } - file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[23].OneofWrappers = []any{} - file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[26].OneofWrappers = []any{} - file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[27].OneofWrappers = []any{} + file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[25].OneofWrappers = []any{} file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[28].OneofWrappers = []any{} file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[29].OneofWrappers = []any{} + file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[30].OneofWrappers = []any{} + file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_msgTypes[31].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDesc), len(file_cuttlefish_host_commands_cvd_cli_parser_load_config_proto_rawDesc)), NumEnums: 2, - NumMessages: 31, + NumMessages: 33, NumExtensions: 0, NumServices: 0, }, diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/BUILD.bazel index 0ada2bf3f1f..8fd5b95e0f4 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/BUILD.bazel @@ -46,9 +46,12 @@ cf_cc_library( srcs = ["cf_disk_configs.cpp"], hdrs = ["cf_disk_configs.h"], deps = [ + "//cuttlefish/common/libs/utils:base64", "//cuttlefish/host/commands/cvd/cli/parser:cf_configs_common", "//cuttlefish/host/commands/cvd/cli/parser:load_config_cc_proto", "//cuttlefish/host/libs/config:data_image_policy", + "//cuttlefish/result", + "@fmt", ], ) @@ -125,6 +128,7 @@ cf_cc_test( include_cleaner_enabled = False, deps = [ "//cuttlefish/host/commands/cvd/cli/parser:test_common", + "//cuttlefish/result", "//cuttlefish/result:assert", "//cuttlefish/result:result_matchers", ], diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/cf_disk_configs.cpp b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/cf_disk_configs.cpp index e755189aeda..b329d7ae711 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/cf_disk_configs.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/cf_disk_configs.cpp @@ -19,18 +19,30 @@ #include #include +#include "fmt/format.h" + +#include "cuttlefish/common/libs/utils/base64.h" #include "cuttlefish/host/commands/cvd/cli/parser/cf_configs_common.h" #include "cuttlefish/host/commands/cvd/cli/parser/load_config.pb.h" #include "cuttlefish/host/libs/config/data_image_policy.h" +#include "cuttlefish/result/result.h" #define DEFAULT_BLANK_DATA_IMAGE_SIZE "unset" namespace cuttlefish { namespace { +using cvd::config::DeviceTreeOverlayArtifact; using cvd::config::EnvironmentSpecification; +using cvd::config::FileBackedMapping; using cvd::config::Instance; +inline constexpr char kFlagCrosvmAcpiTable[] = "crosvm_acpi_table"; +inline constexpr char kFlagCrosvmDeviceTreeOverlay[] = + "crosvm_device_tree_overlay"; +inline constexpr char kFlagCrosvmFileBackedMappingBase64[] = + "crosvm_file_backed_mapping_base64"; + std::string VendorBootImageFlag(const Instance& instance) { const std::string& vendor_boot = instance.disk().disk_artifacts().vendor_boot(); @@ -40,9 +52,56 @@ std::string VendorBootImageFlag(const Instance& instance) { return ""; } +Result CrosvmAcpiTable(const Instance& instance) { + if (!instance.disk().disk_artifacts().has_acpi_table()) { + return ""; + } + const std::string& acpi_table = instance.disk().disk_artifacts().acpi_table(); + CF_EXPECT(!acpi_table.empty(), + "`disk_artifacts.acpi_table` must not be empty"); + return acpi_table; +} + +Result CrosvmDeviceTreeOverlay(const Instance& instance) { + if (!instance.disk().disk_artifacts().has_device_tree_overlay()) { + return ""; + } + const DeviceTreeOverlayArtifact& overlay = + instance.disk().disk_artifacts().device_tree_overlay(); + CF_EXPECT(!overlay.build().empty(), + "`disk_artifacts.device_tree_overlay.build` must not be empty"); + return overlay.build(); +} + +// Base64-encode before GenerateVecFlag joins the per-instance values with +// commas: a file-backed mapping natively contains commas and would otherwise +// be split across instances by assemble_cvd. +Result CrosvmFileBackedMappingBase64(const Instance& instance) { + if (!instance.disk().disk_artifacts().has_file_backed_mapping()) { + return CF_EXPECT(EncodeBase64("")); + } + const FileBackedMapping& mapping = + instance.disk().disk_artifacts().file_backed_mapping(); + CF_EXPECT(!mapping.build().empty(), + "`disk_artifacts.file_backed_mapping.build` must not be empty"); + CF_EXPECT(mapping.build().find(',') == std::string::npos, + "`disk_artifacts.file_backed_mapping.build` must not contain ','"); + CF_EXPECT(!mapping.addr().empty(), + "`disk_artifacts.file_backed_mapping.addr` must not be empty"); + CF_EXPECT(mapping.addr().find(',') == std::string::npos, + "`disk_artifacts.file_backed_mapping.addr` must not contain ','"); + CF_EXPECT(!mapping.size().empty(), + "`disk_artifacts.file_backed_mapping.size` must not be empty"); + CF_EXPECT(mapping.size().find(',') == std::string::npos, + "`disk_artifacts.file_backed_mapping.size` must not contain ','"); + return CF_EXPECT( + EncodeBase64(fmt::format("path={},addr={},size={}", mapping.build(), + mapping.addr(), mapping.size()))); +} + } // namespace -std::vector GenerateDiskFlags( +Result> GenerateDiskFlags( const EnvironmentSpecification& config) { std::vector flags; if (std::any_of(config.instances().cbegin(), config.instances().cend(), @@ -73,6 +132,30 @@ std::vector GenerateDiskFlags( flags.emplace_back( GenerateInstanceFlag("vendor_boot_image", config, VendorBootImageFlag)); } + if (std::any_of(config.instances().cbegin(), config.instances().cend(), + [](const Instance& instance) { + return instance.disk().disk_artifacts().has_acpi_table(); + })) { + flags.emplace_back(CF_EXPECT( + ResultInstanceFlag(kFlagCrosvmAcpiTable, config, CrosvmAcpiTable))); + } + if (std::any_of( + config.instances().cbegin(), config.instances().cend(), + [](const Instance& instance) { + return instance.disk().disk_artifacts().has_device_tree_overlay(); + })) { + flags.emplace_back(CF_EXPECT(ResultInstanceFlag( + kFlagCrosvmDeviceTreeOverlay, config, CrosvmDeviceTreeOverlay))); + } + if (std::any_of( + config.instances().cbegin(), config.instances().cend(), + [](const Instance& instance) { + return instance.disk().disk_artifacts().has_file_backed_mapping(); + })) { + flags.emplace_back( + CF_EXPECT(ResultInstanceFlag(kFlagCrosvmFileBackedMappingBase64, config, + CrosvmFileBackedMappingBase64))); + } return flags; } diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/cf_disk_configs.h b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/cf_disk_configs.h index ef904c79097..a067820b573 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/cf_disk_configs.h +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/cf_disk_configs.h @@ -20,10 +20,11 @@ #include #include "cuttlefish/host/commands/cvd/cli/parser/load_config.pb.h" +#include "cuttlefish/result/result.h" namespace cuttlefish { -std::vector GenerateDiskFlags( +Result> GenerateDiskFlags( const cvd::config::EnvironmentSpecification&); }; // namespace cuttlefish diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/disk_configs_test.cc b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/disk_configs_test.cc index 69c6138cc85..49acec254a1 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/disk_configs_test.cc +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/instance/disk_configs_test.cc @@ -21,6 +21,7 @@ #include "cuttlefish/host/commands/cvd/cli/parser/test_common.h" #include "cuttlefish/result/assert.h" +#include "cuttlefish/result/result.h" #include "cuttlefish/result/result_matchers.h" namespace cuttlefish { @@ -238,4 +239,598 @@ TEST(BootFlagsParserTest, VendorBootLocalOverrideMultiInstanceFull) { "vendor_boot.img")); } +TEST(BootFlagsParserTest, ParseTwoInstancesCrosvmAcpiTableFlagFullJson) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "acpi_table": "product/etc/opendice_a.aml" + } + } + }, + { + "disk": { + "disk_artifacts": { + "acpi_table": "product/etc/opendice_b.aml" + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + const Result> serialized_data = + LaunchCvdParserTester(json_configs); + ASSERT_THAT(serialized_data, IsOk()); + EXPECT_TRUE(FindConfig( + *serialized_data, + R"(--crosvm_acpi_table=product/etc/opendice_a.aml,product/etc/opendice_b.aml)")) + << "crosvm_acpi_table flag is missing or wrongly formatted"; +} + +TEST(BootFlagsParserTest, ParseTwoInstancesCrosvmAcpiTableFlagPartialJson) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + } + } + }, + { + "disk": { + "disk_artifacts": { + "acpi_table": "product/etc/opendice_b.aml" + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + const Result> serialized_data = + LaunchCvdParserTester(json_configs); + ASSERT_THAT(serialized_data, IsOk()); + EXPECT_TRUE(FindConfig(*serialized_data, + R"(--crosvm_acpi_table=,product/etc/opendice_b.aml)")) + << "crosvm_acpi_table flag is missing or wrongly formatted"; +} + +TEST(BootFlagsParserTest, ParseOneInstanceCrosvmAcpiTableAbsolutePath) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "acpi_table": "/abs/opendice.aml" + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + const Result> serialized_data = + LaunchCvdParserTester(json_configs); + ASSERT_THAT(serialized_data, IsOk()); + // An already-absolute value must reach assemble_cvd byte-identical. + EXPECT_TRUE( + FindConfig(*serialized_data, R"(--crosvm_acpi_table=/abs/opendice.aml)")) + << "crosvm_acpi_table flag is missing or wrongly formatted"; +} + +TEST(BootFlagsParserTest, + ParseTwoInstancesCrosvmDeviceTreeOverlayFlagFullJson) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "device_tree_overlay": { + "build": "product/etc/a.dtbo" + } + } + } + }, + { + "disk": { + "disk_artifacts": { + "device_tree_overlay": { + "build": "product/etc/b.dtbo" + } + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + const Result> serialized_data = + LaunchCvdParserTester(json_configs); + ASSERT_THAT(serialized_data, IsOk()); + EXPECT_TRUE(FindConfig( + *serialized_data, + R"(--crosvm_device_tree_overlay=product/etc/a.dtbo,product/etc/b.dtbo)")) + << "crosvm_device_tree_overlay flag is missing or wrongly formatted"; +} + +TEST(BootFlagsParserTest, + ParseTwoInstancesCrosvmDeviceTreeOverlayFlagPartialJson) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + } + } + }, + { + "disk": { + "disk_artifacts": { + "device_tree_overlay": { + "build": "product/etc/b.dtbo" + } + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + const Result> serialized_data = + LaunchCvdParserTester(json_configs); + ASSERT_THAT(serialized_data, IsOk()); + EXPECT_TRUE(FindConfig(*serialized_data, + R"(--crosvm_device_tree_overlay=,product/etc/b.dtbo)")) + << "crosvm_device_tree_overlay flag is missing or wrongly formatted"; +} + +TEST(BootFlagsParserTest, ParseOneInstanceCrosvmFileBackedMappingBase64) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "file_backed_mapping": { + "build": "dice_handover_instance1", + "addr": "0x9D1C3000", + "size": "0x10000" + } + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + const Result> serialized_data = + LaunchCvdParserTester(json_configs); + ASSERT_THAT(serialized_data, IsOk()); + + // base64("path=dice_handover_instance1,addr=0x9D1C3000,size=0x10000") => + // cGF0aD1kaWNlX2hhbmRvdmVyX2luc3RhbmNlMSxhZGRyPTB4OUQxQzMwMDAsc2l6ZT0weDEwMDAw + EXPECT_TRUE(FindConfig( + *serialized_data, + R"(--crosvm_file_backed_mapping_base64=cGF0aD1kaWNlX2hhbmRvdmVyX2luc3RhbmNlMSxhZGRyPTB4OUQxQzMwMDAsc2l6ZT0weDEwMDAw)")) + << "file_backed_mapping flag is missing or wrongly formatted"; +} + +TEST(BootFlagsParserTest, ParseTwoInstancesCrosvmFileBackedMappingBase64) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "file_backed_mapping": { + "build": "dice_handover_instance1", + "addr": "0x9D1C3000", + "size": "0x10000" + } + } + } + }, + { + "disk": { + "disk_artifacts": { + "file_backed_mapping": { + "build": "dice_handover_instance2", + "addr": "0x9D1D3000", + "size": "0x20000" + } + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + const Result> serialized_data = + LaunchCvdParserTester(json_configs); + ASSERT_THAT(serialized_data, IsOk()); + + // base64("path=dice_handover_instance1,addr=0x9D1C3000,size=0x10000") => + // cGF0aD1kaWNlX2hhbmRvdmVyX2luc3RhbmNlMSxhZGRyPTB4OUQxQzMwMDAsc2l6ZT0weDEwMDAw + // base64("path=dice_handover_instance2,addr=0x9D1D3000,size=0x20000") => + // cGF0aD1kaWNlX2hhbmRvdmVyX2luc3RhbmNlMixhZGRyPTB4OUQxRDMwMDAsc2l6ZT0weDIwMDAw + EXPECT_TRUE(FindConfig( + *serialized_data, + R"(--crosvm_file_backed_mapping_base64=)" + R"(cGF0aD1kaWNlX2hhbmRvdmVyX2luc3RhbmNlMSxhZGRyPTB4OUQxQzMwMDAsc2l6ZT0weDEwMDAw,)" + R"(cGF0aD1kaWNlX2hhbmRvdmVyX2luc3RhbmNlMixhZGRyPTB4OUQxRDMwMDAsc2l6ZT0weDIwMDAw)")) + << "file_backed_mapping flag is missing or wrongly formatted"; +} + +TEST(BootFlagsParserTest, + ParseTwoInstancesCrosvmFileBackedMappingPartialJsonBase64) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + } + } + }, + { + "disk": { + "disk_artifacts": { + "file_backed_mapping": { + "build": "dice_handover_instance2", + "addr": "0x9D1D3000", + "size": "0x20000" + } + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + const Result> serialized_data = + LaunchCvdParserTester(json_configs); + ASSERT_THAT(serialized_data, IsOk()); + + // base64("path=dice_handover_instance2,addr=0x9D1D3000,size=0x20000") => + // cGF0aD1kaWNlX2hhbmRvdmVyX2luc3RhbmNlMixhZGRyPTB4OUQxRDMwMDAsc2l6ZT0weDIwMDAw + EXPECT_TRUE(FindConfig( + *serialized_data, + R"(--crosvm_file_backed_mapping_base64=,)" + R"(cGF0aD1kaWNlX2hhbmRvdmVyX2luc3RhbmNlMixhZGRyPTB4OUQxRDMwMDAsc2l6ZT0weDIwMDAw)")) + << "file_backed_mapping flag is missing or wrongly formatted"; +} + +TEST(BootFlagsParserTest, RejectsEmptyCrosvmAcpiTable) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "acpi_table": "" + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + EXPECT_THAT(LaunchCvdParserTester(json_configs), IsError()); +} + +TEST(BootFlagsParserTest, RejectsEmptyCrosvmDeviceTreeOverlayBuild) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "device_tree_overlay": { + } + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + EXPECT_THAT(LaunchCvdParserTester(json_configs), IsError()); +} + +TEST(BootFlagsParserTest, RejectsEmptyStringCrosvmDeviceTreeOverlayBuild) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "device_tree_overlay": { + "build": "" + } + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + EXPECT_THAT(LaunchCvdParserTester(json_configs), IsError()); +} + +TEST(BootFlagsParserTest, ParseOneInstanceCrosvmDeviceTreeOverlayFlag) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "device_tree_overlay": { + "build": "product/etc/my_overlay.dtbo" + } + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + const Result> serialized_data = + LaunchCvdParserTester(json_configs); + ASSERT_THAT(serialized_data, IsOk()); + EXPECT_TRUE( + FindConfig(*serialized_data, + R"(--crosvm_device_tree_overlay=product/etc/my_overlay.dtbo)")) + << "crosvm_device_tree_overlay flag is missing or wrongly formatted"; +} + +TEST(BootFlagsParserTest, RejectsEmptyCrosvmFileBackedMappingBuild) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "file_backed_mapping": { + "addr": "0x9D1C3000", + "size": "0x10000" + } + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + EXPECT_THAT(LaunchCvdParserTester(json_configs), IsError()); +} + +TEST(BootFlagsParserTest, RejectsEmptyStringCrosvmFileBackedMappingBuild) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "file_backed_mapping": { + "build": "", + "addr": "0x9D1C3000", + "size": "0x10000" + } + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + EXPECT_THAT(LaunchCvdParserTester(json_configs), IsError()); +} + +TEST(BootFlagsParserTest, RejectsEmptyCrosvmFileBackedMappingAddr) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "file_backed_mapping": { + "build": "a", + "size": "0x10000" + } + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + EXPECT_THAT(LaunchCvdParserTester(json_configs), IsError()); +} + +TEST(BootFlagsParserTest, RejectsEmptyCrosvmFileBackedMappingSize) { + const char* test_string = R""""( +{ + "instances" : + [ + { + "disk": { + "disk_artifacts": { + "file_backed_mapping": { + "build": "a", + "addr": "0x9D1C3000" + } + } + } + } + ] +} + )""""; + + Json::Value json_configs; + std::string json_text(test_string); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + EXPECT_THAT(LaunchCvdParserTester(json_configs), IsError()); +} + +class BootFlagsParserInvalidFileBackedMappingTest + : public ::testing::TestWithParam {}; + +TEST_P(BootFlagsParserInvalidFileBackedMappingTest, + RejectsCommaInCrosvmFileBackedMappingFields) { + Json::Value json_configs; + std::string json_text = GetParam(); + + EXPECT_TRUE(ParseJsonString(json_text, json_configs)) + << "Invalid Json string"; + EXPECT_THAT(LaunchCvdParserTester(json_configs), IsError()); +} + +INSTANTIATE_TEST_SUITE_P(BootFlagsParserTest, + BootFlagsParserInvalidFileBackedMappingTest, + ::testing::Values( + R""""( +{ + "instances": [{ + "disk": { + "disk_artifacts": { + "file_backed_mapping": { + "build": "a,b", + "addr": "0x9D1C3000", + "size": "0x10000" + } + } + } + }] +} + )"""", + R""""( +{ + "instances": [{ + "disk": { + "disk_artifacts": { + "file_backed_mapping": { + "build": "a", + "addr": "0x9D1C3000,rw", + "size": "0x10000" + } + } + } + }] +} + )"""", + R""""( +{ + "instances": [{ + "disk": { + "disk_artifacts": { + "file_backed_mapping": { + "build": "a", + "addr": "0x9D1C3000", + "size": "0x10000,rw" + } + } + } + }] +} + )"""")); + } // namespace cuttlefish diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/load_config.proto b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/load_config.proto index a769397cdad..119ec9163fe 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/parser/load_config.proto +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/parser/load_config.proto @@ -136,8 +136,29 @@ message Display { repeated DisplayOverlay overlays = 5; } +message DeviceTreeOverlayArtifact { + // The path of the dtb, can be a file in default_build. + string build = 1; + // TODO: Support filter and select_symbols options. +} + +message FileBackedMapping { + // The path of the backed file, can be a file in default_build, or a remote + // build path, e.g. `@ab//{}`. + string build = 1; + // Hexadecimal number with 0x prefix, the base address of the mapping. + string addr = 2; + // Hexadecimal number with 0x prefix, the size of the mapping. + string size = 3; + // TODO: Support offset, rw, sync, align, and ram options. +} + message DiskArtifacts { optional string vendor_boot = 1; + // The path of the ACPI file, can be a file in default_build. + optional string acpi_table = 2; + optional DeviceTreeOverlayArtifact device_tree_overlay = 3; + optional FileBackedMapping file_backed_mapping = 4; } message Disk {