blob: a6d1fcf4085f613558bdb55b4153aec193c25842 [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 (
Jaewoong Jung4b79e982020-06-01 10:45:49 -070031 "github.com/google/blueprint/proptools"
32
33 "android/soong/android"
34)
35
36var pctx = android.NewPackageContext("android/soong/etc")
Jiyong Parkc678ad32018-04-10 13:07:10 +090037
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -080038// TODO(jungw): Now that it handles more than the ones in etc/, consider renaming this file.
Jiyong Parkc678ad32018-04-10 13:07:10 +090039
40func init() {
Jaewoong Jung4b79e982020-06-01 10:45:49 -070041 pctx.Import("android/soong/android")
Jooyung Han0703fd82020-08-26 22:11:53 +090042 RegisterPrebuiltEtcBuildComponents(android.InitRegistrationContext)
43}
Jaewoong Jung4b79e982020-06-01 10:45:49 -070044
Jooyung Han0703fd82020-08-26 22:11:53 +090045func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) {
46 ctx.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory)
47 ctx.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
48 ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
49 ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
50 ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
51 ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
52 ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory)
Jiyong Parkc678ad32018-04-10 13:07:10 +090053}
54
55type prebuiltEtcProperties struct {
Yo Chiang803c40d2020-11-16 20:32:51 +080056 // Source file of this prebuilt. Can reference a genrule type module with the ":module" syntax.
Colin Cross27b922f2019-03-04 22:35:41 -080057 Src *string `android:"path,arch_variant"`
Jiyong Parkc678ad32018-04-10 13:07:10 +090058
Liz Kammer0449a632020-06-26 10:12:36 -070059 // 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 +090060 Sub_dir *string `android:"arch_variant"`
Tao Bao0ba5c942018-08-14 22:20:22 -070061
Liz Kammer0449a632020-06-26 10:12:36 -070062 // optional subdirectory under which this file is installed into, cannot be specified with sub_dir
63 Relative_install_path *string `android:"arch_variant"`
64
Jiyong Park139a2e62018-10-26 21:49:39 +090065 // optional name for the installed file. If unspecified, name of the module is used as the file name
66 Filename *string `android:"arch_variant"`
67
Jiyong Park1a7cf082018-11-13 11:59:12 +090068 // when set to true, and filename property is not set, the name for the installed file
69 // is the same as the file name of the source file.
70 Filename_from_src *bool `android:"arch_variant"`
71
Yifan Hong1b3348d2020-01-21 15:53:22 -080072 // Make this module available when building for ramdisk.
Yifan Hong39143a92020-10-26 12:43:12 -070073 // On device without a dedicated recovery partition, the module is only
74 // available after switching root into
75 // /first_stage_ramdisk. To expose the module before switching root, install
76 // the recovery variant instead.
Yifan Hong1b3348d2020-01-21 15:53:22 -080077 Ramdisk_available *bool
78
Yifan Hong60e0cfb2020-10-21 15:17:56 -070079 // Make this module available when building for vendor ramdisk.
Yifan Hong39143a92020-10-26 12:43:12 -070080 // On device without a dedicated recovery partition, the module is only
81 // available after switching root into
82 // /first_stage_ramdisk. To expose the module before switching root, install
83 // the recovery variant instead.
Yifan Hong60e0cfb2020-10-21 15:17:56 -070084 Vendor_ramdisk_available *bool
85
Tao Bao0ba5c942018-08-14 22:20:22 -070086 // Make this module available when building for recovery.
87 Recovery_available *bool
88
Jiyong Parkad9ce042018-10-31 22:49:57 +090089 // Whether this module is directly installable to one of the partitions. Default: true.
90 Installable *bool
Yo Chiang3d64d492020-05-27 17:56:39 +080091
92 // Install symlinks to the installed file.
93 Symlinks []string `android:"arch_variant"`
Jiyong Parkc678ad32018-04-10 13:07:10 +090094}
95
Jooyung Han39edb6c2019-11-06 16:53:07 +090096type PrebuiltEtcModule interface {
Jaewoong Jung4b79e982020-06-01 10:45:49 -070097 android.Module
Jooyung Han0703fd82020-08-26 22:11:53 +090098 BaseDir() string
Jooyung Han39edb6c2019-11-06 16:53:07 +090099 SubDir() string
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700100 OutputFile() android.OutputPath
Jooyung Han39edb6c2019-11-06 16:53:07 +0900101}
102
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900103type PrebuiltEtc struct {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700104 android.ModuleBase
Jiyong Parkc678ad32018-04-10 13:07:10 +0900105
106 properties prebuiltEtcProperties
107
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700108 sourceFilePath android.Path
109 outputFilePath android.OutputPath
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800110 // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share.
Patrice Arruda057a8b12019-06-03 15:29:27 -0700111 installDirBase string
112 // The base install location when soc_specific property is set to true, e.g. "firmware" for prebuilt_firmware.
113 socInstallDirBase string
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700114 installDirPath android.InstallPath
115 additionalDependencies *android.Paths
Jiyong Parkc678ad32018-04-10 13:07:10 +0900116}
117
Yifan Hong1b3348d2020-01-21 15:53:22 -0800118func (p *PrebuiltEtc) inRamdisk() bool {
119 return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk()
120}
121
122func (p *PrebuiltEtc) onlyInRamdisk() bool {
123 return p.ModuleBase.InstallInRamdisk()
124}
125
126func (p *PrebuiltEtc) InstallInRamdisk() bool {
127 return p.inRamdisk()
128}
129
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700130func (p *PrebuiltEtc) inVendorRamdisk() bool {
131 return p.ModuleBase.InVendorRamdisk() || p.ModuleBase.InstallInVendorRamdisk()
132}
133
134func (p *PrebuiltEtc) onlyInVendorRamdisk() bool {
135 return p.ModuleBase.InstallInVendorRamdisk()
136}
137
138func (p *PrebuiltEtc) InstallInVendorRamdisk() bool {
139 return p.inVendorRamdisk()
140}
141
Tao Bao0ba5c942018-08-14 22:20:22 -0700142func (p *PrebuiltEtc) inRecovery() bool {
Colin Cross7228ecd2019-11-18 16:00:16 -0800143 return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery()
Tao Bao0ba5c942018-08-14 22:20:22 -0700144}
145
146func (p *PrebuiltEtc) onlyInRecovery() bool {
147 return p.ModuleBase.InstallInRecovery()
148}
149
150func (p *PrebuiltEtc) InstallInRecovery() bool {
151 return p.inRecovery()
152}
153
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700154var _ android.ImageInterface = (*PrebuiltEtc)(nil)
Colin Cross7228ecd2019-11-18 16:00:16 -0800155
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700156func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.BaseModuleContext) {}
Colin Cross7228ecd2019-11-18 16:00:16 -0800157
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700158func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700159 return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() &&
160 !p.ModuleBase.InstallInVendorRamdisk()
Yifan Hong1b3348d2020-01-21 15:53:22 -0800161}
162
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700163func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
164 return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk()
Colin Cross7228ecd2019-11-18 16:00:16 -0800165}
166
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700167func (p *PrebuiltEtc) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
168 return proptools.Bool(p.properties.Vendor_ramdisk_available) || p.ModuleBase.InstallInVendorRamdisk()
169}
170
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700171func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
172 return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery()
Colin Cross7228ecd2019-11-18 16:00:16 -0800173}
174
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700175func (p *PrebuiltEtc) ExtraImageVariations(ctx android.BaseModuleContext) []string {
Colin Cross7228ecd2019-11-18 16:00:16 -0800176 return nil
177}
178
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700179func (p *PrebuiltEtc) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
Colin Cross7228ecd2019-11-18 16:00:16 -0800180}
181
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700182func (p *PrebuiltEtc) DepsMutator(ctx android.BottomUpMutatorContext) {
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900183 if p.properties.Src == nil {
184 ctx.PropertyErrorf("src", "missing prebuilt source file")
Jiyong Parkc678ad32018-04-10 13:07:10 +0900185 }
Jiyong Parkc678ad32018-04-10 13:07:10 +0900186}
187
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700188func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path {
189 return android.PathForModuleSrc(ctx, android.String(p.properties.Src))
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900190}
191
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700192func (p *PrebuiltEtc) InstallDirPath() android.InstallPath {
Jooyung Hana0171822019-07-22 15:48:36 +0900193 return p.installDirPath
194}
195
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900196// This allows other derivative modules (e.g. prebuilt_etc_xml) to perform
197// additional steps (like validating the src) before the file is installed.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700198func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) {
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900199 p.additionalDependencies = &paths
200}
201
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700202func (p *PrebuiltEtc) OutputFile() android.OutputPath {
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900203 return p.outputFilePath
204}
205
206func (p *PrebuiltEtc) SubDir() string {
Liz Kammer0449a632020-06-26 10:12:36 -0700207 if subDir := proptools.String(p.properties.Sub_dir); subDir != "" {
208 return subDir
209 }
210 return proptools.String(p.properties.Relative_install_path)
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900211}
212
Jooyung Han0703fd82020-08-26 22:11:53 +0900213func (p *PrebuiltEtc) BaseDir() string {
Jooyung Han8e5685d2020-09-21 11:02:57 +0900214 return p.installDirBase
Jooyung Han0703fd82020-08-26 22:11:53 +0900215}
216
Jiyong Parkad9ce042018-10-31 22:49:57 +0900217func (p *PrebuiltEtc) Installable() bool {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700218 return p.properties.Installable == nil || android.Bool(p.properties.Installable)
Jiyong Parkad9ce042018-10-31 22:49:57 +0900219}
220
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700221func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
222 p.sourceFilePath = android.PathForModuleSrc(ctx, android.String(p.properties.Src))
Yo Chiang803c40d2020-11-16 20:32:51 +0800223
224 // Determine the output file basename.
225 // If Filename is set, use the name specified by the property.
226 // If Filename_from_src is set, use the source file name.
227 // Otherwise use the module name.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700228 filename := android.String(p.properties.Filename)
229 filename_from_src := android.Bool(p.properties.Filename_from_src)
Jiyong Park139a2e62018-10-26 21:49:39 +0900230 if filename == "" {
Jiyong Park1a7cf082018-11-13 11:59:12 +0900231 if filename_from_src {
232 filename = p.sourceFilePath.Base()
233 } else {
234 filename = ctx.ModuleName()
235 }
236 } else if filename_from_src {
237 ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true")
238 return
Jiyong Park139a2e62018-10-26 21:49:39 +0900239 }
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700240 p.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath
Patrice Arruda057a8b12019-06-03 15:29:27 -0700241
Liz Kammer0449a632020-06-26 10:12:36 -0700242 if p.properties.Sub_dir != nil && p.properties.Relative_install_path != nil {
243 ctx.PropertyErrorf("sub_dir", "relative_install_path is set. Cannot set sub_dir")
244 }
245
Jooyung Han8e5685d2020-09-21 11:02:57 +0900246 // If soc install dir was specified and SOC specific is set, set the installDirPath to the specified
247 // socInstallDirBase.
248 installBaseDir := p.installDirBase
249 if p.SocSpecific() && p.socInstallDirBase != "" {
250 installBaseDir = p.socInstallDirBase
251 }
252 p.installDirPath = android.PathForModuleInstall(ctx, installBaseDir, p.SubDir())
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900253
Dan Willemsenb0552672019-01-25 16:04:11 -0800254 // This ensures that outputFilePath has the correct name for others to
255 // use, as the source file may have a different name.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700256 ctx.Build(pctx, android.BuildParams{
257 Rule: android.Cp,
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900258 Output: p.outputFilePath,
259 Input: p.sourceFilePath,
260 })
Jiyong Parkf9f68052020-09-29 20:15:08 +0900261
262 if p.Installable() {
263 installPath := ctx.InstallFile(p.installDirPath, p.outputFilePath.Base(), p.outputFilePath)
264 for _, sl := range p.properties.Symlinks {
265 ctx.InstallSymlink(p.installDirPath, sl, installPath)
266 }
267 }
Jiyong Parkc678ad32018-04-10 13:07:10 +0900268}
269
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700270func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries {
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700271 nameSuffix := ""
Yifan Hong1b3348d2020-01-21 15:53:22 -0800272 if p.inRamdisk() && !p.onlyInRamdisk() {
273 nameSuffix = ".ramdisk"
274 }
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700275 if p.inVendorRamdisk() && !p.onlyInVendorRamdisk() {
276 nameSuffix = ".vendor_ramdisk"
277 }
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700278 if p.inRecovery() && !p.onlyInRecovery() {
279 nameSuffix = ".recovery"
280 }
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700281 return []android.AndroidMkEntries{android.AndroidMkEntries{
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700282 Class: "ETC",
283 SubName: nameSuffix,
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700284 OutputFile: android.OptionalPathForPath(p.outputFilePath),
285 ExtraEntries: []android.AndroidMkExtraEntriesFunc{
286 func(entries *android.AndroidMkEntries) {
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700287 entries.SetString("LOCAL_MODULE_TAGS", "optional")
Colin Crossff6c33d2019-10-02 16:01:35 -0700288 entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String())
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700289 entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base())
Yo Chiang3d64d492020-05-27 17:56:39 +0800290 if len(p.properties.Symlinks) > 0 {
291 entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...)
292 }
Yo Chiang803c40d2020-11-16 20:32:51 +0800293 entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.Installable())
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700294 if p.additionalDependencies != nil {
Yo Chiang803c40d2020-11-16 20:32:51 +0800295 entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", p.additionalDependencies.Strings()...)
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900296 }
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700297 },
Jiyong Parkc678ad32018-04-10 13:07:10 +0900298 },
Jiyong Park0b0e1b92019-12-03 13:24:29 +0900299 }}
Jiyong Parkc678ad32018-04-10 13:07:10 +0900300}
301
Jooyung Hana0171822019-07-22 15:48:36 +0900302func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {
303 p.installDirBase = dirBase
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900304 p.AddProperties(&p.properties)
305}
Jiyong Parkc678ad32018-04-10 13:07:10 +0900306
Patrice Arruda9e14b962019-03-11 15:58:50 -0700307// prebuilt_etc is for a prebuilt artifact that is installed in
308// <partition>/etc/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700309func PrebuiltEtcFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900310 module := &PrebuiltEtc{}
311 InitPrebuiltEtcModule(module, "etc")
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900312 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700313 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Jiyong Parkc678ad32018-04-10 13:07:10 +0900314 return module
315}
Tao Bao0ba5c942018-08-14 22:20:22 -0700316
Patrice Arruda9e14b962019-03-11 15:58:50 -0700317// prebuilt_etc_host is for a host prebuilt artifact that is installed in
318// $(HOST_OUT)/etc/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700319func PrebuiltEtcHostFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900320 module := &PrebuiltEtc{}
321 InitPrebuiltEtcModule(module, "etc")
Jaewoong Jung24788182019-02-04 14:34:10 -0800322 // This module is host-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700323 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
Jaewoong Jung24788182019-02-04 14:34:10 -0800324 return module
325}
326
Patrice Arruda9e14b962019-03-11 15:58:50 -0700327// prebuilt_usr_share is for a prebuilt artifact that is installed in
328// <partition>/usr/share/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700329func PrebuiltUserShareFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900330 module := &PrebuiltEtc{}
331 InitPrebuiltEtcModule(module, "usr/share")
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800332 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700333 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800334 return module
335}
336
Patrice Arruda9e14b962019-03-11 15:58:50 -0700337// prebuild_usr_share_host is for a host prebuilt artifact that is installed in
338// $(HOST_OUT)/usr/share/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700339func PrebuiltUserShareHostFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900340 module := &PrebuiltEtc{}
341 InitPrebuiltEtcModule(module, "usr/share")
Patrice Arruda300cef92019-02-22 15:47:57 -0800342 // This module is host-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700343 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
Patrice Arruda300cef92019-02-22 15:47:57 -0800344 return module
345}
346
Patrice Arruda61583eb2019-05-14 08:20:45 -0700347// prebuilt_font installs a font in <partition>/fonts directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700348func PrebuiltFontFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900349 module := &PrebuiltEtc{}
350 InitPrebuiltEtcModule(module, "fonts")
Patrice Arruda61583eb2019-05-14 08:20:45 -0700351 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700352 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Patrice Arruda61583eb2019-05-14 08:20:45 -0700353 return module
354}
Patrice Arruda057a8b12019-06-03 15:29:27 -0700355
356// prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system image.
357// If soc_specific property is set to true, the firmware file is installed to the vendor <partition>/firmware
358// directory for vendor image.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700359func PrebuiltFirmwareFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900360 module := &PrebuiltEtc{}
361 module.socInstallDirBase = "firmware"
362 InitPrebuiltEtcModule(module, "etc/firmware")
Patrice Arruda057a8b12019-06-03 15:29:27 -0700363 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700364 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Patrice Arruda057a8b12019-06-03 15:29:27 -0700365 return module
366}
Patrice Arruda0f688002020-06-08 21:40:25 +0000367
368// prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image.
369// If soc_specific property is set to true, the DSP related file is installed to the vendor <partition>/dsp
370// directory for vendor image.
371func PrebuiltDSPFactory() android.Module {
372 module := &PrebuiltEtc{}
373 module.socInstallDirBase = "dsp"
374 InitPrebuiltEtcModule(module, "etc/dsp")
375 // This module is device-only
376 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
377 return module
378}