blob: fc6d1f74e2dbcb2725de7c5d91f22e98066576a0 [file] [log] [blame]
Jiyong Parkc678ad32018-04-10 13:07:10 +09001// 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
Jaewoong Jung4b79e982020-06-01 10:45:49 -070015package etc
Jiyong Parkc678ad32018-04-10 13:07:10 +090016
Yo Chiang803c40d2020-11-16 20:32:51 +080017// 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.
Jaewoong Jung4b79e982020-06-01 10:45:49 -070029
Yo Chiang803c40d2020-11-16 20:32:51 +080030import (
Jiyong Park76a42f52021-02-16 06:50:37 +090031 "fmt"
Kiyoung Kimae11c232021-07-19 11:38:04 +090032 "path/filepath"
Inseob Kim27408bf2021-04-06 21:00:17 +090033 "strings"
Jiyong Park76a42f52021-02-16 06:50:37 +090034
Jaewoong Jung4b79e982020-06-01 10:45:49 -070035 "github.com/google/blueprint/proptools"
36
37 "android/soong/android"
38)
39
40var pctx = android.NewPackageContext("android/soong/etc")
Jiyong Parkc678ad32018-04-10 13:07:10 +090041
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -080042// TODO(jungw): Now that it handles more than the ones in etc/, consider renaming this file.
Jiyong Parkc678ad32018-04-10 13:07:10 +090043
44func init() {
Jaewoong Jung4b79e982020-06-01 10:45:49 -070045 pctx.Import("android/soong/android")
Jooyung Han0703fd82020-08-26 22:11:53 +090046 RegisterPrebuiltEtcBuildComponents(android.InitRegistrationContext)
47}
Jaewoong Jung4b79e982020-06-01 10:45:49 -070048
Jooyung Han0703fd82020-08-26 22:11:53 +090049func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) {
50 ctx.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory)
51 ctx.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
Miguel32b02802022-12-01 18:38:26 +000052 ctx.RegisterModuleType("prebuilt_etc_cacerts", PrebuiltEtcCaCertsFactory)
Nelson Li1fb94b22024-07-09 17:04:52 +080053 ctx.RegisterModuleType("prebuilt_avb", PrebuiltAvbFactory)
Inseob Kim27408bf2021-04-06 21:00:17 +090054 ctx.RegisterModuleType("prebuilt_root", PrebuiltRootFactory)
Liz Kammere9ecddc2022-01-04 17:27:52 -050055 ctx.RegisterModuleType("prebuilt_root_host", PrebuiltRootHostFactory)
Jooyung Han0703fd82020-08-26 22:11:53 +090056 ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
57 ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
yangbill63c5e192024-03-27 09:02:12 +000058 ctx.RegisterModuleType("prebuilt_usr_hyphendata", PrebuiltUserHyphenDataFactory)
yangbill85527e62024-04-30 08:24:50 +000059 ctx.RegisterModuleType("prebuilt_usr_keylayout", PrebuiltUserKeyLayoutFactory)
60 ctx.RegisterModuleType("prebuilt_usr_keychars", PrebuiltUserKeyCharsFactory)
61 ctx.RegisterModuleType("prebuilt_usr_idc", PrebuiltUserIdcFactory)
Jooyung Han0703fd82020-08-26 22:11:53 +090062 ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
Kevin93f7cd82024-05-02 12:37:59 +020063 ctx.RegisterModuleType("prebuilt_overlay", PrebuiltOverlayFactory)
Jooyung Han0703fd82020-08-26 22:11:53 +090064 ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
65 ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory)
Colin Cross83ebf232021-04-09 09:41:23 -070066 ctx.RegisterModuleType("prebuilt_rfsa", PrebuiltRFSAFactory)
Colin Crossf17e2b52023-10-30 15:17:25 -070067 ctx.RegisterModuleType("prebuilt_renderscript_bitcode", PrebuiltRenderScriptBitcodeFactory)
Inseob Kim1e27a142021-05-06 11:46:11 +000068
69 ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory)
Rupert Shuttleworth378fc1b2021-07-28 08:03:16 -040070
Jiyong Parkc678ad32018-04-10 13:07:10 +090071}
72
Paul Duffin1172fed2021-03-08 11:28:18 +000073var PrepareForTestWithPrebuiltEtc = android.FixtureRegisterWithContext(RegisterPrebuiltEtcBuildComponents)
74
Jiyong Parkc678ad32018-04-10 13:07:10 +090075type prebuiltEtcProperties struct {
Yo Chiang803c40d2020-11-16 20:32:51 +080076 // Source file of this prebuilt. Can reference a genrule type module with the ":module" syntax.
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +110077 // Mutually exclusive with srcs.
Cole Faustfdec8722024-05-22 11:38:29 -070078 Src proptools.Configurable[string] `android:"path,arch_variant,replace_instead_of_append"`
Jiyong Parkc678ad32018-04-10 13:07:10 +090079
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +110080 // Source files of this prebuilt. Can reference a genrule type module with the ":module" syntax.
81 // Mutually exclusive with src. When used, filename_from_src is set to true.
Cole Faustfdec8722024-05-22 11:38:29 -070082 Srcs proptools.Configurable[[]string] `android:"path,arch_variant"`
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +110083
Yo Chiangf0e19fe2020-11-18 15:28:42 +080084 // Optional name for the installed file. If unspecified, name of the module is used as the file
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +110085 // name. Only available when using a single source (src).
Jiyong Park139a2e62018-10-26 21:49:39 +090086 Filename *string `android:"arch_variant"`
87
Yo Chiangf0e19fe2020-11-18 15:28:42 +080088 // When set to true, and filename property is not set, the name for the installed file
Jiyong Park1a7cf082018-11-13 11:59:12 +090089 // is the same as the file name of the source file.
90 Filename_from_src *bool `android:"arch_variant"`
91
Yifan Hong1b3348d2020-01-21 15:53:22 -080092 // Make this module available when building for ramdisk.
Yifan Hong39143a92020-10-26 12:43:12 -070093 // On device without a dedicated recovery partition, the module is only
94 // available after switching root into
95 // /first_stage_ramdisk. To expose the module before switching root, install
96 // the recovery variant instead.
Yifan Hong1b3348d2020-01-21 15:53:22 -080097 Ramdisk_available *bool
98
Yifan Hong60e0cfb2020-10-21 15:17:56 -070099 // Make this module available when building for vendor ramdisk.
Yifan Hong39143a92020-10-26 12:43:12 -0700100 // On device without a dedicated recovery partition, the module is only
101 // available after switching root into
102 // /first_stage_ramdisk. To expose the module before switching root, install
103 // the recovery variant instead.
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700104 Vendor_ramdisk_available *bool
105
Inseob Kim08758f02021-04-08 21:13:22 +0900106 // Make this module available when building for debug ramdisk.
107 Debug_ramdisk_available *bool
108
Tao Bao0ba5c942018-08-14 22:20:22 -0700109 // Make this module available when building for recovery.
110 Recovery_available *bool
111
Jiyong Parkad9ce042018-10-31 22:49:57 +0900112 // Whether this module is directly installable to one of the partitions. Default: true.
113 Installable *bool
Yo Chiang3d64d492020-05-27 17:56:39 +0800114
115 // Install symlinks to the installed file.
116 Symlinks []string `android:"arch_variant"`
Jiyong Parkc678ad32018-04-10 13:07:10 +0900117}
118
Inseob Kim27408bf2021-04-06 21:00:17 +0900119type prebuiltSubdirProperties struct {
120 // Optional subdirectory under which this file is installed into, cannot be specified with
121 // relative_install_path, prefer relative_install_path.
122 Sub_dir *string `android:"arch_variant"`
123
124 // Optional subdirectory under which this file is installed into, cannot be specified with
125 // sub_dir.
126 Relative_install_path *string `android:"arch_variant"`
127}
128
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900129type prebuiltRootProperties struct {
130 // Install this module to the root directory, without partition subdirs. When this module is
131 // added to PRODUCT_PACKAGES, this module will be installed to $PRODUCT_OUT/root, which will
132 // then be copied to the root of system.img. When this module is packaged by other modules like
133 // android_filesystem, this module will be installed to the root ("/"), unlike normal
134 // prebuilt_root modules which are installed to the partition subdir (e.g. "/system/").
135 Install_in_root *bool
136}
137
Jooyung Han39edb6c2019-11-06 16:53:07 +0900138type PrebuiltEtcModule interface {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700139 android.Module
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800140
141 // Returns the base install directory, such as "etc", "usr/share".
Jooyung Han0703fd82020-08-26 22:11:53 +0900142 BaseDir() string
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800143
144 // Returns the sub install directory relative to BaseDir().
Jooyung Han39edb6c2019-11-06 16:53:07 +0900145 SubDir() string
Jooyung Han39edb6c2019-11-06 16:53:07 +0900146}
147
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900148type PrebuiltEtc struct {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700149 android.ModuleBase
Inseob Kim1e27a142021-05-06 11:46:11 +0000150 android.DefaultableModuleBase
Jiyong Parkc678ad32018-04-10 13:07:10 +0900151
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900152 properties prebuiltEtcProperties
153
154 // rootProperties is used to return the value of the InstallInRoot() method. Currently, only
155 // prebuilt_avb and prebuilt_root modules use this.
156 rootProperties prebuiltRootProperties
157
Inseob Kim27408bf2021-04-06 21:00:17 +0900158 subdirProperties prebuiltSubdirProperties
Jiyong Parkc678ad32018-04-10 13:07:10 +0900159
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100160 sourceFilePaths android.Paths
161 outputFilePaths android.OutputPaths
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800162 // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share.
Colin Cross2f634572023-11-13 12:12:06 -0800163 installDirBase string
164 installDirBase64 string
165 installAvoidMultilibConflict bool
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800166 // The base install location when soc_specific property is set to true, e.g. "firmware" for
167 // prebuilt_firmware.
Patrice Arruda057a8b12019-06-03 15:29:27 -0700168 socInstallDirBase string
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700169 installDirPath android.InstallPath
170 additionalDependencies *android.Paths
Colin Crossf17e2b52023-10-30 15:17:25 -0700171
Cole Faustfdec8722024-05-22 11:38:29 -0700172 usedSrcsProperty bool
173
Colin Crossf17e2b52023-10-30 15:17:25 -0700174 makeClass string
Jiyong Parkc678ad32018-04-10 13:07:10 +0900175}
176
Inseob Kim1e27a142021-05-06 11:46:11 +0000177type Defaults struct {
178 android.ModuleBase
179 android.DefaultsModuleBase
180}
181
Yifan Hong1b3348d2020-01-21 15:53:22 -0800182func (p *PrebuiltEtc) inRamdisk() bool {
183 return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk()
184}
185
186func (p *PrebuiltEtc) onlyInRamdisk() bool {
187 return p.ModuleBase.InstallInRamdisk()
188}
189
190func (p *PrebuiltEtc) InstallInRamdisk() bool {
191 return p.inRamdisk()
192}
193
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700194func (p *PrebuiltEtc) inVendorRamdisk() bool {
195 return p.ModuleBase.InVendorRamdisk() || p.ModuleBase.InstallInVendorRamdisk()
196}
197
198func (p *PrebuiltEtc) onlyInVendorRamdisk() bool {
199 return p.ModuleBase.InstallInVendorRamdisk()
200}
201
202func (p *PrebuiltEtc) InstallInVendorRamdisk() bool {
203 return p.inVendorRamdisk()
204}
205
Inseob Kim08758f02021-04-08 21:13:22 +0900206func (p *PrebuiltEtc) inDebugRamdisk() bool {
207 return p.ModuleBase.InDebugRamdisk() || p.ModuleBase.InstallInDebugRamdisk()
208}
209
210func (p *PrebuiltEtc) onlyInDebugRamdisk() bool {
211 return p.ModuleBase.InstallInDebugRamdisk()
212}
213
214func (p *PrebuiltEtc) InstallInDebugRamdisk() bool {
215 return p.inDebugRamdisk()
216}
217
Kiyoung Kimae11c232021-07-19 11:38:04 +0900218func (p *PrebuiltEtc) InRecovery() bool {
Colin Cross7228ecd2019-11-18 16:00:16 -0800219 return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery()
Tao Bao0ba5c942018-08-14 22:20:22 -0700220}
221
222func (p *PrebuiltEtc) onlyInRecovery() bool {
223 return p.ModuleBase.InstallInRecovery()
224}
225
226func (p *PrebuiltEtc) InstallInRecovery() bool {
Kiyoung Kimae11c232021-07-19 11:38:04 +0900227 return p.InRecovery()
Tao Bao0ba5c942018-08-14 22:20:22 -0700228}
229
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700230var _ android.ImageInterface = (*PrebuiltEtc)(nil)
Colin Cross7228ecd2019-11-18 16:00:16 -0800231
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700232func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.BaseModuleContext) {}
Colin Cross7228ecd2019-11-18 16:00:16 -0800233
Jihoon Kang47e91842024-06-19 00:51:16 +0000234func (p *PrebuiltEtc) VendorVariantNeeded(ctx android.BaseModuleContext) bool {
235 return false
236}
237
238func (p *PrebuiltEtc) ProductVariantNeeded(ctx android.BaseModuleContext) bool {
239 return false
240}
241
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700242func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700243 return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() &&
Inseob Kim08758f02021-04-08 21:13:22 +0900244 !p.ModuleBase.InstallInVendorRamdisk() && !p.ModuleBase.InstallInDebugRamdisk()
Yifan Hong1b3348d2020-01-21 15:53:22 -0800245}
246
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700247func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
248 return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk()
Colin Cross7228ecd2019-11-18 16:00:16 -0800249}
250
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700251func (p *PrebuiltEtc) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
252 return proptools.Bool(p.properties.Vendor_ramdisk_available) || p.ModuleBase.InstallInVendorRamdisk()
253}
254
Inseob Kim08758f02021-04-08 21:13:22 +0900255func (p *PrebuiltEtc) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
256 return proptools.Bool(p.properties.Debug_ramdisk_available) || p.ModuleBase.InstallInDebugRamdisk()
257}
258
Nelson Li1fb94b22024-07-09 17:04:52 +0800259func (p *PrebuiltEtc) InstallInRoot() bool {
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900260 return proptools.Bool(p.rootProperties.Install_in_root)
Nelson Li1fb94b22024-07-09 17:04:52 +0800261}
262
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700263func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
264 return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery()
Colin Cross7228ecd2019-11-18 16:00:16 -0800265}
266
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700267func (p *PrebuiltEtc) ExtraImageVariations(ctx android.BaseModuleContext) []string {
Colin Cross7228ecd2019-11-18 16:00:16 -0800268 return nil
269}
270
Jihoon Kang7583e832024-06-13 21:25:45 +0000271func (p *PrebuiltEtc) SetImageVariation(ctx android.BaseModuleContext, variation string) {
Colin Cross7228ecd2019-11-18 16:00:16 -0800272}
273
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700274func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path {
Cole Faustfdec8722024-05-22 11:38:29 -0700275 if len(p.properties.Srcs.GetOrDefault(ctx, nil)) > 0 {
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100276 panic(fmt.Errorf("SourceFilePath not available on multi-source prebuilt %q", p.Name()))
277 }
Cole Faustfdec8722024-05-22 11:38:29 -0700278 return android.PathForModuleSrc(ctx, p.properties.Src.GetOrDefault(ctx, ""))
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900279}
280
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700281func (p *PrebuiltEtc) InstallDirPath() android.InstallPath {
Jooyung Hana0171822019-07-22 15:48:36 +0900282 return p.installDirPath
283}
284
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900285// This allows other derivative modules (e.g. prebuilt_etc_xml) to perform
286// additional steps (like validating the src) before the file is installed.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700287func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) {
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900288 p.additionalDependencies = &paths
289}
290
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700291func (p *PrebuiltEtc) OutputFile() android.OutputPath {
Cole Faustfdec8722024-05-22 11:38:29 -0700292 if p.usedSrcsProperty {
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100293 panic(fmt.Errorf("OutputFile not available on multi-source prebuilt %q", p.Name()))
294 }
295 return p.outputFilePaths[0]
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900296}
297
298func (p *PrebuiltEtc) SubDir() string {
Inseob Kim27408bf2021-04-06 21:00:17 +0900299 if subDir := proptools.String(p.subdirProperties.Sub_dir); subDir != "" {
Liz Kammer0449a632020-06-26 10:12:36 -0700300 return subDir
301 }
Inseob Kim27408bf2021-04-06 21:00:17 +0900302 return proptools.String(p.subdirProperties.Relative_install_path)
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900303}
304
Jooyung Han0703fd82020-08-26 22:11:53 +0900305func (p *PrebuiltEtc) BaseDir() string {
Jooyung Han8e5685d2020-09-21 11:02:57 +0900306 return p.installDirBase
Jooyung Han0703fd82020-08-26 22:11:53 +0900307}
308
Jiyong Parkad9ce042018-10-31 22:49:57 +0900309func (p *PrebuiltEtc) Installable() bool {
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800310 return p.properties.Installable == nil || proptools.Bool(p.properties.Installable)
Jiyong Parkad9ce042018-10-31 22:49:57 +0900311}
312
Kiyoung Kimae11c232021-07-19 11:38:04 +0900313func (p *PrebuiltEtc) InVendor() bool {
314 return p.ModuleBase.InstallInVendor()
315}
316
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100317func (p *PrebuiltEtc) installBaseDir(ctx android.ModuleContext) string {
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800318 // If soc install dir was specified and SOC specific is set, set the installDirPath to the
319 // specified socInstallDirBase.
Jooyung Han8e5685d2020-09-21 11:02:57 +0900320 installBaseDir := p.installDirBase
Colin Crossf17e2b52023-10-30 15:17:25 -0700321 if p.Target().Arch.ArchType.Multilib == "lib64" && p.installDirBase64 != "" {
322 installBaseDir = p.installDirBase64
323 }
Jooyung Han8e5685d2020-09-21 11:02:57 +0900324 if p.SocSpecific() && p.socInstallDirBase != "" {
325 installBaseDir = p.socInstallDirBase
326 }
Colin Cross2f634572023-11-13 12:12:06 -0800327 if p.installAvoidMultilibConflict && !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
328 installBaseDir = filepath.Join(installBaseDir, ctx.Arch().ArchType.String())
329 }
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100330 return installBaseDir
331}
Colin Cross2f634572023-11-13 12:12:06 -0800332
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100333func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
334 var installs []installProperties
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900335
Cole Faustfdec8722024-05-22 11:38:29 -0700336 srcProperty := p.properties.Src.Get(ctx)
337 srcsProperty := p.properties.Srcs.GetOrDefault(ctx, nil)
338 if srcProperty.IsPresent() && len(srcsProperty) > 0 {
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100339 ctx.PropertyErrorf("src", "src is set. Cannot set srcs")
Spandan Das756d3402023-06-05 22:49:50 +0000340 }
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100341
342 // Check that `sub_dir` and `relative_install_path` are not set at the same time.
343 if p.subdirProperties.Sub_dir != nil && p.subdirProperties.Relative_install_path != nil {
344 ctx.PropertyErrorf("sub_dir", "relative_install_path is set. Cannot set sub_dir")
345 }
346 p.installDirPath = android.PathForModuleInstall(ctx, p.installBaseDir(ctx), p.SubDir())
347
348 filename := proptools.String(p.properties.Filename)
349 filenameFromSrc := proptools.Bool(p.properties.Filename_from_src)
Cole Faustfdec8722024-05-22 11:38:29 -0700350 if srcProperty.IsPresent() {
351 p.sourceFilePaths = android.PathsForModuleSrc(ctx, []string{srcProperty.Get()})
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100352 // If the source was not found, set a fake source path to
353 // support AllowMissingDependencies executions.
354 if len(p.sourceFilePaths) == 0 {
355 p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)}
356 }
357
358 // Determine the output file basename.
359 // If Filename is set, use the name specified by the property.
360 // If Filename_from_src is set, use the source file name.
361 // Otherwise use the module name.
362 if filename != "" {
363 if filenameFromSrc {
364 ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true")
365 return
366 }
367 } else if filenameFromSrc {
368 filename = p.sourceFilePaths[0].Base()
369 } else {
370 filename = ctx.ModuleName()
371 }
372 if strings.Contains(filename, "/") {
373 ctx.PropertyErrorf("filename", "filename cannot contain separator '/'")
374 return
375 }
376 p.outputFilePaths = android.OutputPaths{android.PathForModuleOut(ctx, filename).OutputPath}
377
378 ip := installProperties{
379 filename: filename,
380 sourceFilePath: p.sourceFilePaths[0],
381 outputFilePath: p.outputFilePaths[0],
382 installDirPath: p.installDirPath,
383 symlinks: p.properties.Symlinks,
384 }
385 installs = append(installs, ip)
Cole Faustfdec8722024-05-22 11:38:29 -0700386 } else if len(srcsProperty) > 0 {
387 p.usedSrcsProperty = true
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100388 if filename != "" {
389 ctx.PropertyErrorf("filename", "filename cannot be set when using srcs")
390 }
391 if len(p.properties.Symlinks) > 0 {
392 ctx.PropertyErrorf("symlinks", "symlinks cannot be set when using srcs")
393 }
394 if p.properties.Filename_from_src != nil {
395 ctx.PropertyErrorf("filename_from_src", "filename_from_src is implicitly set to true when using srcs")
396 }
Cole Faustfdec8722024-05-22 11:38:29 -0700397 p.sourceFilePaths = android.PathsForModuleSrc(ctx, srcsProperty)
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100398 for _, src := range p.sourceFilePaths {
399 filename := src.Base()
400 output := android.PathForModuleOut(ctx, filename).OutputPath
401 ip := installProperties{
402 filename: filename,
403 sourceFilePath: src,
404 outputFilePath: output,
405 installDirPath: p.installDirPath,
406 }
407 p.outputFilePaths = append(p.outputFilePaths, output)
408 installs = append(installs, ip)
409 }
410 } else if ctx.Config().AllowMissingDependencies() {
411 // If no srcs was set and AllowMissingDependencies is enabled then
412 // mark the module as missing dependencies and set a fake source path
413 // and file name.
414 ctx.AddMissingDependencies([]string{"MISSING_PREBUILT_SRC_FILE"})
415 p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)}
416 if filename == "" {
417 filename = ctx.ModuleName()
418 }
419 p.outputFilePaths = android.OutputPaths{android.PathForModuleOut(ctx, filename).OutputPath}
420 ip := installProperties{
421 filename: filename,
422 sourceFilePath: p.sourceFilePaths[0],
423 outputFilePath: p.outputFilePaths[0],
424 installDirPath: p.installDirPath,
425 }
426 installs = append(installs, ip)
427 } else {
428 ctx.PropertyErrorf("src", "missing prebuilt source file")
429 return
430 }
431
432 // Call InstallFile even when uninstallable to make the module included in the package.
433 if !p.Installable() {
434 p.SkipInstall()
435 }
436 for _, ip := range installs {
437 ip.addInstallRules(ctx)
438 }
mrziwang89371762024-06-11 12:42:24 -0700439
440 ctx.SetOutputFiles(p.outputFilePaths.Paths(), "")
Spandan Das756d3402023-06-05 22:49:50 +0000441}
Jiyong Parkf9f68052020-09-29 20:15:08 +0900442
Spandan Das756d3402023-06-05 22:49:50 +0000443type installProperties struct {
Spandan Das756d3402023-06-05 22:49:50 +0000444 filename string
445 sourceFilePath android.Path
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100446 outputFilePath android.OutputPath
447 installDirPath android.InstallPath
Spandan Das756d3402023-06-05 22:49:50 +0000448 symlinks []string
449}
450
451// utility function to add install rules to the build graph.
452// Reduces code duplication between Soong and Mixed build analysis
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100453func (ip *installProperties) addInstallRules(ctx android.ModuleContext) {
Spandan Das756d3402023-06-05 22:49:50 +0000454 // Copy the file from src to a location in out/ with the correct `filename`
455 // This ensures that outputFilePath has the correct name for others to
456 // use, as the source file may have a different name.
Spandan Das756d3402023-06-05 22:49:50 +0000457 ctx.Build(pctx, android.BuildParams{
458 Rule: android.Cp,
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100459 Output: ip.outputFilePath,
Spandan Das756d3402023-06-05 22:49:50 +0000460 Input: ip.sourceFilePath,
461 })
462
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100463 installPath := ctx.InstallFile(ip.installDirPath, ip.filename, ip.outputFilePath)
Spandan Das756d3402023-06-05 22:49:50 +0000464 for _, sl := range ip.symlinks {
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100465 ctx.InstallSymlink(ip.installDirPath, sl, installPath)
Jiyong Parkf9f68052020-09-29 20:15:08 +0900466 }
Jiyong Parkc678ad32018-04-10 13:07:10 +0900467}
468
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700469func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries {
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700470 nameSuffix := ""
Yifan Hong1b3348d2020-01-21 15:53:22 -0800471 if p.inRamdisk() && !p.onlyInRamdisk() {
472 nameSuffix = ".ramdisk"
473 }
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700474 if p.inVendorRamdisk() && !p.onlyInVendorRamdisk() {
475 nameSuffix = ".vendor_ramdisk"
476 }
Inseob Kim08758f02021-04-08 21:13:22 +0900477 if p.inDebugRamdisk() && !p.onlyInDebugRamdisk() {
478 nameSuffix = ".debug_ramdisk"
479 }
Kiyoung Kimae11c232021-07-19 11:38:04 +0900480 if p.InRecovery() && !p.onlyInRecovery() {
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700481 nameSuffix = ".recovery"
482 }
Colin Crossf17e2b52023-10-30 15:17:25 -0700483
484 class := p.makeClass
485 if class == "" {
486 class = "ETC"
487 }
488
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100489 return []android.AndroidMkEntries{{
Colin Crossf17e2b52023-10-30 15:17:25 -0700490 Class: class,
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700491 SubName: nameSuffix,
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100492 OutputFile: android.OptionalPathForPath(p.outputFilePaths[0]),
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700493 ExtraEntries: []android.AndroidMkExtraEntriesFunc{
Colin Crossaa255532020-07-03 13:18:24 -0700494 func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700495 entries.SetString("LOCAL_MODULE_TAGS", "optional")
Colin Crossc68db4b2021-11-11 18:59:15 -0800496 entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.String())
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100497 entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePaths[0].Base())
Yo Chiang3d64d492020-05-27 17:56:39 +0800498 if len(p.properties.Symlinks) > 0 {
499 entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...)
500 }
Yo Chiang803c40d2020-11-16 20:32:51 +0800501 entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.Installable())
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700502 if p.additionalDependencies != nil {
Yo Chiang803c40d2020-11-16 20:32:51 +0800503 entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", p.additionalDependencies.Strings()...)
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900504 }
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700505 },
Jiyong Parkc678ad32018-04-10 13:07:10 +0900506 },
Jiyong Park0b0e1b92019-12-03 13:24:29 +0900507 }}
Jiyong Parkc678ad32018-04-10 13:07:10 +0900508}
509
LaMont Jonesafe7baf2024-01-09 22:47:39 +0000510func (p *PrebuiltEtc) AndroidModuleBase() *android.ModuleBase {
511 return &p.ModuleBase
512}
513
Jooyung Hana0171822019-07-22 15:48:36 +0900514func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {
515 p.installDirBase = dirBase
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900516 p.AddProperties(&p.properties)
Inseob Kim27408bf2021-04-06 21:00:17 +0900517 p.AddProperties(&p.subdirProperties)
518}
519
520func InitPrebuiltRootModule(p *PrebuiltEtc) {
521 p.installDirBase = "."
Nelson Li1fb94b22024-07-09 17:04:52 +0800522 p.AddProperties(&p.properties)
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900523 p.AddProperties(&p.rootProperties)
Nelson Li1fb94b22024-07-09 17:04:52 +0800524}
525
526func InitPrebuiltAvbModule(p *PrebuiltEtc) {
527 p.installDirBase = "avb"
Inseob Kim27408bf2021-04-06 21:00:17 +0900528 p.AddProperties(&p.properties)
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900529 p.rootProperties.Install_in_root = proptools.BoolPtr(true)
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900530}
Jiyong Parkc678ad32018-04-10 13:07:10 +0900531
Patrice Arruda9e14b962019-03-11 15:58:50 -0700532// prebuilt_etc is for a prebuilt artifact that is installed in
533// <partition>/etc/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700534func PrebuiltEtcFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900535 module := &PrebuiltEtc{}
536 InitPrebuiltEtcModule(module, "etc")
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900537 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700538 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Inseob Kim1e27a142021-05-06 11:46:11 +0000539 android.InitDefaultableModule(module)
540 return module
541}
542
543func defaultsFactory() android.Module {
544 return DefaultsFactory()
545}
546
547func DefaultsFactory(props ...interface{}) android.Module {
548 module := &Defaults{}
549
550 module.AddProperties(props...)
551 module.AddProperties(
552 &prebuiltEtcProperties{},
553 &prebuiltSubdirProperties{},
554 )
555
556 android.InitDefaultsModule(module)
557
Jiyong Parkc678ad32018-04-10 13:07:10 +0900558 return module
559}
Tao Bao0ba5c942018-08-14 22:20:22 -0700560
Patrice Arruda9e14b962019-03-11 15:58:50 -0700561// prebuilt_etc_host is for a host prebuilt artifact that is installed in
562// $(HOST_OUT)/etc/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700563func PrebuiltEtcHostFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900564 module := &PrebuiltEtc{}
565 InitPrebuiltEtcModule(module, "etc")
Jaewoong Jung24788182019-02-04 14:34:10 -0800566 // This module is host-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700567 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100568 android.InitDefaultableModule(module)
Jaewoong Jung24788182019-02-04 14:34:10 -0800569 return module
570}
571
Miguel32b02802022-12-01 18:38:26 +0000572// prebuilt_etc_host is for a host prebuilt artifact that is installed in
573// <partition>/etc/<sub_dir> directory.
574func PrebuiltEtcCaCertsFactory() android.Module {
575 module := &PrebuiltEtc{}
576 InitPrebuiltEtcModule(module, "cacerts")
577 // This module is device-only
578 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Miguel32b02802022-12-01 18:38:26 +0000579 return module
580}
581
Nelson Li1fb94b22024-07-09 17:04:52 +0800582// Generally, a <partition> directory will contain a `system` subdirectory, but the <partition> of
583// `prebuilt_avb` will not have a `system` subdirectory.
584// Ultimately, prebuilt_avb will install the prebuilt artifact to the `avb` subdirectory under the
585// root directory of the partition: <partition_root>/avb.
586// prebuilt_avb does not allow adding any other subdirectories.
587func PrebuiltAvbFactory() android.Module {
588 module := &PrebuiltEtc{}
589 InitPrebuiltAvbModule(module)
590 // This module is device-only
591 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
592 android.InitDefaultableModule(module)
593 return module
594}
595
Inseob Kim27408bf2021-04-06 21:00:17 +0900596// prebuilt_root is for a prebuilt artifact that is installed in
597// <partition>/ directory. Can't have any sub directories.
598func PrebuiltRootFactory() android.Module {
599 module := &PrebuiltEtc{}
600 InitPrebuiltRootModule(module)
601 // This module is device-only
602 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100603 android.InitDefaultableModule(module)
Inseob Kim27408bf2021-04-06 21:00:17 +0900604 return module
605}
606
Liz Kammere9ecddc2022-01-04 17:27:52 -0500607// prebuilt_root_host is for a host prebuilt artifact that is installed in $(HOST_OUT)/<sub_dir>
608// directory.
609func PrebuiltRootHostFactory() android.Module {
610 module := &PrebuiltEtc{}
611 InitPrebuiltEtcModule(module, ".")
612 // This module is host-only
613 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
614 android.InitDefaultableModule(module)
615 return module
616}
617
Patrice Arruda9e14b962019-03-11 15:58:50 -0700618// prebuilt_usr_share is for a prebuilt artifact that is installed in
619// <partition>/usr/share/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700620func PrebuiltUserShareFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900621 module := &PrebuiltEtc{}
622 InitPrebuiltEtcModule(module, "usr/share")
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800623 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700624 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100625 android.InitDefaultableModule(module)
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800626 return module
627}
628
Patrice Arruda9e14b962019-03-11 15:58:50 -0700629// prebuild_usr_share_host is for a host prebuilt artifact that is installed in
630// $(HOST_OUT)/usr/share/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700631func PrebuiltUserShareHostFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900632 module := &PrebuiltEtc{}
633 InitPrebuiltEtcModule(module, "usr/share")
Patrice Arruda300cef92019-02-22 15:47:57 -0800634 // This module is host-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700635 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100636 android.InitDefaultableModule(module)
Patrice Arruda300cef92019-02-22 15:47:57 -0800637 return module
638}
639
yangbill63c5e192024-03-27 09:02:12 +0000640// prebuilt_usr_hyphendata is for a prebuilt artifact that is installed in
641// <partition>/usr/hyphen-data/<sub_dir> directory.
642func PrebuiltUserHyphenDataFactory() android.Module {
643 module := &PrebuiltEtc{}
644 InitPrebuiltEtcModule(module, "usr/hyphen-data")
645 // This module is device-only
646 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
647 android.InitDefaultableModule(module)
648 return module
649}
650
yangbill85527e62024-04-30 08:24:50 +0000651// prebuilt_usr_keylayout is for a prebuilt artifact that is installed in
652// <partition>/usr/keylayout/<sub_dir> directory.
653func PrebuiltUserKeyLayoutFactory() android.Module {
654 module := &PrebuiltEtc{}
655 InitPrebuiltEtcModule(module, "usr/keylayout")
656 // This module is device-only
657 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
658 android.InitDefaultableModule(module)
659 return module
660}
661
662// prebuilt_usr_keychars is for a prebuilt artifact that is installed in
663// <partition>/usr/keychars/<sub_dir> directory.
664func PrebuiltUserKeyCharsFactory() android.Module {
665 module := &PrebuiltEtc{}
666 InitPrebuiltEtcModule(module, "usr/keychars")
667 // This module is device-only
668 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
669 android.InitDefaultableModule(module)
670 return module
671}
672
673// prebuilt_usr_idc is for a prebuilt artifact that is installed in
674// <partition>/usr/idc/<sub_dir> directory.
675func PrebuiltUserIdcFactory() android.Module {
676 module := &PrebuiltEtc{}
677 InitPrebuiltEtcModule(module, "usr/idc")
678 // This module is device-only
679 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
680 android.InitDefaultableModule(module)
681 return module
682}
683
Patrice Arruda61583eb2019-05-14 08:20:45 -0700684// prebuilt_font installs a font in <partition>/fonts directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700685func PrebuiltFontFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900686 module := &PrebuiltEtc{}
687 InitPrebuiltEtcModule(module, "fonts")
Patrice Arruda61583eb2019-05-14 08:20:45 -0700688 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700689 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100690 android.InitDefaultableModule(module)
Patrice Arruda61583eb2019-05-14 08:20:45 -0700691 return module
692}
Patrice Arruda057a8b12019-06-03 15:29:27 -0700693
Kevin93f7cd82024-05-02 12:37:59 +0200694// prebuilt_overlay is for a prebuilt artifact in <partition>/overlay directory.
695func PrebuiltOverlayFactory() android.Module {
696 module := &PrebuiltEtc{}
697 InitPrebuiltEtcModule(module, "overlay")
698 // This module is device-only
699 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
700 return module
701}
702
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800703// prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system
704// image.
705// If soc_specific property is set to true, the firmware file is installed to the
706// vendor <partition>/firmware directory for vendor image.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700707func PrebuiltFirmwareFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900708 module := &PrebuiltEtc{}
709 module.socInstallDirBase = "firmware"
710 InitPrebuiltEtcModule(module, "etc/firmware")
Patrice Arruda057a8b12019-06-03 15:29:27 -0700711 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700712 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100713 android.InitDefaultableModule(module)
Patrice Arruda057a8b12019-06-03 15:29:27 -0700714 return module
715}
Patrice Arruda0f688002020-06-08 21:40:25 +0000716
717// prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image.
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800718// If soc_specific property is set to true, the DSP related file is installed to the
719// vendor <partition>/dsp directory for vendor image.
Patrice Arruda0f688002020-06-08 21:40:25 +0000720func PrebuiltDSPFactory() android.Module {
721 module := &PrebuiltEtc{}
722 module.socInstallDirBase = "dsp"
723 InitPrebuiltEtcModule(module, "etc/dsp")
724 // This module is device-only
725 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100726 android.InitDefaultableModule(module)
Patrice Arruda0f688002020-06-08 21:40:25 +0000727 return module
728}
Colin Cross83ebf232021-04-09 09:41:23 -0700729
Colin Crossf17e2b52023-10-30 15:17:25 -0700730// prebuilt_renderscript_bitcode installs a *.bc file into /system/lib or /system/lib64.
731func PrebuiltRenderScriptBitcodeFactory() android.Module {
732 module := &PrebuiltEtc{}
733 module.makeClass = "RENDERSCRIPT_BITCODE"
734 module.installDirBase64 = "lib64"
Colin Cross2f634572023-11-13 12:12:06 -0800735 module.installAvoidMultilibConflict = true
Colin Crossf17e2b52023-10-30 15:17:25 -0700736 InitPrebuiltEtcModule(module, "lib")
737 // This module is device-only
738 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth)
739 android.InitDefaultableModule(module)
740 return module
741}
742
Colin Cross83ebf232021-04-09 09:41:23 -0700743// prebuilt_rfsa installs a firmware file that will be available through Qualcomm's RFSA
744// to the <partition>/lib/rfsa directory.
745func PrebuiltRFSAFactory() android.Module {
746 module := &PrebuiltEtc{}
747 // Ideally these would go in /vendor/dsp, but the /vendor/lib/rfsa paths are hardcoded in too
748 // many places outside of the application processor. They could be moved to /vendor/dsp once
749 // that is cleaned up.
750 InitPrebuiltEtcModule(module, "lib/rfsa")
751 // This module is device-only
752 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100753 android.InitDefaultableModule(module)
Colin Cross83ebf232021-04-09 09:41:23 -0700754 return module
755}