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/proptools" 36 37 "android/soong/android" 38) 39 40var pctx = android.NewPackageContext("android/soong/etc") 41 42// TODO(jungw): Now that it handles more than the ones in etc/, consider renaming this file. 43 44func init() { 45 pctx.Import("android/soong/android") 46 RegisterPrebuiltEtcBuildComponents(android.InitRegistrationContext) 47} 48 49func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) { 50 ctx.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory) 51 ctx.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory) 52 ctx.RegisterModuleType("prebuilt_etc_cacerts", PrebuiltEtcCaCertsFactory) 53 ctx.RegisterModuleType("prebuilt_root", PrebuiltRootFactory) 54 ctx.RegisterModuleType("prebuilt_root_host", PrebuiltRootHostFactory) 55 ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory) 56 ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory) 57 ctx.RegisterModuleType("prebuilt_usr_hyphendata", PrebuiltUserHyphenDataFactory) 58 ctx.RegisterModuleType("prebuilt_usr_keylayout", PrebuiltUserKeyLayoutFactory) 59 ctx.RegisterModuleType("prebuilt_usr_keychars", PrebuiltUserKeyCharsFactory) 60 ctx.RegisterModuleType("prebuilt_usr_idc", PrebuiltUserIdcFactory) 61 ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory) 62 ctx.RegisterModuleType("prebuilt_overlay", PrebuiltOverlayFactory) 63 ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory) 64 ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory) 65 ctx.RegisterModuleType("prebuilt_rfsa", PrebuiltRFSAFactory) 66 ctx.RegisterModuleType("prebuilt_renderscript_bitcode", PrebuiltRenderScriptBitcodeFactory) 67 68 ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory) 69 70} 71 72var PrepareForTestWithPrebuiltEtc = android.FixtureRegisterWithContext(RegisterPrebuiltEtcBuildComponents) 73 74type prebuiltEtcProperties struct { 75 // Source file of this prebuilt. Can reference a genrule type module with the ":module" syntax. 76 // Mutually exclusive with srcs. 77 Src proptools.Configurable[string] `android:"path,arch_variant,replace_instead_of_append"` 78 79 // Source files of this prebuilt. Can reference a genrule type module with the ":module" syntax. 80 // Mutually exclusive with src. When used, filename_from_src is set to true. 81 Srcs proptools.Configurable[[]string] `android:"path,arch_variant"` 82 83 // Optional name for the installed file. If unspecified, name of the module is used as the file 84 // name. Only available when using a single source (src). 85 Filename *string `android:"arch_variant"` 86 87 // When set to true, and filename property is not set, the name for the installed file 88 // is the same as the file name of the source file. 89 Filename_from_src *bool `android:"arch_variant"` 90 91 // Make this module available when building for ramdisk. 92 // On device without a dedicated recovery partition, the module is only 93 // available after switching root into 94 // /first_stage_ramdisk. To expose the module before switching root, install 95 // the recovery variant instead. 96 Ramdisk_available *bool 97 98 // Make this module available when building for vendor ramdisk. 99 // On device without a dedicated recovery partition, the module is only 100 // available after switching root into 101 // /first_stage_ramdisk. To expose the module before switching root, install 102 // the recovery variant instead. 103 Vendor_ramdisk_available *bool 104 105 // Make this module available when building for debug ramdisk. 106 Debug_ramdisk_available *bool 107 108 // Make this module available when building for recovery. 109 Recovery_available *bool 110 111 // Whether this module is directly installable to one of the partitions. Default: true. 112 Installable *bool 113 114 // Install symlinks to the installed file. 115 Symlinks []string `android:"arch_variant"` 116} 117 118type prebuiltSubdirProperties struct { 119 // Optional subdirectory under which this file is installed into, cannot be specified with 120 // relative_install_path, prefer relative_install_path. 121 Sub_dir *string `android:"arch_variant"` 122 123 // Optional subdirectory under which this file is installed into, cannot be specified with 124 // sub_dir. 125 Relative_install_path *string `android:"arch_variant"` 126} 127 128type PrebuiltEtcModule interface { 129 android.Module 130 131 // Returns the base install directory, such as "etc", "usr/share". 132 BaseDir() string 133 134 // Returns the sub install directory relative to BaseDir(). 135 SubDir() string 136} 137 138type PrebuiltEtc struct { 139 android.ModuleBase 140 android.DefaultableModuleBase 141 142 properties prebuiltEtcProperties 143 subdirProperties prebuiltSubdirProperties 144 145 sourceFilePaths android.Paths 146 outputFilePaths android.OutputPaths 147 // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share. 148 installDirBase string 149 installDirBase64 string 150 installAvoidMultilibConflict bool 151 // The base install location when soc_specific property is set to true, e.g. "firmware" for 152 // prebuilt_firmware. 153 socInstallDirBase string 154 installDirPath android.InstallPath 155 additionalDependencies *android.Paths 156 157 usedSrcsProperty bool 158 159 makeClass string 160} 161 162type Defaults struct { 163 android.ModuleBase 164 android.DefaultsModuleBase 165} 166 167func (p *PrebuiltEtc) inRamdisk() bool { 168 return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk() 169} 170 171func (p *PrebuiltEtc) onlyInRamdisk() bool { 172 return p.ModuleBase.InstallInRamdisk() 173} 174 175func (p *PrebuiltEtc) InstallInRamdisk() bool { 176 return p.inRamdisk() 177} 178 179func (p *PrebuiltEtc) inVendorRamdisk() bool { 180 return p.ModuleBase.InVendorRamdisk() || p.ModuleBase.InstallInVendorRamdisk() 181} 182 183func (p *PrebuiltEtc) onlyInVendorRamdisk() bool { 184 return p.ModuleBase.InstallInVendorRamdisk() 185} 186 187func (p *PrebuiltEtc) InstallInVendorRamdisk() bool { 188 return p.inVendorRamdisk() 189} 190 191func (p *PrebuiltEtc) inDebugRamdisk() bool { 192 return p.ModuleBase.InDebugRamdisk() || p.ModuleBase.InstallInDebugRamdisk() 193} 194 195func (p *PrebuiltEtc) onlyInDebugRamdisk() bool { 196 return p.ModuleBase.InstallInDebugRamdisk() 197} 198 199func (p *PrebuiltEtc) InstallInDebugRamdisk() bool { 200 return p.inDebugRamdisk() 201} 202 203func (p *PrebuiltEtc) InRecovery() bool { 204 return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery() 205} 206 207func (p *PrebuiltEtc) onlyInRecovery() bool { 208 return p.ModuleBase.InstallInRecovery() 209} 210 211func (p *PrebuiltEtc) InstallInRecovery() bool { 212 return p.InRecovery() 213} 214 215var _ android.ImageInterface = (*PrebuiltEtc)(nil) 216 217func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.BaseModuleContext) {} 218 219func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.BaseModuleContext) bool { 220 return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() && 221 !p.ModuleBase.InstallInVendorRamdisk() && !p.ModuleBase.InstallInDebugRamdisk() 222} 223 224func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool { 225 return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk() 226} 227 228func (p *PrebuiltEtc) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { 229 return proptools.Bool(p.properties.Vendor_ramdisk_available) || p.ModuleBase.InstallInVendorRamdisk() 230} 231 232func (p *PrebuiltEtc) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { 233 return proptools.Bool(p.properties.Debug_ramdisk_available) || p.ModuleBase.InstallInDebugRamdisk() 234} 235 236func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool { 237 return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery() 238} 239 240func (p *PrebuiltEtc) ExtraImageVariations(ctx android.BaseModuleContext) []string { 241 return nil 242} 243 244func (p *PrebuiltEtc) SetImageVariation(ctx android.BaseModuleContext, variation string) { 245} 246 247func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path { 248 if len(p.properties.Srcs.GetOrDefault(ctx, nil)) > 0 { 249 panic(fmt.Errorf("SourceFilePath not available on multi-source prebuilt %q", p.Name())) 250 } 251 return android.PathForModuleSrc(ctx, p.properties.Src.GetOrDefault(ctx, "")) 252} 253 254func (p *PrebuiltEtc) InstallDirPath() android.InstallPath { 255 return p.installDirPath 256} 257 258// This allows other derivative modules (e.g. prebuilt_etc_xml) to perform 259// additional steps (like validating the src) before the file is installed. 260func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) { 261 p.additionalDependencies = &paths 262} 263 264func (p *PrebuiltEtc) OutputFile() android.OutputPath { 265 if p.usedSrcsProperty { 266 panic(fmt.Errorf("OutputFile not available on multi-source prebuilt %q", p.Name())) 267 } 268 return p.outputFilePaths[0] 269} 270 271func (p *PrebuiltEtc) SubDir() string { 272 if subDir := proptools.String(p.subdirProperties.Sub_dir); subDir != "" { 273 return subDir 274 } 275 return proptools.String(p.subdirProperties.Relative_install_path) 276} 277 278func (p *PrebuiltEtc) BaseDir() string { 279 return p.installDirBase 280} 281 282func (p *PrebuiltEtc) Installable() bool { 283 return p.properties.Installable == nil || proptools.Bool(p.properties.Installable) 284} 285 286func (p *PrebuiltEtc) InVendor() bool { 287 return p.ModuleBase.InstallInVendor() 288} 289 290func (p *PrebuiltEtc) installBaseDir(ctx android.ModuleContext) string { 291 // If soc install dir was specified and SOC specific is set, set the installDirPath to the 292 // specified socInstallDirBase. 293 installBaseDir := p.installDirBase 294 if p.Target().Arch.ArchType.Multilib == "lib64" && p.installDirBase64 != "" { 295 installBaseDir = p.installDirBase64 296 } 297 if p.SocSpecific() && p.socInstallDirBase != "" { 298 installBaseDir = p.socInstallDirBase 299 } 300 if p.installAvoidMultilibConflict && !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) { 301 installBaseDir = filepath.Join(installBaseDir, ctx.Arch().ArchType.String()) 302 } 303 return installBaseDir 304} 305 306func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) { 307 var installs []installProperties 308 309 srcProperty := p.properties.Src.Get(ctx) 310 srcsProperty := p.properties.Srcs.GetOrDefault(ctx, nil) 311 if srcProperty.IsPresent() && len(srcsProperty) > 0 { 312 ctx.PropertyErrorf("src", "src is set. Cannot set srcs") 313 } 314 315 // Check that `sub_dir` and `relative_install_path` are not set at the same time. 316 if p.subdirProperties.Sub_dir != nil && p.subdirProperties.Relative_install_path != nil { 317 ctx.PropertyErrorf("sub_dir", "relative_install_path is set. Cannot set sub_dir") 318 } 319 p.installDirPath = android.PathForModuleInstall(ctx, p.installBaseDir(ctx), p.SubDir()) 320 321 filename := proptools.String(p.properties.Filename) 322 filenameFromSrc := proptools.Bool(p.properties.Filename_from_src) 323 if srcProperty.IsPresent() { 324 p.sourceFilePaths = android.PathsForModuleSrc(ctx, []string{srcProperty.Get()}) 325 // If the source was not found, set a fake source path to 326 // support AllowMissingDependencies executions. 327 if len(p.sourceFilePaths) == 0 { 328 p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)} 329 } 330 331 // Determine the output file basename. 332 // If Filename is set, use the name specified by the property. 333 // If Filename_from_src is set, use the source file name. 334 // Otherwise use the module name. 335 if filename != "" { 336 if filenameFromSrc { 337 ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true") 338 return 339 } 340 } else if filenameFromSrc { 341 filename = p.sourceFilePaths[0].Base() 342 } else { 343 filename = ctx.ModuleName() 344 } 345 if strings.Contains(filename, "/") { 346 ctx.PropertyErrorf("filename", "filename cannot contain separator '/'") 347 return 348 } 349 p.outputFilePaths = android.OutputPaths{android.PathForModuleOut(ctx, filename).OutputPath} 350 351 ip := installProperties{ 352 filename: filename, 353 sourceFilePath: p.sourceFilePaths[0], 354 outputFilePath: p.outputFilePaths[0], 355 installDirPath: p.installDirPath, 356 symlinks: p.properties.Symlinks, 357 } 358 installs = append(installs, ip) 359 } else if len(srcsProperty) > 0 { 360 p.usedSrcsProperty = true 361 if filename != "" { 362 ctx.PropertyErrorf("filename", "filename cannot be set when using srcs") 363 } 364 if len(p.properties.Symlinks) > 0 { 365 ctx.PropertyErrorf("symlinks", "symlinks cannot be set when using srcs") 366 } 367 if p.properties.Filename_from_src != nil { 368 ctx.PropertyErrorf("filename_from_src", "filename_from_src is implicitly set to true when using srcs") 369 } 370 p.sourceFilePaths = android.PathsForModuleSrc(ctx, srcsProperty) 371 for _, src := range p.sourceFilePaths { 372 filename := src.Base() 373 output := android.PathForModuleOut(ctx, filename).OutputPath 374 ip := installProperties{ 375 filename: filename, 376 sourceFilePath: src, 377 outputFilePath: output, 378 installDirPath: p.installDirPath, 379 } 380 p.outputFilePaths = append(p.outputFilePaths, output) 381 installs = append(installs, ip) 382 } 383 } else if ctx.Config().AllowMissingDependencies() { 384 // If no srcs was set and AllowMissingDependencies is enabled then 385 // mark the module as missing dependencies and set a fake source path 386 // and file name. 387 ctx.AddMissingDependencies([]string{"MISSING_PREBUILT_SRC_FILE"}) 388 p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)} 389 if filename == "" { 390 filename = ctx.ModuleName() 391 } 392 p.outputFilePaths = android.OutputPaths{android.PathForModuleOut(ctx, filename).OutputPath} 393 ip := installProperties{ 394 filename: filename, 395 sourceFilePath: p.sourceFilePaths[0], 396 outputFilePath: p.outputFilePaths[0], 397 installDirPath: p.installDirPath, 398 } 399 installs = append(installs, ip) 400 } else { 401 ctx.PropertyErrorf("src", "missing prebuilt source file") 402 return 403 } 404 405 // Call InstallFile even when uninstallable to make the module included in the package. 406 if !p.Installable() { 407 p.SkipInstall() 408 } 409 for _, ip := range installs { 410 ip.addInstallRules(ctx) 411 } 412 413 ctx.SetOutputFiles(p.outputFilePaths.Paths(), "") 414} 415 416type installProperties struct { 417 filename string 418 sourceFilePath android.Path 419 outputFilePath android.OutputPath 420 installDirPath android.InstallPath 421 symlinks []string 422} 423 424// utility function to add install rules to the build graph. 425// Reduces code duplication between Soong and Mixed build analysis 426func (ip *installProperties) addInstallRules(ctx android.ModuleContext) { 427 // Copy the file from src to a location in out/ with the correct `filename` 428 // This ensures that outputFilePath has the correct name for others to 429 // use, as the source file may have a different name. 430 ctx.Build(pctx, android.BuildParams{ 431 Rule: android.Cp, 432 Output: ip.outputFilePath, 433 Input: ip.sourceFilePath, 434 }) 435 436 installPath := ctx.InstallFile(ip.installDirPath, ip.filename, ip.outputFilePath) 437 for _, sl := range ip.symlinks { 438 ctx.InstallSymlink(ip.installDirPath, sl, installPath) 439 } 440} 441 442func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries { 443 nameSuffix := "" 444 if p.inRamdisk() && !p.onlyInRamdisk() { 445 nameSuffix = ".ramdisk" 446 } 447 if p.inVendorRamdisk() && !p.onlyInVendorRamdisk() { 448 nameSuffix = ".vendor_ramdisk" 449 } 450 if p.inDebugRamdisk() && !p.onlyInDebugRamdisk() { 451 nameSuffix = ".debug_ramdisk" 452 } 453 if p.InRecovery() && !p.onlyInRecovery() { 454 nameSuffix = ".recovery" 455 } 456 457 class := p.makeClass 458 if class == "" { 459 class = "ETC" 460 } 461 462 return []android.AndroidMkEntries{{ 463 Class: class, 464 SubName: nameSuffix, 465 OutputFile: android.OptionalPathForPath(p.outputFilePaths[0]), 466 ExtraEntries: []android.AndroidMkExtraEntriesFunc{ 467 func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { 468 entries.SetString("LOCAL_MODULE_TAGS", "optional") 469 entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.String()) 470 entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePaths[0].Base()) 471 if len(p.properties.Symlinks) > 0 { 472 entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...) 473 } 474 entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.Installable()) 475 if p.additionalDependencies != nil { 476 entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", p.additionalDependencies.Strings()...) 477 } 478 }, 479 }, 480 }} 481} 482 483func (p *PrebuiltEtc) AndroidModuleBase() *android.ModuleBase { 484 return &p.ModuleBase 485} 486 487func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) { 488 p.installDirBase = dirBase 489 p.AddProperties(&p.properties) 490 p.AddProperties(&p.subdirProperties) 491} 492 493func InitPrebuiltRootModule(p *PrebuiltEtc) { 494 p.installDirBase = "." 495 p.AddProperties(&p.properties) 496} 497 498// prebuilt_etc is for a prebuilt artifact that is installed in 499// <partition>/etc/<sub_dir> directory. 500func PrebuiltEtcFactory() android.Module { 501 module := &PrebuiltEtc{} 502 InitPrebuiltEtcModule(module, "etc") 503 // This module is device-only 504 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 505 android.InitDefaultableModule(module) 506 return module 507} 508 509func defaultsFactory() android.Module { 510 return DefaultsFactory() 511} 512 513func DefaultsFactory(props ...interface{}) android.Module { 514 module := &Defaults{} 515 516 module.AddProperties(props...) 517 module.AddProperties( 518 &prebuiltEtcProperties{}, 519 &prebuiltSubdirProperties{}, 520 ) 521 522 android.InitDefaultsModule(module) 523 524 return module 525} 526 527// prebuilt_etc_host is for a host prebuilt artifact that is installed in 528// $(HOST_OUT)/etc/<sub_dir> directory. 529func PrebuiltEtcHostFactory() android.Module { 530 module := &PrebuiltEtc{} 531 InitPrebuiltEtcModule(module, "etc") 532 // This module is host-only 533 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) 534 android.InitDefaultableModule(module) 535 return module 536} 537 538// prebuilt_etc_host is for a host prebuilt artifact that is installed in 539// <partition>/etc/<sub_dir> directory. 540func PrebuiltEtcCaCertsFactory() android.Module { 541 module := &PrebuiltEtc{} 542 InitPrebuiltEtcModule(module, "cacerts") 543 // This module is device-only 544 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 545 return module 546} 547 548// prebuilt_root is for a prebuilt artifact that is installed in 549// <partition>/ directory. Can't have any sub directories. 550func PrebuiltRootFactory() android.Module { 551 module := &PrebuiltEtc{} 552 InitPrebuiltRootModule(module) 553 // This module is device-only 554 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 555 android.InitDefaultableModule(module) 556 return module 557} 558 559// prebuilt_root_host is for a host prebuilt artifact that is installed in $(HOST_OUT)/<sub_dir> 560// directory. 561func PrebuiltRootHostFactory() android.Module { 562 module := &PrebuiltEtc{} 563 InitPrebuiltEtcModule(module, ".") 564 // This module is host-only 565 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) 566 android.InitDefaultableModule(module) 567 return module 568} 569 570// prebuilt_usr_share is for a prebuilt artifact that is installed in 571// <partition>/usr/share/<sub_dir> directory. 572func PrebuiltUserShareFactory() android.Module { 573 module := &PrebuiltEtc{} 574 InitPrebuiltEtcModule(module, "usr/share") 575 // This module is device-only 576 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 577 android.InitDefaultableModule(module) 578 return module 579} 580 581// prebuild_usr_share_host is for a host prebuilt artifact that is installed in 582// $(HOST_OUT)/usr/share/<sub_dir> directory. 583func PrebuiltUserShareHostFactory() android.Module { 584 module := &PrebuiltEtc{} 585 InitPrebuiltEtcModule(module, "usr/share") 586 // This module is host-only 587 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) 588 android.InitDefaultableModule(module) 589 return module 590} 591 592// prebuilt_usr_hyphendata is for a prebuilt artifact that is installed in 593// <partition>/usr/hyphen-data/<sub_dir> directory. 594func PrebuiltUserHyphenDataFactory() android.Module { 595 module := &PrebuiltEtc{} 596 InitPrebuiltEtcModule(module, "usr/hyphen-data") 597 // This module is device-only 598 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 599 android.InitDefaultableModule(module) 600 return module 601} 602 603// prebuilt_usr_keylayout is for a prebuilt artifact that is installed in 604// <partition>/usr/keylayout/<sub_dir> directory. 605func PrebuiltUserKeyLayoutFactory() android.Module { 606 module := &PrebuiltEtc{} 607 InitPrebuiltEtcModule(module, "usr/keylayout") 608 // This module is device-only 609 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 610 android.InitDefaultableModule(module) 611 return module 612} 613 614// prebuilt_usr_keychars is for a prebuilt artifact that is installed in 615// <partition>/usr/keychars/<sub_dir> directory. 616func PrebuiltUserKeyCharsFactory() android.Module { 617 module := &PrebuiltEtc{} 618 InitPrebuiltEtcModule(module, "usr/keychars") 619 // This module is device-only 620 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 621 android.InitDefaultableModule(module) 622 return module 623} 624 625// prebuilt_usr_idc is for a prebuilt artifact that is installed in 626// <partition>/usr/idc/<sub_dir> directory. 627func PrebuiltUserIdcFactory() android.Module { 628 module := &PrebuiltEtc{} 629 InitPrebuiltEtcModule(module, "usr/idc") 630 // This module is device-only 631 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 632 android.InitDefaultableModule(module) 633 return module 634} 635 636// prebuilt_font installs a font in <partition>/fonts directory. 637func PrebuiltFontFactory() android.Module { 638 module := &PrebuiltEtc{} 639 InitPrebuiltEtcModule(module, "fonts") 640 // This module is device-only 641 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 642 android.InitDefaultableModule(module) 643 return module 644} 645 646// prebuilt_overlay is for a prebuilt artifact in <partition>/overlay directory. 647func PrebuiltOverlayFactory() android.Module { 648 module := &PrebuiltEtc{} 649 InitPrebuiltEtcModule(module, "overlay") 650 // This module is device-only 651 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 652 return module 653} 654 655// prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system 656// image. 657// If soc_specific property is set to true, the firmware file is installed to the 658// vendor <partition>/firmware directory for vendor image. 659func PrebuiltFirmwareFactory() android.Module { 660 module := &PrebuiltEtc{} 661 module.socInstallDirBase = "firmware" 662 InitPrebuiltEtcModule(module, "etc/firmware") 663 // This module is device-only 664 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 665 android.InitDefaultableModule(module) 666 return module 667} 668 669// prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image. 670// If soc_specific property is set to true, the DSP related file is installed to the 671// vendor <partition>/dsp directory for vendor image. 672func PrebuiltDSPFactory() android.Module { 673 module := &PrebuiltEtc{} 674 module.socInstallDirBase = "dsp" 675 InitPrebuiltEtcModule(module, "etc/dsp") 676 // This module is device-only 677 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 678 android.InitDefaultableModule(module) 679 return module 680} 681 682// prebuilt_renderscript_bitcode installs a *.bc file into /system/lib or /system/lib64. 683func PrebuiltRenderScriptBitcodeFactory() android.Module { 684 module := &PrebuiltEtc{} 685 module.makeClass = "RENDERSCRIPT_BITCODE" 686 module.installDirBase64 = "lib64" 687 module.installAvoidMultilibConflict = true 688 InitPrebuiltEtcModule(module, "lib") 689 // This module is device-only 690 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth) 691 android.InitDefaultableModule(module) 692 return module 693} 694 695// prebuilt_rfsa installs a firmware file that will be available through Qualcomm's RFSA 696// to the <partition>/lib/rfsa directory. 697func PrebuiltRFSAFactory() android.Module { 698 module := &PrebuiltEtc{} 699 // Ideally these would go in /vendor/dsp, but the /vendor/lib/rfsa paths are hardcoded in too 700 // many places outside of the application processor. They could be moved to /vendor/dsp once 701 // that is cleaned up. 702 InitPrebuiltEtcModule(module, "lib/rfsa") 703 // This module is device-only 704 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) 705 android.InitDefaultableModule(module) 706 return module 707} 708