mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 1 | // Copyright (C) 2024 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package filesystem |
| 16 | |
| 17 | import ( |
| 18 | "fmt" |
| 19 | "path/filepath" |
Cole Faust | 498ffc1 | 2025-01-15 14:19:32 -0800 | [diff] [blame] | 20 | "regexp" |
Cole Faust | 74ee4e0 | 2025-01-16 14:55:35 -0800 | [diff] [blame^] | 21 | "slices" |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 22 | "strconv" |
| 23 | "strings" |
| 24 | |
| 25 | "android/soong/android" |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 26 | |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 27 | "github.com/google/blueprint" |
| 28 | "github.com/google/blueprint/proptools" |
| 29 | ) |
| 30 | |
| 31 | func init() { |
| 32 | android.RegisterModuleType("super_image", SuperImageFactory) |
| 33 | } |
| 34 | |
| 35 | type superImage struct { |
| 36 | android.ModuleBase |
| 37 | |
| 38 | properties SuperImageProperties |
| 39 | partitionProps SuperImagePartitionNameProperties |
| 40 | |
| 41 | installDir android.InstallPath |
| 42 | } |
| 43 | |
| 44 | type SuperImageProperties struct { |
| 45 | // the size of the super partition |
| 46 | Size *int64 |
| 47 | // the block device where metadata for dynamic partitions is stored |
| 48 | Metadata_device *string |
| 49 | // the super partition block device list |
mrziwang | f3c8ddf | 2024-12-05 17:15:11 -0800 | [diff] [blame] | 50 | Block_devices []string |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 51 | // whether A/B updater is used |
| 52 | Ab_update *bool |
| 53 | // whether dynamic partitions is enabled on devices that were launched without this support |
| 54 | Retrofit *bool |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 55 | // whether the output is a sparse image |
| 56 | Sparse *bool |
| 57 | // information about how partitions within the super partition are grouped together |
| 58 | Partition_groups []PartitionGroupsInfo |
Cole Faust | 74ee4e0 | 2025-01-16 14:55:35 -0800 | [diff] [blame^] | 59 | // Name of the system_other partition filesystem module. This module will be installed to |
| 60 | // the "b" slot of the system partition in a/b partition builds. |
| 61 | System_other_partition *string |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 62 | // whether dynamic partitions is used |
| 63 | Use_dynamic_partitions *bool |
Cole Faust | 498ffc1 | 2025-01-15 14:19:32 -0800 | [diff] [blame] | 64 | Virtual_ab struct { |
| 65 | // whether virtual A/B seamless update is enabled |
| 66 | Enable *bool |
| 67 | // whether retrofitting virtual A/B seamless update is enabled |
| 68 | Retrofit *bool |
| 69 | // If set, device uses virtual A/B Compression |
| 70 | Compression *bool |
| 71 | // This value controls the compression algorithm used for VABC. |
| 72 | // Valid options are defined in system/core/fs_mgr/libsnapshot/cow_writer.cpp |
| 73 | // e.g. "none", "gz", "brotli" |
| 74 | Compression_method *string |
| 75 | // Specifies maximum bytes to be compressed at once during ota. Options: 4096, 8192, 16384, 32768, 65536, 131072, 262144. |
| 76 | Compression_factor *int64 |
| 77 | // Specifies COW version to be used by update_engine and libsnapshot. If this value is not |
| 78 | // specified we default to COW version 2 in update_engine for backwards compatibility |
| 79 | Cow_version *int64 |
| 80 | } |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | type PartitionGroupsInfo struct { |
| 84 | Name string |
| 85 | GroupSize string |
| 86 | PartitionList []string |
| 87 | } |
| 88 | |
| 89 | type SuperImagePartitionNameProperties struct { |
| 90 | // Name of the System partition filesystem module |
| 91 | System_partition *string |
| 92 | // Name of the System_ext partition filesystem module |
| 93 | System_ext_partition *string |
| 94 | // Name of the System_dlkm partition filesystem module |
| 95 | System_dlkm_partition *string |
| 96 | // Name of the System_other partition filesystem module |
| 97 | System_other_partition *string |
| 98 | // Name of the Product partition filesystem module |
| 99 | Product_partition *string |
| 100 | // Name of the Vendor partition filesystem module |
| 101 | Vendor_partition *string |
| 102 | // Name of the Vendor_dlkm partition filesystem module |
| 103 | Vendor_dlkm_partition *string |
| 104 | // Name of the Odm partition filesystem module |
| 105 | Odm_partition *string |
| 106 | // Name of the Odm_dlkm partition filesystem module |
| 107 | Odm_dlkm_partition *string |
| 108 | } |
| 109 | |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 110 | type SuperImageInfo struct { |
| 111 | // The built super.img file, which contains the sub-partitions |
| 112 | SuperImage android.Path |
| 113 | |
| 114 | // Mapping from the sub-partition type to its re-exported FileSystemInfo providers from the |
| 115 | // sub-partitions. |
| 116 | SubImageInfo map[string]FilesystemInfo |
| 117 | } |
| 118 | |
| 119 | var SuperImageProvider = blueprint.NewProvider[SuperImageInfo]() |
| 120 | |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 121 | func SuperImageFactory() android.Module { |
| 122 | module := &superImage{} |
| 123 | module.AddProperties(&module.properties, &module.partitionProps) |
| 124 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 125 | return module |
| 126 | } |
| 127 | |
| 128 | type superImageDepTagType struct { |
| 129 | blueprint.BaseDependencyTag |
| 130 | } |
| 131 | |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 132 | var subImageDepTag superImageDepTagType |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 133 | |
Cole Faust | 74ee4e0 | 2025-01-16 14:55:35 -0800 | [diff] [blame^] | 134 | type systemOtherDepTagType struct { |
| 135 | blueprint.BaseDependencyTag |
| 136 | } |
| 137 | |
| 138 | var systemOtherDepTag systemOtherDepTagType |
| 139 | |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 140 | func (s *superImage) DepsMutator(ctx android.BottomUpMutatorContext) { |
| 141 | addDependencyIfDefined := func(dep *string) { |
| 142 | if dep != nil { |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 143 | ctx.AddDependency(ctx.Module(), subImageDepTag, proptools.String(dep)) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 144 | } |
| 145 | } |
| 146 | |
| 147 | addDependencyIfDefined(s.partitionProps.System_partition) |
| 148 | addDependencyIfDefined(s.partitionProps.System_ext_partition) |
| 149 | addDependencyIfDefined(s.partitionProps.System_dlkm_partition) |
| 150 | addDependencyIfDefined(s.partitionProps.System_other_partition) |
| 151 | addDependencyIfDefined(s.partitionProps.Product_partition) |
| 152 | addDependencyIfDefined(s.partitionProps.Vendor_partition) |
| 153 | addDependencyIfDefined(s.partitionProps.Vendor_dlkm_partition) |
| 154 | addDependencyIfDefined(s.partitionProps.Odm_partition) |
| 155 | addDependencyIfDefined(s.partitionProps.Odm_dlkm_partition) |
Cole Faust | 74ee4e0 | 2025-01-16 14:55:35 -0800 | [diff] [blame^] | 156 | if s.properties.System_other_partition != nil { |
| 157 | ctx.AddDependency(ctx.Module(), systemOtherDepTag, *s.properties.System_other_partition) |
| 158 | } |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | func (s *superImage) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 162 | miscInfo, deps, subImageInfos := s.buildMiscInfo(ctx) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 163 | builder := android.NewRuleBuilder(pctx, ctx) |
| 164 | output := android.PathForModuleOut(ctx, s.installFileName()) |
| 165 | lpMake := ctx.Config().HostToolPath(ctx, "lpmake") |
| 166 | lpMakeDir := filepath.Dir(lpMake.String()) |
| 167 | deps = append(deps, lpMake) |
| 168 | builder.Command().Textf("PATH=%s:\\$PATH", lpMakeDir). |
| 169 | BuiltTool("build_super_image"). |
| 170 | Text("-v"). |
| 171 | Input(miscInfo). |
| 172 | Implicits(deps). |
| 173 | Output(output) |
| 174 | builder.Build("build_super_image", fmt.Sprintf("Creating super image %s", s.BaseModuleName())) |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 175 | android.SetProvider(ctx, SuperImageProvider, SuperImageInfo{ |
| 176 | SuperImage: output, |
| 177 | SubImageInfo: subImageInfos, |
| 178 | }) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 179 | ctx.SetOutputFiles([]android.Path{output}, "") |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 180 | ctx.CheckbuildFile(output) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | func (s *superImage) installFileName() string { |
| 184 | return s.BaseModuleName() + ".img" |
| 185 | } |
| 186 | |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 187 | func (s *superImage) buildMiscInfo(ctx android.ModuleContext) (android.Path, android.Paths, map[string]FilesystemInfo) { |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 188 | var miscInfoString strings.Builder |
| 189 | addStr := func(name string, value string) { |
| 190 | miscInfoString.WriteString(name) |
| 191 | miscInfoString.WriteRune('=') |
| 192 | miscInfoString.WriteString(value) |
| 193 | miscInfoString.WriteRune('\n') |
| 194 | } |
| 195 | |
Cole Faust | 498ffc1 | 2025-01-15 14:19:32 -0800 | [diff] [blame] | 196 | addStr("build_super_partition", "true") |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 197 | addStr("use_dynamic_partitions", strconv.FormatBool(proptools.Bool(s.properties.Use_dynamic_partitions))) |
Cole Faust | 498ffc1 | 2025-01-15 14:19:32 -0800 | [diff] [blame] | 198 | if proptools.Bool(s.properties.Retrofit) { |
| 199 | addStr("dynamic_partition_retrofit", "true") |
| 200 | } |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 201 | addStr("lpmake", "lpmake") |
| 202 | addStr("super_metadata_device", proptools.String(s.properties.Metadata_device)) |
mrziwang | f3c8ddf | 2024-12-05 17:15:11 -0800 | [diff] [blame] | 203 | if len(s.properties.Block_devices) > 0 { |
| 204 | addStr("super_block_devices", strings.Join(s.properties.Block_devices, " ")) |
| 205 | } |
Cole Faust | 498ffc1 | 2025-01-15 14:19:32 -0800 | [diff] [blame] | 206 | addStr("super_partition_size", strconv.Itoa(proptools.Int(s.properties.Size))) |
| 207 | // TODO: In make, there's more complicated logic than just this surrounding super_*_device_size |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 208 | addStr("super_super_device_size", strconv.Itoa(proptools.Int(s.properties.Size))) |
| 209 | var groups, partitionList []string |
| 210 | for _, groupInfo := range s.properties.Partition_groups { |
| 211 | groups = append(groups, groupInfo.Name) |
| 212 | partitionList = append(partitionList, groupInfo.PartitionList...) |
| 213 | addStr("super_"+groupInfo.Name+"_group_size", groupInfo.GroupSize) |
| 214 | addStr("super_"+groupInfo.Name+"_partition_list", strings.Join(groupInfo.PartitionList, " ")) |
| 215 | } |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 216 | initialPartitionListLen := len(partitionList) |
| 217 | partitionList = android.SortedUniqueStrings(partitionList) |
| 218 | if len(partitionList) != initialPartitionListLen { |
| 219 | ctx.ModuleErrorf("Duplicate partitions found in the partition_groups property") |
| 220 | } |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 221 | addStr("super_partition_groups", strings.Join(groups, " ")) |
| 222 | addStr("dynamic_partition_list", strings.Join(partitionList, " ")) |
| 223 | |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 224 | addStr("ab_update", strconv.FormatBool(proptools.Bool(s.properties.Ab_update))) |
Cole Faust | 498ffc1 | 2025-01-15 14:19:32 -0800 | [diff] [blame] | 225 | |
| 226 | if proptools.Bool(s.properties.Virtual_ab.Enable) { |
| 227 | addStr("virtual_ab", "true") |
| 228 | if proptools.Bool(s.properties.Virtual_ab.Retrofit) { |
| 229 | addStr("virtual_ab_retrofit", "true") |
| 230 | } |
| 231 | addStr("virtual_ab_compression", strconv.FormatBool(proptools.Bool(s.properties.Virtual_ab.Compression))) |
| 232 | if s.properties.Virtual_ab.Compression_method != nil { |
| 233 | matched, _ := regexp.MatchString("^[a-zA-Z0-9_-]+$", *s.properties.Virtual_ab.Compression_method) |
| 234 | if !matched { |
| 235 | ctx.PropertyErrorf("virtual_ab.compression_method", "compression_method cannot have special characters") |
| 236 | } |
| 237 | addStr("virtual_ab_compression_method", *s.properties.Virtual_ab.Compression_method) |
| 238 | } |
| 239 | if s.properties.Virtual_ab.Compression_factor != nil { |
| 240 | addStr("virtual_ab_compression_factor", strconv.FormatInt(*s.properties.Virtual_ab.Compression_factor, 10)) |
| 241 | } |
| 242 | if s.properties.Virtual_ab.Cow_version != nil { |
| 243 | addStr("virtual_ab_cow_version", strconv.FormatInt(*s.properties.Virtual_ab.Cow_version, 10)) |
| 244 | } |
| 245 | |
| 246 | } else { |
| 247 | if s.properties.Virtual_ab.Retrofit != nil { |
Cole Faust | 29e333d | 2025-01-15 16:53:44 -0800 | [diff] [blame] | 248 | ctx.PropertyErrorf("virtual_ab.retrofit", "This property cannot be set when virtual_ab is disabled") |
Cole Faust | 498ffc1 | 2025-01-15 14:19:32 -0800 | [diff] [blame] | 249 | } |
| 250 | if s.properties.Virtual_ab.Compression != nil { |
| 251 | ctx.PropertyErrorf("virtual_ab.compression", "This property cannot be set when virtual_ab is disabled") |
| 252 | } |
| 253 | if s.properties.Virtual_ab.Compression_method != nil { |
| 254 | ctx.PropertyErrorf("virtual_ab.compression_method", "This property cannot be set when virtual_ab is disabled") |
| 255 | } |
| 256 | if s.properties.Virtual_ab.Compression_factor != nil { |
| 257 | ctx.PropertyErrorf("virtual_ab.compression_factor", "This property cannot be set when virtual_ab is disabled") |
| 258 | } |
| 259 | } |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 260 | |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 261 | subImageInfo := make(map[string]FilesystemInfo) |
| 262 | var deps android.Paths |
| 263 | |
| 264 | missingPartitionErrorMessage := "" |
| 265 | handleSubPartition := func(partitionType string, name *string) { |
| 266 | if proptools.String(name) == "" { |
| 267 | missingPartitionErrorMessage += fmt.Sprintf("%s image listed in partition groups, but its module was not specified. ", partitionType) |
| 268 | return |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 269 | } |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 270 | mod := ctx.GetDirectDepWithTag(*name, subImageDepTag) |
| 271 | if mod == nil { |
| 272 | ctx.ModuleErrorf("Could not get dep %q", *name) |
| 273 | return |
| 274 | } |
| 275 | info, ok := android.OtherModuleProvider(ctx, mod, FilesystemProvider) |
| 276 | if !ok { |
| 277 | ctx.ModuleErrorf("Expected dep %q to provide FilesystemInfo", *name) |
| 278 | return |
| 279 | } |
| 280 | addStr(partitionType+"_image", info.Output.String()) |
| 281 | deps = append(deps, info.Output) |
| 282 | if _, ok := subImageInfo[partitionType]; ok { |
| 283 | ctx.ModuleErrorf("Already set subimageInfo for %q", partitionType) |
| 284 | } |
| 285 | subImageInfo[partitionType] = info |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | // Build partitionToImagePath, because system partition may need system_other |
| 289 | // partition image path |
| 290 | for _, p := range partitionList { |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 291 | switch p { |
| 292 | case "system": |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 293 | handleSubPartition("system", s.partitionProps.System_partition) |
| 294 | // TODO: add system_other to deps after it can be generated |
| 295 | //getFsInfo("system_other", s.partitionProps.System_other_partition, &subImageInfo.System_other) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 296 | case "system_dlkm": |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 297 | handleSubPartition("system_dlkm", s.partitionProps.System_dlkm_partition) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 298 | case "system_ext": |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 299 | handleSubPartition("system_ext", s.partitionProps.System_ext_partition) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 300 | case "product": |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 301 | handleSubPartition("product", s.partitionProps.Product_partition) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 302 | case "vendor": |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 303 | handleSubPartition("vendor", s.partitionProps.Vendor_partition) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 304 | case "vendor_dlkm": |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 305 | handleSubPartition("vendor_dlkm", s.partitionProps.Vendor_dlkm_partition) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 306 | case "odm": |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 307 | handleSubPartition("odm", s.partitionProps.Odm_partition) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 308 | case "odm_dlkm": |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 309 | handleSubPartition("odm_dlkm", s.partitionProps.Odm_dlkm_partition) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 310 | default: |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 311 | ctx.ModuleErrorf("partition %q is not a super image supported partition", p) |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 312 | } |
| 313 | } |
| 314 | |
Cole Faust | 74ee4e0 | 2025-01-16 14:55:35 -0800 | [diff] [blame^] | 315 | if s.properties.System_other_partition != nil { |
| 316 | if !slices.Contains(partitionList, "system") { |
| 317 | ctx.PropertyErrorf("system_other_partition", "Must have a system partition to use a system_other partition") |
| 318 | } |
| 319 | systemOther := ctx.GetDirectDepProxyWithTag(*s.properties.System_other_partition, systemOtherDepTag) |
| 320 | systemOtherFiles := android.OutputFilesForModule(ctx, systemOther, "") |
| 321 | if len(systemOtherFiles) != 1 { |
| 322 | ctx.PropertyErrorf("system_other_partition", "Expected 1 output file from module %q", *&s.properties.System_other_partition) |
| 323 | } else { |
| 324 | addStr("system_other_image", systemOtherFiles[0].String()) |
| 325 | deps = append(deps, systemOtherFiles[0]) |
| 326 | } |
| 327 | } |
| 328 | |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 329 | // Delay the error message until execution time because on aosp-main-future-without-vendor, |
| 330 | // BUILDING_VENDOR_IMAGE is false so we don't get the vendor image, but it's still listed in |
| 331 | // BOARD_GOOGLE_DYNAMIC_PARTITIONS_PARTITION_LIST. |
| 332 | missingPartitionErrorMessageFile := android.PathForModuleOut(ctx, "missing_partition_error.txt") |
| 333 | if missingPartitionErrorMessage != "" { |
| 334 | ctx.Build(pctx, android.BuildParams{ |
| 335 | Rule: android.ErrorRule, |
| 336 | Output: missingPartitionErrorMessageFile, |
| 337 | Args: map[string]string{ |
| 338 | "error": missingPartitionErrorMessage, |
| 339 | }, |
| 340 | }) |
| 341 | } else { |
| 342 | ctx.Build(pctx, android.BuildParams{ |
| 343 | Rule: android.Touch, |
| 344 | Output: missingPartitionErrorMessageFile, |
| 345 | }) |
Naresh Kumar Podishetty (xWF) | 4173c5b | 2025-01-09 20:20:32 -0800 | [diff] [blame] | 346 | } |
| 347 | |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 348 | miscInfo := android.PathForModuleOut(ctx, "misc_info.txt") |
Cole Faust | 2bdc5e5 | 2025-01-10 10:29:36 -0800 | [diff] [blame] | 349 | android.WriteFileRule(ctx, miscInfo, miscInfoString.String(), missingPartitionErrorMessageFile) |
| 350 | return miscInfo, deps, subImageInfo |
mrziwang | 79730d4 | 2024-12-02 22:13:59 -0800 | [diff] [blame] | 351 | } |