blob: 44b81495451aa3edfcb806b30f2cf9b5a100dec3 [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
Jaewoong Jung4b79e982020-06-01 10:45:49 -070017import (
18 "strconv"
19
20 "github.com/google/blueprint/proptools"
21
22 "android/soong/android"
23)
24
25var pctx = android.NewPackageContext("android/soong/etc")
Jiyong Parkc678ad32018-04-10 13:07:10 +090026
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -080027// TODO(jungw): Now that it handles more than the ones in etc/, consider renaming this file.
Jiyong Parkc678ad32018-04-10 13:07:10 +090028
29func init() {
Jaewoong Jung4b79e982020-06-01 10:45:49 -070030 pctx.Import("android/soong/android")
Jooyung Han0703fd82020-08-26 22:11:53 +090031 RegisterPrebuiltEtcBuildComponents(android.InitRegistrationContext)
32}
Jaewoong Jung4b79e982020-06-01 10:45:49 -070033
Jooyung Han0703fd82020-08-26 22:11:53 +090034func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) {
35 ctx.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory)
36 ctx.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
37 ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
38 ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
39 ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
40 ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
41 ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory)
Jiyong Parkc678ad32018-04-10 13:07:10 +090042}
43
44type prebuiltEtcProperties struct {
45 // Source file of this prebuilt.
Colin Cross27b922f2019-03-04 22:35:41 -080046 Src *string `android:"path,arch_variant"`
Jiyong Parkc678ad32018-04-10 13:07:10 +090047
Liz Kammer0449a632020-06-26 10:12:36 -070048 // optional subdirectory under which this file is installed into, cannot be specified with relative_install_path, prefer relative_install_path
Jiyong Parkc678ad32018-04-10 13:07:10 +090049 Sub_dir *string `android:"arch_variant"`
Tao Bao0ba5c942018-08-14 22:20:22 -070050
Liz Kammer0449a632020-06-26 10:12:36 -070051 // optional subdirectory under which this file is installed into, cannot be specified with sub_dir
52 Relative_install_path *string `android:"arch_variant"`
53
Jiyong Park139a2e62018-10-26 21:49:39 +090054 // optional name for the installed file. If unspecified, name of the module is used as the file name
55 Filename *string `android:"arch_variant"`
56
Jiyong Park1a7cf082018-11-13 11:59:12 +090057 // when set to true, and filename property is not set, the name for the installed file
58 // is the same as the file name of the source file.
59 Filename_from_src *bool `android:"arch_variant"`
60
Yifan Hong1b3348d2020-01-21 15:53:22 -080061 // Make this module available when building for ramdisk.
Yifan Hong39143a92020-10-26 12:43:12 -070062 // On device without a dedicated recovery partition, the module is only
63 // available after switching root into
64 // /first_stage_ramdisk. To expose the module before switching root, install
65 // the recovery variant instead.
Yifan Hong1b3348d2020-01-21 15:53:22 -080066 Ramdisk_available *bool
67
Yifan Hong60e0cfb2020-10-21 15:17:56 -070068 // Make this module available when building for vendor ramdisk.
Yifan Hong39143a92020-10-26 12:43:12 -070069 // On device without a dedicated recovery partition, the module is only
70 // available after switching root into
71 // /first_stage_ramdisk. To expose the module before switching root, install
72 // the recovery variant instead.
Yifan Hong60e0cfb2020-10-21 15:17:56 -070073 Vendor_ramdisk_available *bool
74
Tao Bao0ba5c942018-08-14 22:20:22 -070075 // Make this module available when building for recovery.
76 Recovery_available *bool
77
Jiyong Parkad9ce042018-10-31 22:49:57 +090078 // Whether this module is directly installable to one of the partitions. Default: true.
79 Installable *bool
Yo Chiang3d64d492020-05-27 17:56:39 +080080
81 // Install symlinks to the installed file.
82 Symlinks []string `android:"arch_variant"`
Jiyong Parkc678ad32018-04-10 13:07:10 +090083}
84
Jooyung Han39edb6c2019-11-06 16:53:07 +090085type PrebuiltEtcModule interface {
Jaewoong Jung4b79e982020-06-01 10:45:49 -070086 android.Module
Jooyung Han0703fd82020-08-26 22:11:53 +090087 BaseDir() string
Jooyung Han39edb6c2019-11-06 16:53:07 +090088 SubDir() string
Jaewoong Jung4b79e982020-06-01 10:45:49 -070089 OutputFile() android.OutputPath
Jooyung Han39edb6c2019-11-06 16:53:07 +090090}
91
Jiyong Park5a8d1be2018-04-25 22:57:34 +090092type PrebuiltEtc struct {
Jaewoong Jung4b79e982020-06-01 10:45:49 -070093 android.ModuleBase
Jiyong Parkc678ad32018-04-10 13:07:10 +090094
95 properties prebuiltEtcProperties
96
Jaewoong Jung4b79e982020-06-01 10:45:49 -070097 sourceFilePath android.Path
98 outputFilePath android.OutputPath
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -080099 // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share.
Patrice Arruda057a8b12019-06-03 15:29:27 -0700100 installDirBase string
101 // The base install location when soc_specific property is set to true, e.g. "firmware" for prebuilt_firmware.
102 socInstallDirBase string
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700103 installDirPath android.InstallPath
104 additionalDependencies *android.Paths
Jiyong Parkc678ad32018-04-10 13:07:10 +0900105}
106
Yifan Hong1b3348d2020-01-21 15:53:22 -0800107func (p *PrebuiltEtc) inRamdisk() bool {
108 return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk()
109}
110
111func (p *PrebuiltEtc) onlyInRamdisk() bool {
112 return p.ModuleBase.InstallInRamdisk()
113}
114
115func (p *PrebuiltEtc) InstallInRamdisk() bool {
116 return p.inRamdisk()
117}
118
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700119func (p *PrebuiltEtc) inVendorRamdisk() bool {
120 return p.ModuleBase.InVendorRamdisk() || p.ModuleBase.InstallInVendorRamdisk()
121}
122
123func (p *PrebuiltEtc) onlyInVendorRamdisk() bool {
124 return p.ModuleBase.InstallInVendorRamdisk()
125}
126
127func (p *PrebuiltEtc) InstallInVendorRamdisk() bool {
128 return p.inVendorRamdisk()
129}
130
Tao Bao0ba5c942018-08-14 22:20:22 -0700131func (p *PrebuiltEtc) inRecovery() bool {
Colin Cross7228ecd2019-11-18 16:00:16 -0800132 return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery()
Tao Bao0ba5c942018-08-14 22:20:22 -0700133}
134
135func (p *PrebuiltEtc) onlyInRecovery() bool {
136 return p.ModuleBase.InstallInRecovery()
137}
138
139func (p *PrebuiltEtc) InstallInRecovery() bool {
140 return p.inRecovery()
141}
142
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700143var _ android.ImageInterface = (*PrebuiltEtc)(nil)
Colin Cross7228ecd2019-11-18 16:00:16 -0800144
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700145func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.BaseModuleContext) {}
Colin Cross7228ecd2019-11-18 16:00:16 -0800146
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700147func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700148 return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() &&
149 !p.ModuleBase.InstallInVendorRamdisk()
Yifan Hong1b3348d2020-01-21 15:53:22 -0800150}
151
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700152func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
153 return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk()
Colin Cross7228ecd2019-11-18 16:00:16 -0800154}
155
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700156func (p *PrebuiltEtc) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
157 return proptools.Bool(p.properties.Vendor_ramdisk_available) || p.ModuleBase.InstallInVendorRamdisk()
158}
159
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700160func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
161 return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery()
Colin Cross7228ecd2019-11-18 16:00:16 -0800162}
163
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700164func (p *PrebuiltEtc) ExtraImageVariations(ctx android.BaseModuleContext) []string {
Colin Cross7228ecd2019-11-18 16:00:16 -0800165 return nil
166}
167
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700168func (p *PrebuiltEtc) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
Colin Cross7228ecd2019-11-18 16:00:16 -0800169}
170
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700171func (p *PrebuiltEtc) DepsMutator(ctx android.BottomUpMutatorContext) {
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900172 if p.properties.Src == nil {
173 ctx.PropertyErrorf("src", "missing prebuilt source file")
Jiyong Parkc678ad32018-04-10 13:07:10 +0900174 }
Jiyong Parkc678ad32018-04-10 13:07:10 +0900175}
176
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700177func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path {
178 return android.PathForModuleSrc(ctx, android.String(p.properties.Src))
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900179}
180
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700181func (p *PrebuiltEtc) InstallDirPath() android.InstallPath {
Jooyung Hana0171822019-07-22 15:48:36 +0900182 return p.installDirPath
183}
184
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900185// This allows other derivative modules (e.g. prebuilt_etc_xml) to perform
186// additional steps (like validating the src) before the file is installed.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700187func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) {
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900188 p.additionalDependencies = &paths
189}
190
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700191func (p *PrebuiltEtc) OutputFile() android.OutputPath {
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900192 return p.outputFilePath
193}
194
195func (p *PrebuiltEtc) SubDir() string {
Liz Kammer0449a632020-06-26 10:12:36 -0700196 if subDir := proptools.String(p.properties.Sub_dir); subDir != "" {
197 return subDir
198 }
199 return proptools.String(p.properties.Relative_install_path)
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900200}
201
Jooyung Han0703fd82020-08-26 22:11:53 +0900202func (p *PrebuiltEtc) BaseDir() string {
Jooyung Han8e5685d2020-09-21 11:02:57 +0900203 return p.installDirBase
Jooyung Han0703fd82020-08-26 22:11:53 +0900204}
205
Jiyong Parkad9ce042018-10-31 22:49:57 +0900206func (p *PrebuiltEtc) Installable() bool {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700207 return p.properties.Installable == nil || android.Bool(p.properties.Installable)
Jiyong Parkad9ce042018-10-31 22:49:57 +0900208}
209
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700210func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
211 p.sourceFilePath = android.PathForModuleSrc(ctx, android.String(p.properties.Src))
212 filename := android.String(p.properties.Filename)
213 filename_from_src := android.Bool(p.properties.Filename_from_src)
Jiyong Park139a2e62018-10-26 21:49:39 +0900214 if filename == "" {
Jiyong Park1a7cf082018-11-13 11:59:12 +0900215 if filename_from_src {
216 filename = p.sourceFilePath.Base()
217 } else {
218 filename = ctx.ModuleName()
219 }
220 } else if filename_from_src {
221 ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true")
222 return
Jiyong Park139a2e62018-10-26 21:49:39 +0900223 }
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700224 p.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath
Patrice Arruda057a8b12019-06-03 15:29:27 -0700225
Liz Kammer0449a632020-06-26 10:12:36 -0700226 if p.properties.Sub_dir != nil && p.properties.Relative_install_path != nil {
227 ctx.PropertyErrorf("sub_dir", "relative_install_path is set. Cannot set sub_dir")
228 }
229
Jooyung Han8e5685d2020-09-21 11:02:57 +0900230 // If soc install dir was specified and SOC specific is set, set the installDirPath to the specified
231 // socInstallDirBase.
232 installBaseDir := p.installDirBase
233 if p.SocSpecific() && p.socInstallDirBase != "" {
234 installBaseDir = p.socInstallDirBase
235 }
236 p.installDirPath = android.PathForModuleInstall(ctx, installBaseDir, p.SubDir())
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900237
Dan Willemsenb0552672019-01-25 16:04:11 -0800238 // This ensures that outputFilePath has the correct name for others to
239 // use, as the source file may have a different name.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700240 ctx.Build(pctx, android.BuildParams{
241 Rule: android.Cp,
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900242 Output: p.outputFilePath,
243 Input: p.sourceFilePath,
244 })
Jiyong Parkf9f68052020-09-29 20:15:08 +0900245
246 if p.Installable() {
247 installPath := ctx.InstallFile(p.installDirPath, p.outputFilePath.Base(), p.outputFilePath)
248 for _, sl := range p.properties.Symlinks {
249 ctx.InstallSymlink(p.installDirPath, sl, installPath)
250 }
251 }
Jiyong Parkc678ad32018-04-10 13:07:10 +0900252}
253
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700254func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries {
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700255 nameSuffix := ""
Yifan Hong1b3348d2020-01-21 15:53:22 -0800256 if p.inRamdisk() && !p.onlyInRamdisk() {
257 nameSuffix = ".ramdisk"
258 }
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700259 if p.inVendorRamdisk() && !p.onlyInVendorRamdisk() {
260 nameSuffix = ".vendor_ramdisk"
261 }
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700262 if p.inRecovery() && !p.onlyInRecovery() {
263 nameSuffix = ".recovery"
264 }
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700265 return []android.AndroidMkEntries{android.AndroidMkEntries{
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700266 Class: "ETC",
267 SubName: nameSuffix,
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700268 OutputFile: android.OptionalPathForPath(p.outputFilePath),
269 ExtraEntries: []android.AndroidMkExtraEntriesFunc{
270 func(entries *android.AndroidMkEntries) {
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700271 entries.SetString("LOCAL_MODULE_TAGS", "optional")
Colin Crossff6c33d2019-10-02 16:01:35 -0700272 entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String())
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700273 entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base())
Yo Chiang3d64d492020-05-27 17:56:39 +0800274 if len(p.properties.Symlinks) > 0 {
275 entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...)
276 }
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700277 entries.SetString("LOCAL_UNINSTALLABLE_MODULE", strconv.FormatBool(!p.Installable()))
278 if p.additionalDependencies != nil {
279 for _, path := range *p.additionalDependencies {
Yo Chiang3d64d492020-05-27 17:56:39 +0800280 entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", path.String())
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700281 }
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900282 }
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700283 },
Jiyong Parkc678ad32018-04-10 13:07:10 +0900284 },
Jiyong Park0b0e1b92019-12-03 13:24:29 +0900285 }}
Jiyong Parkc678ad32018-04-10 13:07:10 +0900286}
287
Jooyung Hana0171822019-07-22 15:48:36 +0900288func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {
289 p.installDirBase = dirBase
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900290 p.AddProperties(&p.properties)
291}
Jiyong Parkc678ad32018-04-10 13:07:10 +0900292
Patrice Arruda9e14b962019-03-11 15:58:50 -0700293// prebuilt_etc is for a prebuilt artifact that is installed in
294// <partition>/etc/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700295func PrebuiltEtcFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900296 module := &PrebuiltEtc{}
297 InitPrebuiltEtcModule(module, "etc")
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900298 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700299 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Jiyong Parkc678ad32018-04-10 13:07:10 +0900300 return module
301}
Tao Bao0ba5c942018-08-14 22:20:22 -0700302
Patrice Arruda9e14b962019-03-11 15:58:50 -0700303// prebuilt_etc_host is for a host prebuilt artifact that is installed in
304// $(HOST_OUT)/etc/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700305func PrebuiltEtcHostFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900306 module := &PrebuiltEtc{}
307 InitPrebuiltEtcModule(module, "etc")
Jaewoong Jung24788182019-02-04 14:34:10 -0800308 // This module is host-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700309 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
Jaewoong Jung24788182019-02-04 14:34:10 -0800310 return module
311}
312
Patrice Arruda9e14b962019-03-11 15:58:50 -0700313// prebuilt_usr_share is for a prebuilt artifact that is installed in
314// <partition>/usr/share/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700315func PrebuiltUserShareFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900316 module := &PrebuiltEtc{}
317 InitPrebuiltEtcModule(module, "usr/share")
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800318 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700319 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800320 return module
321}
322
Patrice Arruda9e14b962019-03-11 15:58:50 -0700323// prebuild_usr_share_host is for a host prebuilt artifact that is installed in
324// $(HOST_OUT)/usr/share/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700325func PrebuiltUserShareHostFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900326 module := &PrebuiltEtc{}
327 InitPrebuiltEtcModule(module, "usr/share")
Patrice Arruda300cef92019-02-22 15:47:57 -0800328 // This module is host-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700329 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
Patrice Arruda300cef92019-02-22 15:47:57 -0800330 return module
331}
332
Patrice Arruda61583eb2019-05-14 08:20:45 -0700333// prebuilt_font installs a font in <partition>/fonts directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700334func PrebuiltFontFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900335 module := &PrebuiltEtc{}
336 InitPrebuiltEtcModule(module, "fonts")
Patrice Arruda61583eb2019-05-14 08:20:45 -0700337 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700338 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Patrice Arruda61583eb2019-05-14 08:20:45 -0700339 return module
340}
Patrice Arruda057a8b12019-06-03 15:29:27 -0700341
342// prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system image.
343// If soc_specific property is set to true, the firmware file is installed to the vendor <partition>/firmware
344// directory for vendor image.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700345func PrebuiltFirmwareFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900346 module := &PrebuiltEtc{}
347 module.socInstallDirBase = "firmware"
348 InitPrebuiltEtcModule(module, "etc/firmware")
Patrice Arruda057a8b12019-06-03 15:29:27 -0700349 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700350 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Patrice Arruda057a8b12019-06-03 15:29:27 -0700351 return module
352}
Patrice Arruda0f688002020-06-08 21:40:25 +0000353
354// prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image.
355// If soc_specific property is set to true, the DSP related file is installed to the vendor <partition>/dsp
356// directory for vendor image.
357func PrebuiltDSPFactory() android.Module {
358 module := &PrebuiltEtc{}
359 module.socInstallDirBase = "dsp"
360 InitPrebuiltEtcModule(module, "etc/dsp")
361 // This module is device-only
362 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
363 return module
364}