1// Copyright 2016 Google Inc. All rights reserved. 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 15package etc 16 17// This file implements module types that install prebuilt artifacts. 18// 19// There exist two classes of prebuilt modules in the Android tree. The first class are the ones 20// based on `android.Prebuilt`, such as `cc_prebuilt_library` and `java_import`. This kind of 21// modules may exist both as prebuilts and source at the same time, though only one would be 22// installed and the other would be marked disabled. The `prebuilt_postdeps` mutator would select 23// the actual modules to be installed. More details in android/prebuilt.go. 24// 25// The second class is described in this file. Unlike `android.Prebuilt` based module types, 26// `prebuilt_etc` exist only as prebuilts and cannot have a same-named source module counterpart. 27// This makes the logic of `prebuilt_etc` to be much simpler as they don't need to go through the 28// various `prebuilt_*` mutators. 29 30import ( 31 "fmt" 32 "path/filepath" 33 "strings" 34 35 "github.com/google/blueprint" 36 "github.com/google/blueprint/proptools" 37 38 "android/soong/android" 39) 40 41var pctx = android.NewPackageContext("android/soong/etc") 42 43// TODO(jungw): Now that it handles more than the ones in etc/, consider renaming this file. 44 45func init() { 46 pctx.Import("android/soong/android") 47 RegisterPrebuiltEtcBuildComponents(android.InitRegistrationContext) 48} 49 50func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) { 51 ctx.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory) 52 ctx.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory) 53 ctx.RegisterModuleType("prebuilt_etc_cacerts", PrebuiltEtcCaCertsFactory) 54 ctx.RegisterModuleType("prebuilt_avb", PrebuiltAvbFactory) 55 ctx.RegisterModuleType("prebuilt_root", PrebuiltRootFactory) 56 ctx.RegisterModuleType("prebuilt_root_host", PrebuiltRootHostFactory) 57 ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory) 58 ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory) 59 ctx.RegisterModuleType("prebuilt_usr_hyphendata", PrebuiltUserHyphenDataFactory) 60 ctx.RegisterModuleType("prebuilt_usr_keylayout", PrebuiltUserKeyLayoutFactory) 61 ctx.RegisterModuleType("prebuilt_usr_keychars", PrebuiltUserKeyCharsFactory) 62 ctx.RegisterModuleType("prebuilt_usr_idc", PrebuiltUserIdcFactory) 63 ctx.RegisterModuleType("prebuilt_usr_srec", PrebuiltUserSrecFactory) 64 ctx.RegisterModuleType("prebuilt_usr_odml", PrebuiltUserOdmlFactory) 65 ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory) 66 ctx.RegisterModuleType("prebuilt_overlay", PrebuiltOverlayFactory) 67 ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory) 68 ctx.RegisterModuleType("prebuilt_gpu", PrebuiltGPUFactory) 69 ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory) 70 ctx.RegisterModuleType("prebuilt_rfsa", PrebuiltRFSAFactory) 71 ctx.RegisterModuleType("prebuilt_renderscript_bitcode", PrebuiltRenderScriptBitcodeFactory) 72 ctx.RegisterModuleType("prebuilt_media", PrebuiltMediaFactory) 73 ctx.RegisterModuleType("prebuilt_voicepack", PrebuiltVoicepackFactory) 74 ctx.RegisterModuleType("prebuilt_bin", PrebuiltBinaryFactory) 75 ctx.RegisterModuleType("prebuilt_wallpaper", PrebuiltWallpaperFactory) 76 ctx.RegisterModuleType("prebuilt_priv_app", PrebuiltPrivAppFactory) 77 ctx.RegisterModuleType("prebuilt_radio", PrebuiltRadioFactory) 78 ctx.RegisterModuleType("prebuilt_rfs", PrebuiltRfsFactory) 79 ctx.RegisterModuleType("prebuilt_framework", PrebuiltFrameworkFactory) 80 ctx.RegisterModuleType("prebuilt_res", PrebuiltResFactory) 81 ctx.RegisterModuleType("prebuilt_tee", PrebuiltTeeFactory) 82 ctx.RegisterModuleType("prebuilt_wlc_upt", PrebuiltWlcUptFactory) 83 ctx.RegisterModuleType("prebuilt_odm", PrebuiltOdmFactory) 84 ctx.RegisterModuleType("prebuilt_vendor_dlkm", PrebuiltVendorDlkmFactory) 85 ctx.RegisterModuleType("prebuilt_vendor_overlay", PrebuiltVendorOverlayFactory) 86 ctx.RegisterModuleType("prebuilt_bt_firmware", PrebuiltBtFirmwareFactory) 87 ctx.RegisterModuleType("prebuilt_tvservice", PrebuiltTvServiceFactory) 88 ctx.RegisterModuleType("prebuilt_optee", PrebuiltOpteeFactory) 89 ctx.RegisterModuleType("prebuilt_tvconfig", PrebuiltTvConfigFactory) 90 ctx.RegisterModuleType("prebuilt_vendor", PrebuiltVendorFactory) 91 ctx.RegisterModuleType("prebuilt_sbin", PrebuiltSbinFactory) 92 ctx.RegisterModuleType("prebuilt_system", PrebuiltSystemFactory) 93 ctx.RegisterModuleType("prebuilt_first_stage_ramdisk", PrebuiltFirstStageRamdiskFactory) 94 ctx.RegisterModuleType("prebuilt_any", PrebuiltAnyFactory) 95 96 ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory) 97 98} 99 100type PrebuiltEtcInfo struct { 101 // Returns the base install directory, such as "etc", "usr/share". 102 BaseDir string 103 // Returns the sub install directory relative to BaseDir(). 104 SubDir string 105} 106 107var PrebuiltEtcInfoProvider = blueprint.NewProvider[PrebuiltEtcInfo]() 108 109var PrepareForTestWithPrebuiltEtc = android.FixtureRegisterWithContext(RegisterPrebuiltEtcBuildComponents) 110 111type PrebuiltEtcProperties struct { 112 // Source file of this prebuilt. Can reference a genrule type module with the ":module" syntax. 113 // Mutually exclusive with srcs. 114 Src proptools.Configurable[string] `android:"path,arch_variant,replace_instead_of_append"` 115 116 // Source files of this prebuilt. Can reference a genrule type module with the ":module" syntax. 117 // Mutually exclusive with src. When used, filename_from_src is set to true unless dsts is also 118 // set. May use globs in filenames. 119 Srcs proptools.Configurable[[]string] `android:"path,arch_variant"` 120 121 // Optional name for the installed file. If unspecified, name of the module is used as the file 122 // name. Only available when using a single source (src). 123 Filename *string `android:"arch_variant"` 124 125 // When set to true, and filename property is not set, the name for the installed file 126 // is the same as the file name of the source file. 127 Filename_from_src *bool `android:"arch_variant"` 128 129 // Make this module available when building for ramdisk. 130 // On device without a dedicated recovery partition, the module is only 131 // available after switching root into 132 // /first_stage_ramdisk. To expose the module before switching root, install 133 // the recovery variant instead. 134 Ramdisk_available *bool 135 136 // Make this module available when building for vendor ramdisk. 137 // On device without a dedicated recovery partition, the module is only 138 // available after switching root into 139 // /first_stage_ramdisk. To expose the module before switching root, install 140 // the recovery variant instead. 141 Vendor_ramdisk_available *bool 142 143 // Make this module available when building for debug ramdisk. 144 Debug_ramdisk_available *bool 145 146 // Make this module available when building for recovery. 147 Recovery_available *bool 148 149 // Whether this module is directly installable to one of the partitions. Default: true. 150 Installable *bool 151 152 // Install symlinks to the installed file. 153 Symlinks []string `android:"arch_variant"` 154 155 // Install to partition oem when set to true. 156 Oem_specific *bool `android:"arch_variant"` 157} 158 159// Dsts is useful in that it allows prebuilt_* modules to easily map the source files to the 160// install path within the partition. Dsts values are allowed to contain filepath separator 161// so that the source files can be installed in subdirectories within the partition. 162// However, this functionality should not be supported for prebuilt_root module type, as it 163// allows the module to install to any arbitrary location. Thus, this property is defined in 164// a separate struct so that it's not available to be set in prebuilt_root module type. 165type PrebuiltDstsProperties struct { 166 // Destination files of this prebuilt. Requires srcs to be used and causes srcs not to implicitly 167 // set filename_from_src. This can be used to install each source file to a different directory 168 // and/or change filenames when files are installed. Must be exactly one entry per source file, 169 // which means care must be taken if srcs has globs. 170 Dsts proptools.Configurable[[]string] `android:"path,arch_variant"` 171} 172 173type prebuiltSubdirProperties struct { 174 // Optional subdirectory under which this file is installed into, cannot be specified with 175 // relative_install_path, prefer relative_install_path. 176 Sub_dir *string `android:"arch_variant"` 177 178 // Optional subdirectory under which this file is installed into, cannot be specified with 179 // sub_dir. 180 Relative_install_path *string `android:"arch_variant"` 181} 182 183type prebuiltRootProperties struct { 184 // Install this module to the root directory, without partition subdirs. When this module is 185 // added to PRODUCT_PACKAGES, this module will be installed to $PRODUCT_OUT/root, which will 186 // then be copied to the root of system.img. When this module is packaged by other modules like 187 // android_filesystem, this module will be installed to the root ("/"), unlike normal 188 // prebuilt_root modules which are installed to the partition subdir (e.g. "/system/"). 189 Install_in_root *bool 190} 191 192type PrebuiltEtcModule interface { 193 android.Module 194 195 // Returns the base install directory, such as "etc", "usr/share". 196 BaseDir() string 197 198 // Returns the sub install directory relative to BaseDir(). 199 SubDir() string 200} 201 202type PrebuiltEtc struct { 203 android.ModuleBase 204 android.DefaultableModuleBase 205 206 properties PrebuiltEtcProperties 207 208 dstsProperties PrebuiltDstsProperties 209 210 // rootProperties is used to return the value of the InstallInRoot() method. Currently, only 211 // prebuilt_avb and prebuilt_root modules use this. 212 rootProperties prebuiltRootProperties 213 214 subdirProperties prebuiltSubdirProperties 215 216 sourceFilePaths android.Paths 217 outputFilePaths android.WritablePaths 218 // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share. 219 installDirBase string 220 installDirBase64 string 221 installAvoidMultilibConflict bool 222 // The base install location when soc_specific property is set to true, e.g. "firmware" for 223 // prebuilt_firmware. 224 socInstallDirBase string 225 installDirPaths []android.InstallPath 226 additionalDependencies *android.Paths 227 228 usedSrcsProperty bool 229 230 makeClass string 231} 232 233type Defaults struct { 234 android.ModuleBase 235 android.DefaultsModuleBase 236} 237 238func (p *PrebuiltEtc) inRamdisk() bool { 239 return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk() 240} 241 242func (p *PrebuiltEtc) onlyInRamdisk() bool { 243 return p.ModuleBase.InstallInRamdisk() 244} 245 246func (p *PrebuiltEtc) InstallInRamdisk() bool { 247 return p.inRamdisk() 248} 249 250func (p *PrebuiltEtc) inVendorRamdisk() bool { 251 return p.ModuleBase.InVendorRamdisk() || p.ModuleBase.InstallInVendorRamdisk() 252} 253 254func (p *PrebuiltEtc) onlyInVendorRamdisk() bool { 255 return p.ModuleBase.InstallInVendorRamdisk() 256} 257 258func (p *PrebuiltEtc) InstallInVendorRamdisk() bool { 259 return p.inVendorRamdisk() 260} 261 262func (p *PrebuiltEtc) inDebugRamdisk() bool { 263 return p.ModuleBase.InDebugRamdisk() || p.ModuleBase.InstallInDebugRamdisk() 264} 265 266func (p *PrebuiltEtc) onlyInDebugRamdisk() bool { 267 return p.ModuleBase.InstallInDebugRamdisk() 268} 269 270func (p *PrebuiltEtc) InstallInDebugRamdisk() bool { 271 return p.inDebugRamdisk() 272} 273 274func (p *PrebuiltEtc) InRecovery() bool { 275 return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery() 276} 277 278func (p *PrebuiltEtc) onlyInRecovery() bool { 279 return p.ModuleBase.InstallInRecovery() 280} 281 282func (p *PrebuiltEtc) InstallInRecovery() bool { 283 return p.InRecovery() 284} 285 286var _ android.ImageInterface = (*PrebuiltEtc)(nil) 287 288func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.ImageInterfaceContext) {} 289 290func (p *PrebuiltEtc) VendorVariantNeeded(ctx android.ImageInterfaceContext) bool { 291 return false 292} 293 294func (p *PrebuiltEtc) ProductVariantNeeded(ctx android.ImageInterfaceContext) bool { 295 return false 296} 297 298func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.ImageInterfaceContext) bool { 299 return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() && 300 !p.ModuleBase.InstallInVendorRamdisk() && !p.ModuleBase.InstallInDebugRamdisk() 301} 302 303func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool { 304 return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk() 305} 306 307func (p *PrebuiltEtc) VendorRamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool { 308 return proptools.Bool(p.properties.Vendor_ramdisk_available) || p.ModuleBase.InstallInVendorRamdisk() 309} 310 311func (p *PrebuiltEtc) DebugRamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool { 312 return proptools.Bool(p.properties.Debug_ramdisk_available) || p.ModuleBase.InstallInDebugRamdisk() 313} 314 315func (p *PrebuiltEtc) InstallInRoot() bool { 316 return proptools.Bool(p.rootProperties.Install_in_root) 317} 318 319func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.ImageInterfaceContext) bool { 320 return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery() 321} 322 323func (p *PrebuiltEtc) ExtraImageVariations(ctx android.ImageInterfaceContext) []string { 324 return nil 325} 326 327func (p *PrebuiltEtc) SetImageVariation(ctx android.ImageInterfaceContext, variation string) { 328} 329 330func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path { 331 if len(p.properties.Srcs.GetOrDefault(ctx, nil)) > 0 { 332 panic(fmt.Errorf("SourceFilePath not available on multi-source prebuilt %q", p.Name())) 333 } 334 return android.PathForModuleSrc(ctx, p.properties.Src.GetOrDefault(ctx, "")) 335} 336 337func (p *PrebuiltEtc) InstallDirPath() android.InstallPath { 338 if len(p.installDirPaths) != 1 { 339 panic(fmt.Errorf("InstallDirPath not available on multi-source prebuilt %q", p.Name())) 340 } 341 return p.installDirPaths[0] 342} 343 344// This allows other derivative modules (e.g. prebuilt_etc_xml) to perform 345// additional steps (like validating the src) before the file is installed. 346func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) { 347 p.additionalDependencies = &paths 348} 349 350func (p *PrebuiltEtc) OutputFile() android.Path { 351 if p.usedSrcsProperty { 352 panic(fmt.Errorf("OutputFile not available on multi-source prebuilt %q", p.Name())) 353 } 354 return p.outputFilePaths[0] 355} 356 357func (p *PrebuiltEtc) SubDir() string { 358 if subDir := proptools.String(p.subdirProperties.Sub_dir); subDir != "" { 359 return subDir 360 } 361 return proptools.String(p.subdirProperties.Relative_install_path) 362} 363 364func (p *PrebuiltEtc) BaseDir() string { 365 return p.installDirBase 366} 367 368func (p *PrebuiltEtc) Installable() bool { 369 return p.properties.Installable == nil || proptools.Bool(p.properties.Installable) 370} 371 372func (p *PrebuiltEtc) InVendor() bool { 373 return p.ModuleBase.InstallInVendor() 374} 375 376func (p *PrebuiltEtc) installBaseDir(ctx android.ModuleContext) string { 377 // If soc install dir was specified and SOC specific is set, set the installDirPath to the 378 // specified socInstallDirBase. 379 installBaseDir := p.installDirBase 380 if p.Target().Arch.ArchType.Multilib == "lib64" && p.installDirBase64 != "" { 381 installBaseDir = p.installDirBase64 382 } 383 if p.SocSpecific() && p.socInstallDirBase != "" { 384 installBaseDir = p.socInstallDirBase 385 } 386 if p.installAvoidMultilibConflict && !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) { 387 installBaseDir = filepath.Join(installBaseDir, ctx.Arch().ArchType.String()) 388 } 389 return installBaseDir 390} 391 392func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) { 393 var installs []installProperties 394 395 srcProperty := p.properties.Src.Get(ctx) 396 srcsProperty := p.properties.Srcs.GetOrDefault(ctx, nil) 397 if srcProperty.IsPresent() && len(srcsProperty) > 0 { 398 ctx.PropertyErrorf("src", "src is set. Cannot set srcs") 399 } 400 dstsProperty := p.dstsProperties.Dsts.GetOrDefault(ctx, nil) 401 if len(dstsProperty) > 0 && len(srcsProperty) == 0 { 402 ctx.PropertyErrorf("dsts", "dsts is set. Must use srcs") 403 } 404 405 // Check that `sub_dir` and `relative_install_path` are not set at the same time. 406 if p.subdirProperties.Sub_dir != nil && p.subdirProperties.Relative_install_path != nil { 407 ctx.PropertyErrorf("sub_dir", "relative_install_path is set. Cannot set sub_dir") 408 } 409 baseInstallDirPath := android.PathForModuleInstall(ctx, p.installBaseDir(ctx), p.SubDir()) 410 // TODO(b/377304441) 411 if android.Bool(p.properties.Oem_specific) { 412 baseInstallDirPath = android.PathForModuleInPartitionInstall(ctx, ctx.DeviceConfig().OemPath(), p.installBaseDir(ctx), p.SubDir()) 413 } 414 415 filename := proptools.String(p.properties.Filename) 416 filenameFromSrc := proptools.Bool(p.properties.Filename_from_src) 417 if srcProperty.IsPresent() { 418 p.sourceFilePaths = android.PathsForModuleSrc(ctx, []string{srcProperty.Get()}) 419 // If the source was not found, set a fake source path to 420 // support AllowMissingDependencies executions. 421 if len(p.sourceFilePaths) == 0 { 422 p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)} 423 } 424 425 // Determine the output file basename. 426 // If Filename is set, use the name specified by the property. 427 // If Filename_from_src is set, use the source file name. 428 // Otherwise use the module name. 429 if filename != "" { 430 if filenameFromSrc { 431 ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true") 432 return 433 } 434 } else if filenameFromSrc { 435 filename = p.sourceFilePaths[0].Base() 436 } else { 437 filename = ctx.ModuleName() 438 } 439 if strings.Contains(filename, "/") { 440 ctx.PropertyErrorf("filename", "filename cannot contain separator '/'") 441 return 442 } 443 p.outputFilePaths = android.WritablePaths{android.PathForModuleOut(ctx, filename)} 444 445 ip := installProperties{ 446 filename: filename, 447 sourceFilePath: p.sourceFilePaths[0], 448 outputFilePath: p.outputFilePaths[0], 449 installDirPath: baseInstallDirPath, 450 symlinks: p.properties.Symlinks, 451 } 452 installs = append(installs, ip) 453 p.installDirPaths = append(p.installDirPaths, baseInstallDirPath) 454 } else if len(srcsProperty) > 0 { 455 p.usedSrcsProperty = true 456 if filename != "" { 457 ctx.PropertyErrorf("filename", "filename cannot be set when using srcs") 458 } 459 if len(p.properties.Symlinks) > 0 { 460 ctx.PropertyErrorf("symlinks", "symlinks cannot be set when using srcs") 461 } 462 if p.properties.Filename_from_src != nil { 463 if len(dstsProperty) > 0 { 464 ctx.PropertyErrorf("filename_from_src", "dsts is set. Cannot set filename_from_src") 465 } else { 466 ctx.PropertyErrorf("filename_from_src", "filename_from_src is implicitly set to true when using srcs") 467 } 468 } 469 p.sourceFilePaths = android.PathsForModuleSrc(ctx, srcsProperty) 470 if len(dstsProperty) > 0 && len(p.sourceFilePaths) != len(dstsProperty) { 471 ctx.PropertyErrorf("dsts", "Must have one entry in dsts per source file") 472 } 473 for i, src := range p.sourceFilePaths { 474 var filename string 475 var installDirPath android.InstallPath 476 477 if len(dstsProperty) > 0 { 478 var dstdir string 479 480 dstdir, filename = filepath.Split(dstsProperty[i]) 481 installDirPath = baseInstallDirPath.Join(ctx, dstdir) 482 } else { 483 filename = src.Base() 484 installDirPath = baseInstallDirPath 485 } 486 output := android.PathForModuleOut(ctx, filename) 487 ip := installProperties{ 488 filename: filename, 489 sourceFilePath: src, 490 outputFilePath: output, 491 installDirPath: installDirPath, 492 } 493 p.outputFilePaths = append(p.outputFilePaths, output) 494 installs = append(installs, ip) 495 p.installDirPaths = append(p.installDirPaths, installDirPath) 496 } 497 } else if ctx.Config().AllowMissingDependencies() { 498 // If no srcs was set and AllowMissingDependencies is enabled then 499 // mark the module as missing dependencies and set a fake source path 500 // and file name. 501 ctx.AddMissingDependencies([]string{"MISSING_PREBUILT_SRC_FILE"}) 502 p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)} 503 if filename == "" { 504 filename = ctx.ModuleName() 505 } 506 p.outputFilePaths = android.WritablePaths{android.PathForModuleOut(ctx, filename)} 507 ip := installProperties{ 508 filename: filename, 509 sourceFilePath: p.sourceFilePaths[0], 510 outputFilePath: p.outputFilePaths[0], 511 installDirPath: baseInstallDirPath, 512 } 513 installs = append(installs, ip) 514 p.installDirPaths = append(p.installDirPaths, baseInstallDirPath) 515 } else { 516 ctx.PropertyErrorf("src", "missing prebuilt source file") 517 return 518 } 519 520 // Call InstallFile even when uninstallable to make the module included in the package. 521 if !p.Installable() { 522 p.SkipInstall() 523 } 524 for _, ip := range installs { 525 ip.addInstallRules(ctx) 526 } 527 528 p.updateModuleInfoJSON(ctx) 529 530 ctx.SetOutputFiles(p.outputFilePaths.Paths(), "") 531 532 SetCommonPrebuiltEtcInfo(ctx, p) 533} 534 535func SetCommonPrebuiltEtcInfo(ctx android.ModuleContext, p PrebuiltEtcModule) { 536 android.SetProvider(ctx, PrebuiltEtcInfoProvider, PrebuiltEtcInfo{ 537 BaseDir: p.BaseDir(), 538 SubDir: p.SubDir(), 539 }) 540} 541 542func (p *PrebuiltEtc) updateModuleInfoJSON(ctx android.ModuleContext) { 543 moduleInfoJSON := ctx.ModuleInfoJSON() 544 moduleInfoJSON.Class = []string{"ETC"} 545 if p.makeClass != "" { 546 moduleInfoJSON.Class = []string{p.makeClass} 547 } 548 moduleInfoJSON.SystemSharedLibs = []string{"none"} 549 moduleInfoJSON.Tags = []string{"optional"} 550} 551 552type installProperties struct { 553 filename string 554 sourceFilePath android.Path 555 outputFilePath android.WritablePath 556 installDirPath android.InstallPath 557 symlinks []string 558} 559 560// utility function to add install rules to the build graph. 561// Reduces code duplication between Soong and Mixed build analysis 562func (ip *installProperties) addInstallRules(ctx android.ModuleContext) { 563 // Copy the file from src to a location in out/ with the correct `filename` 564 // This ensures that outputFilePath has the correct name for others to 565 // use, as the source file may have a different name. 566 ctx.Build(pctx, android.BuildParams{ 567 Rule: android.Cp, 568 Output: ip.outputFilePath, 569 Input: ip.sourceFilePath, 570 }) 571 572 installPath := ctx.InstallFile(ip.installDirPath, ip.filename, ip.outputFilePath) 573 for _, sl := range ip.symlinks { 574 ctx.InstallSymlink(ip.installDirPath, sl, installPath) 575 } 576} 577 578func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries { 579 nameSuffix := "" 580 if p.inRamdisk() && !p.onlyInRamdisk() { 581 nameSuffix = ".ramdisk" 582 } 583 if p.inVendorRamdisk() && !p.onlyInVendorRamdisk() { 584 nameSuffix = ".vendor_ramdisk" 585 } 586 if p.inDebugRamdisk() && !p.onlyInDebugRamdisk() { 587 nameSuffix = ".debug_ramdisk" 588 } 589 if p.InRecovery() && !p.onlyInRecovery() { 590 nameSuffix = ".recovery" 591 } 592 593 class := p.makeClass 594 if class == "" { 595 class = "ETC" 596 } 597 598 return []android.AndroidMkEntries{{ 599 Class: class, 600 SubName: nameSuffix, 601 OutputFile: android.OptionalPathForPath(p.outputFilePaths[0]), 602 ExtraEntries: []android.AndroidMkExtraEntriesFunc{ 603 func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { 604 entries.SetString("LOCAL_MODULE_TAGS", "optional") 605 entries.SetString("LOCAL_MODULE_PATH", p.installDirPaths[0].String()) 606 entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePaths[0].Base()) 607 if len(p.properties.Symlinks) > 0 { 608 entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...) 609 } 610 entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.Installable()) 611 if p.additionalDependencies != nil { 612 entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", p.additionalDependencies.Strings()...) 613 } 614 }, 615 }, 616 }} 617} 618 619func (p *PrebuiltEtc) AndroidModuleBase() *android.ModuleBase { 620 return &p.ModuleBase 621} 622 623func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) { 624 p.installDirBase = dirBase 625 p.AddProperties(&p.properties) 626 p.AddProperties(&p.subdirProperties) 627 p.AddProperties(&p.rootProperties) 628 p.AddProperties(&p.dstsProperties) 629} 630 631func InitPrebuiltRootModule(p *PrebuiltEtc) { 632 p.installDirBase = "." 633 p.AddProperties(&p.properties) 634 p.AddProperties(&p.rootProperties) 635} 636 637func InitPrebuiltAvbModule(p *PrebuiltEtc) { 638 p.installDirBase = "avb" 639 p.AddProperties(&p.properties) 640 p.AddProperties(&p.dstsProperties) 641 p.rootProperties.Install_in_root = proptools.BoolPtr(true) 642} 643 644// prebuilt_etc is for a prebuilt artifact that is installed in 645// <partition>/etc/<sub_dir> directory. 646func PrebuiltEtcFactory() android.Module { 647 module := &PrebuiltEtc{} 648 InitPrebuiltEtcModule(module, "etc") 649 // This module is device-only 650 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 651 android.InitDefaultableModule(module) 652 return module 653} 654 655func defaultsFactory() android.Module { 656 return DefaultsFactory() 657} 658 659func DefaultsFactory(props ...interface{}) android.Module { 660 module := &Defaults{} 661 662 module.AddProperties(props...) 663 module.AddProperties( 664 &PrebuiltEtcProperties{}, 665 &prebuiltSubdirProperties{}, 666 ) 667 668 android.InitDefaultsModule(module) 669 670 return module 671} 672 673// prebuilt_etc_host is for a host prebuilt artifact that is installed in 674// $(HOST_OUT)/etc/<sub_dir> directory. 675func PrebuiltEtcHostFactory() android.Module { 676 module := &PrebuiltEtc{} 677 InitPrebuiltEtcModule(module, "etc") 678 // This module is host-only 679 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) 680 android.InitDefaultableModule(module) 681 return module 682} 683 684// prebuilt_any is a special module where the module can define the subdirectory that the files 685// are installed to. This is only used for converting the PRODUCT_COPY_FILES entries to Soong 686// modules, and should never be defined in the bp files. If none of the existing prebuilt_* 687// modules allow installing the file at the desired location, introduce a new prebuilt_* module 688// type instead. 689func PrebuiltAnyFactory() android.Module { 690 module := &PrebuiltEtc{} 691 InitPrebuiltEtcModule(module, ".") 692 // This module is device-only 693 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 694 android.InitDefaultableModule(module) 695 return module 696} 697 698// prebuilt_etc_host is for a host prebuilt artifact that is installed in 699// <partition>/etc/<sub_dir> directory. 700func PrebuiltEtcCaCertsFactory() android.Module { 701 module := &PrebuiltEtc{} 702 InitPrebuiltEtcModule(module, "cacerts") 703 // This module is device-only 704 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 705 return module 706} 707 708// Generally, a <partition> directory will contain a `system` subdirectory, but the <partition> of 709// `prebuilt_avb` will not have a `system` subdirectory. 710// Ultimately, prebuilt_avb will install the prebuilt artifact to the `avb` subdirectory under the 711// root directory of the partition: <partition_root>/avb. 712// prebuilt_avb does not allow adding any other subdirectories. 713func PrebuiltAvbFactory() android.Module { 714 module := &PrebuiltEtc{} 715 InitPrebuiltAvbModule(module) 716 // This module is device-only 717 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 718 android.InitDefaultableModule(module) 719 return module 720} 721 722// prebuilt_root is for a prebuilt artifact that is installed in 723// <partition>/ directory. Can't have any sub directories. 724func PrebuiltRootFactory() android.Module { 725 module := &PrebuiltEtc{} 726 InitPrebuiltRootModule(module) 727 // This module is device-only 728 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 729 android.InitDefaultableModule(module) 730 return module 731} 732 733// prebuilt_root_host is for a host prebuilt artifact that is installed in $(HOST_OUT)/<sub_dir> 734// directory. 735func PrebuiltRootHostFactory() android.Module { 736 module := &PrebuiltEtc{} 737 InitPrebuiltEtcModule(module, ".") 738 // This module is host-only 739 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) 740 android.InitDefaultableModule(module) 741 return module 742} 743 744// prebuilt_usr_share is for a prebuilt artifact that is installed in 745// <partition>/usr/share/<sub_dir> directory. 746func PrebuiltUserShareFactory() android.Module { 747 module := &PrebuiltEtc{} 748 InitPrebuiltEtcModule(module, "usr/share") 749 // This module is device-only 750 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 751 android.InitDefaultableModule(module) 752 return module 753} 754 755// prebuild_usr_share_host is for a host prebuilt artifact that is installed in 756// $(HOST_OUT)/usr/share/<sub_dir> directory. 757func PrebuiltUserShareHostFactory() android.Module { 758 module := &PrebuiltEtc{} 759 InitPrebuiltEtcModule(module, "usr/share") 760 // This module is host-only 761 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) 762 android.InitDefaultableModule(module) 763 return module 764} 765 766// prebuilt_usr_hyphendata is for a prebuilt artifact that is installed in 767// <partition>/usr/hyphen-data/<sub_dir> directory. 768func PrebuiltUserHyphenDataFactory() android.Module { 769 module := &PrebuiltEtc{} 770 InitPrebuiltEtcModule(module, "usr/hyphen-data") 771 // This module is device-only 772 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 773 android.InitDefaultableModule(module) 774 return module 775} 776 777// prebuilt_usr_keylayout is for a prebuilt artifact that is installed in 778// <partition>/usr/keylayout/<sub_dir> directory. 779func PrebuiltUserKeyLayoutFactory() android.Module { 780 module := &PrebuiltEtc{} 781 InitPrebuiltEtcModule(module, "usr/keylayout") 782 // This module is device-only 783 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 784 android.InitDefaultableModule(module) 785 return module 786} 787 788// prebuilt_usr_keychars is for a prebuilt artifact that is installed in 789// <partition>/usr/keychars/<sub_dir> directory. 790func PrebuiltUserKeyCharsFactory() android.Module { 791 module := &PrebuiltEtc{} 792 InitPrebuiltEtcModule(module, "usr/keychars") 793 // This module is device-only 794 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 795 android.InitDefaultableModule(module) 796 return module 797} 798 799// prebuilt_usr_idc is for a prebuilt artifact that is installed in 800// <partition>/usr/idc/<sub_dir> directory. 801func PrebuiltUserIdcFactory() android.Module { 802 module := &PrebuiltEtc{} 803 InitPrebuiltEtcModule(module, "usr/idc") 804 // This module is device-only 805 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 806 android.InitDefaultableModule(module) 807 return module 808} 809 810// prebuilt_usr_srec is for a prebuilt artifact that is installed in 811// <partition>/usr/srec/<sub_dir> directory. 812func PrebuiltUserSrecFactory() android.Module { 813 module := &PrebuiltEtc{} 814 InitPrebuiltEtcModule(module, "usr/srec") 815 // This module is device-only 816 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 817 android.InitDefaultableModule(module) 818 return module 819} 820 821// prebuilt_usr_odml is for a prebuilt artifact that is installed in 822// <partition>/usr/odml/<sub_dir> directory. 823func PrebuiltUserOdmlFactory() android.Module { 824 module := &PrebuiltEtc{} 825 InitPrebuiltEtcModule(module, "usr/odml") 826 // This module is device-only 827 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 828 android.InitDefaultableModule(module) 829 return module 830} 831 832// prebuilt_font installs a font in <partition>/fonts directory. 833func PrebuiltFontFactory() android.Module { 834 module := &PrebuiltEtc{} 835 InitPrebuiltEtcModule(module, "fonts") 836 // This module is device-only 837 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 838 android.InitDefaultableModule(module) 839 return module 840} 841 842// prebuilt_overlay is for a prebuilt artifact in <partition>/overlay directory. 843func PrebuiltOverlayFactory() android.Module { 844 module := &PrebuiltEtc{} 845 InitPrebuiltEtcModule(module, "overlay") 846 // This module is device-only 847 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 848 return module 849} 850 851// prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system 852// image. 853// If soc_specific property is set to true, the firmware file is installed to the 854// vendor <partition>/firmware directory for vendor image. 855func PrebuiltFirmwareFactory() android.Module { 856 module := &PrebuiltEtc{} 857 module.socInstallDirBase = "firmware" 858 InitPrebuiltEtcModule(module, "etc/firmware") 859 // This module is device-only 860 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 861 android.InitDefaultableModule(module) 862 return module 863} 864 865// prebuilt_gpu is for a prebuilt artifact in <partition>/gpu directory. 866func PrebuiltGPUFactory() android.Module { 867 module := &PrebuiltEtc{} 868 InitPrebuiltEtcModule(module, "gpu") 869 // This module is device-only 870 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 871 return module 872} 873 874// prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image. 875// If soc_specific property is set to true, the DSP related file is installed to the 876// vendor <partition>/dsp directory for vendor image. 877func PrebuiltDSPFactory() android.Module { 878 module := &PrebuiltEtc{} 879 module.socInstallDirBase = "dsp" 880 InitPrebuiltEtcModule(module, "etc/dsp") 881 // This module is device-only 882 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 883 android.InitDefaultableModule(module) 884 return module 885} 886 887// prebuilt_renderscript_bitcode installs a *.bc file into /system/lib or /system/lib64. 888func PrebuiltRenderScriptBitcodeFactory() android.Module { 889 module := &PrebuiltEtc{} 890 module.makeClass = "RENDERSCRIPT_BITCODE" 891 module.installDirBase64 = "lib64" 892 module.installAvoidMultilibConflict = true 893 InitPrebuiltEtcModule(module, "lib") 894 // This module is device-only 895 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth) 896 android.InitDefaultableModule(module) 897 return module 898} 899 900// prebuilt_rfsa installs a firmware file that will be available through Qualcomm's RFSA 901// to the <partition>/lib/rfsa directory. 902func PrebuiltRFSAFactory() android.Module { 903 module := &PrebuiltEtc{} 904 // Ideally these would go in /vendor/dsp, but the /vendor/lib/rfsa paths are hardcoded in too 905 // many places outside of the application processor. They could be moved to /vendor/dsp once 906 // that is cleaned up. 907 InitPrebuiltEtcModule(module, "lib/rfsa") 908 // This module is device-only 909 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 910 android.InitDefaultableModule(module) 911 return module 912} 913 914// prebuilt_tee installs files in <partition>/tee directory. 915func PrebuiltTeeFactory() android.Module { 916 module := &PrebuiltEtc{} 917 InitPrebuiltEtcModule(module, "tee") 918 // This module is device-only 919 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 920 android.InitDefaultableModule(module) 921 return module 922} 923 924// prebuilt_media installs media files in <partition>/media directory. 925func PrebuiltMediaFactory() android.Module { 926 module := &PrebuiltEtc{} 927 InitPrebuiltEtcModule(module, "media") 928 // This module is device-only 929 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 930 android.InitDefaultableModule(module) 931 return module 932} 933 934// prebuilt_voicepack installs voice pack files in <partition>/tts directory. 935func PrebuiltVoicepackFactory() android.Module { 936 module := &PrebuiltEtc{} 937 InitPrebuiltEtcModule(module, "tts") 938 // This module is device-only 939 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 940 android.InitDefaultableModule(module) 941 return module 942} 943 944// prebuilt_bin installs files in <partition>/bin directory. 945func PrebuiltBinaryFactory() android.Module { 946 module := &PrebuiltEtc{} 947 InitPrebuiltEtcModule(module, "bin") 948 // This module is device-only 949 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 950 android.InitDefaultableModule(module) 951 return module 952} 953 954// prebuilt_wallpaper installs image files in <partition>/wallpaper directory. 955func PrebuiltWallpaperFactory() android.Module { 956 module := &PrebuiltEtc{} 957 InitPrebuiltEtcModule(module, "wallpaper") 958 // This module is device-only 959 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 960 android.InitDefaultableModule(module) 961 return module 962} 963 964// prebuilt_priv_app installs files in <partition>/priv-app directory. 965func PrebuiltPrivAppFactory() android.Module { 966 module := &PrebuiltEtc{} 967 InitPrebuiltEtcModule(module, "priv-app") 968 // This module is device-only 969 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 970 android.InitDefaultableModule(module) 971 return module 972} 973 974// prebuilt_radio installs files in <partition>/radio directory. 975func PrebuiltRadioFactory() android.Module { 976 module := &PrebuiltEtc{} 977 InitPrebuiltEtcModule(module, "radio") 978 // This module is device-only 979 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 980 android.InitDefaultableModule(module) 981 return module 982} 983 984// prebuilt_rfs installs files in <partition>/rfs directory. 985func PrebuiltRfsFactory() android.Module { 986 module := &PrebuiltEtc{} 987 InitPrebuiltEtcModule(module, "rfs") 988 // This module is device-only 989 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 990 android.InitDefaultableModule(module) 991 return module 992} 993 994// prebuilt_framework installs files in <partition>/framework directory. 995func PrebuiltFrameworkFactory() android.Module { 996 module := &PrebuiltEtc{} 997 InitPrebuiltEtcModule(module, "framework") 998 // This module is device-only 999 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1000 android.InitDefaultableModule(module) 1001 return module 1002} 1003 1004// prebuilt_res installs files in <partition>/res directory. 1005func PrebuiltResFactory() android.Module { 1006 module := &PrebuiltEtc{} 1007 InitPrebuiltEtcModule(module, "res") 1008 // This module is device-only 1009 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1010 android.InitDefaultableModule(module) 1011 return module 1012} 1013 1014// prebuilt_wlc_upt installs files in <partition>/wlc_upt directory. 1015func PrebuiltWlcUptFactory() android.Module { 1016 module := &PrebuiltEtc{} 1017 InitPrebuiltEtcModule(module, "wlc_upt") 1018 // This module is device-only 1019 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1020 android.InitDefaultableModule(module) 1021 return module 1022} 1023 1024// prebuilt_odm installs files in <partition>/odm directory. 1025func PrebuiltOdmFactory() android.Module { 1026 module := &PrebuiltEtc{} 1027 InitPrebuiltEtcModule(module, "odm") 1028 // This module is device-only 1029 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1030 android.InitDefaultableModule(module) 1031 return module 1032} 1033 1034// prebuilt_vendor_dlkm installs files in <partition>/vendor_dlkm directory. 1035func PrebuiltVendorDlkmFactory() android.Module { 1036 module := &PrebuiltEtc{} 1037 InitPrebuiltEtcModule(module, "vendor_dlkm") 1038 // This module is device-only 1039 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1040 android.InitDefaultableModule(module) 1041 return module 1042} 1043 1044// prebuilt_bt_firmware installs files in <partition>/bt_firmware directory. 1045func PrebuiltBtFirmwareFactory() android.Module { 1046 module := &PrebuiltEtc{} 1047 InitPrebuiltEtcModule(module, "bt_firmware") 1048 // This module is device-only 1049 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1050 android.InitDefaultableModule(module) 1051 return module 1052} 1053 1054// prebuilt_tvservice installs files in <partition>/tvservice directory. 1055func PrebuiltTvServiceFactory() android.Module { 1056 module := &PrebuiltEtc{} 1057 InitPrebuiltEtcModule(module, "tvservice") 1058 // This module is device-only 1059 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1060 android.InitDefaultableModule(module) 1061 return module 1062} 1063 1064// prebuilt_optee installs files in <partition>/optee directory. 1065func PrebuiltOpteeFactory() android.Module { 1066 module := &PrebuiltEtc{} 1067 InitPrebuiltEtcModule(module, "optee") 1068 // This module is device-only 1069 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1070 android.InitDefaultableModule(module) 1071 return module 1072} 1073 1074// prebuilt_tvconfig installs files in <partition>/tvconfig directory. 1075func PrebuiltTvConfigFactory() android.Module { 1076 module := &PrebuiltEtc{} 1077 InitPrebuiltEtcModule(module, "tvconfig") 1078 // This module is device-only 1079 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1080 android.InitDefaultableModule(module) 1081 return module 1082} 1083 1084// prebuilt_vendor installs files in <partition>/vendor directory. 1085func PrebuiltVendorFactory() android.Module { 1086 module := &PrebuiltEtc{} 1087 InitPrebuiltEtcModule(module, "vendor") 1088 // This module is device-only 1089 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1090 android.InitDefaultableModule(module) 1091 return module 1092} 1093 1094// prebuilt_vendor_overlay is for a prebuilt artifact in <partition>/vendor_overlay directory. 1095func PrebuiltVendorOverlayFactory() android.Module { 1096 module := &PrebuiltEtc{} 1097 InitPrebuiltEtcModule(module, "vendor_overlay") 1098 // This module is device-only 1099 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1100 android.InitDefaultableModule(module) 1101 return module 1102} 1103 1104// prebuilt_sbin installs files in <partition>/sbin directory. 1105func PrebuiltSbinFactory() android.Module { 1106 module := &PrebuiltEtc{} 1107 InitPrebuiltEtcModule(module, "sbin") 1108 // This module is device-only 1109 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1110 android.InitDefaultableModule(module) 1111 return module 1112} 1113 1114// prebuilt_system installs files in <partition>/system directory. 1115func PrebuiltSystemFactory() android.Module { 1116 module := &PrebuiltEtc{} 1117 InitPrebuiltEtcModule(module, "system") 1118 // This module is device-only 1119 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1120 android.InitDefaultableModule(module) 1121 return module 1122} 1123 1124// prebuilt_first_stage_ramdisk installs files in <partition>/first_stage_ramdisk directory. 1125func PrebuiltFirstStageRamdiskFactory() android.Module { 1126 module := &PrebuiltEtc{} 1127 InitPrebuiltEtcModule(module, "first_stage_ramdisk") 1128 // This module is device-only 1129 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) 1130 android.InitDefaultableModule(module) 1131 return module 1132} 1133