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