blob: 850c8f95a1a857627ff9669be731d11f314a5b1c [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
Yo Chiangf0e19fe2020-11-18 15:28:42 +080059 // Optional subdirectory under which this file is installed into, cannot be specified with
60 // relative_install_path, prefer relative_install_path.
Jiyong Parkc678ad32018-04-10 13:07:10 +090061 Sub_dir *string `android:"arch_variant"`
Tao Bao0ba5c942018-08-14 22:20:22 -070062
Yo Chiangf0e19fe2020-11-18 15:28:42 +080063 // Optional subdirectory under which this file is installed into, cannot be specified with
64 // sub_dir.
Liz Kammer0449a632020-06-26 10:12:36 -070065 Relative_install_path *string `android:"arch_variant"`
66
Yo Chiangf0e19fe2020-11-18 15:28:42 +080067 // Optional name for the installed file. If unspecified, name of the module is used as the file
68 // name.
Jiyong Park139a2e62018-10-26 21:49:39 +090069 Filename *string `android:"arch_variant"`
70
Yo Chiangf0e19fe2020-11-18 15:28:42 +080071 // When set to true, and filename property is not set, the name for the installed file
Jiyong Park1a7cf082018-11-13 11:59:12 +090072 // is the same as the file name of the source file.
73 Filename_from_src *bool `android:"arch_variant"`
74
Yifan Hong1b3348d2020-01-21 15:53:22 -080075 // Make this module available when building for ramdisk.
Yifan Hong39143a92020-10-26 12:43:12 -070076 // On device without a dedicated recovery partition, the module is only
77 // available after switching root into
78 // /first_stage_ramdisk. To expose the module before switching root, install
79 // the recovery variant instead.
Yifan Hong1b3348d2020-01-21 15:53:22 -080080 Ramdisk_available *bool
81
Yifan Hong60e0cfb2020-10-21 15:17:56 -070082 // Make this module available when building for vendor ramdisk.
Yifan Hong39143a92020-10-26 12:43:12 -070083 // On device without a dedicated recovery partition, the module is only
84 // available after switching root into
85 // /first_stage_ramdisk. To expose the module before switching root, install
86 // the recovery variant instead.
Yifan Hong60e0cfb2020-10-21 15:17:56 -070087 Vendor_ramdisk_available *bool
88
Tao Bao0ba5c942018-08-14 22:20:22 -070089 // Make this module available when building for recovery.
90 Recovery_available *bool
91
Jiyong Parkad9ce042018-10-31 22:49:57 +090092 // Whether this module is directly installable to one of the partitions. Default: true.
93 Installable *bool
Yo Chiang3d64d492020-05-27 17:56:39 +080094
95 // Install symlinks to the installed file.
96 Symlinks []string `android:"arch_variant"`
Jiyong Parkc678ad32018-04-10 13:07:10 +090097}
98
Jooyung Han39edb6c2019-11-06 16:53:07 +090099type PrebuiltEtcModule interface {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700100 android.Module
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800101
102 // Returns the base install directory, such as "etc", "usr/share".
Jooyung Han0703fd82020-08-26 22:11:53 +0900103 BaseDir() string
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800104
105 // Returns the sub install directory relative to BaseDir().
Jooyung Han39edb6c2019-11-06 16:53:07 +0900106 SubDir() string
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800107
108 // Returns an android.OutputPath to the intermeidate file, which is the renamed prebuilt source
109 // file.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700110 OutputFile() android.OutputPath
Jooyung Han39edb6c2019-11-06 16:53:07 +0900111}
112
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900113type PrebuiltEtc struct {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700114 android.ModuleBase
Jiyong Parkc678ad32018-04-10 13:07:10 +0900115
116 properties prebuiltEtcProperties
117
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700118 sourceFilePath android.Path
119 outputFilePath android.OutputPath
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800120 // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share.
Patrice Arruda057a8b12019-06-03 15:29:27 -0700121 installDirBase string
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800122 // The base install location when soc_specific property is set to true, e.g. "firmware" for
123 // prebuilt_firmware.
Patrice Arruda057a8b12019-06-03 15:29:27 -0700124 socInstallDirBase string
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700125 installDirPath android.InstallPath
126 additionalDependencies *android.Paths
Jiyong Parkc678ad32018-04-10 13:07:10 +0900127}
128
Yifan Hong1b3348d2020-01-21 15:53:22 -0800129func (p *PrebuiltEtc) inRamdisk() bool {
130 return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk()
131}
132
133func (p *PrebuiltEtc) onlyInRamdisk() bool {
134 return p.ModuleBase.InstallInRamdisk()
135}
136
137func (p *PrebuiltEtc) InstallInRamdisk() bool {
138 return p.inRamdisk()
139}
140
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700141func (p *PrebuiltEtc) inVendorRamdisk() bool {
142 return p.ModuleBase.InVendorRamdisk() || p.ModuleBase.InstallInVendorRamdisk()
143}
144
145func (p *PrebuiltEtc) onlyInVendorRamdisk() bool {
146 return p.ModuleBase.InstallInVendorRamdisk()
147}
148
149func (p *PrebuiltEtc) InstallInVendorRamdisk() bool {
150 return p.inVendorRamdisk()
151}
152
Tao Bao0ba5c942018-08-14 22:20:22 -0700153func (p *PrebuiltEtc) inRecovery() bool {
Colin Cross7228ecd2019-11-18 16:00:16 -0800154 return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery()
Tao Bao0ba5c942018-08-14 22:20:22 -0700155}
156
157func (p *PrebuiltEtc) onlyInRecovery() bool {
158 return p.ModuleBase.InstallInRecovery()
159}
160
161func (p *PrebuiltEtc) InstallInRecovery() bool {
162 return p.inRecovery()
163}
164
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700165var _ android.ImageInterface = (*PrebuiltEtc)(nil)
Colin Cross7228ecd2019-11-18 16:00:16 -0800166
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700167func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.BaseModuleContext) {}
Colin Cross7228ecd2019-11-18 16:00:16 -0800168
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700169func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700170 return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() &&
171 !p.ModuleBase.InstallInVendorRamdisk()
Yifan Hong1b3348d2020-01-21 15:53:22 -0800172}
173
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700174func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
175 return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk()
Colin Cross7228ecd2019-11-18 16:00:16 -0800176}
177
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700178func (p *PrebuiltEtc) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
179 return proptools.Bool(p.properties.Vendor_ramdisk_available) || p.ModuleBase.InstallInVendorRamdisk()
180}
181
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700182func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
183 return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery()
Colin Cross7228ecd2019-11-18 16:00:16 -0800184}
185
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700186func (p *PrebuiltEtc) ExtraImageVariations(ctx android.BaseModuleContext) []string {
Colin Cross7228ecd2019-11-18 16:00:16 -0800187 return nil
188}
189
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700190func (p *PrebuiltEtc) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
Colin Cross7228ecd2019-11-18 16:00:16 -0800191}
192
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700193func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path {
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800194 return android.PathForModuleSrc(ctx, proptools.String(p.properties.Src))
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900195}
196
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700197func (p *PrebuiltEtc) InstallDirPath() android.InstallPath {
Jooyung Hana0171822019-07-22 15:48:36 +0900198 return p.installDirPath
199}
200
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900201// This allows other derivative modules (e.g. prebuilt_etc_xml) to perform
202// additional steps (like validating the src) before the file is installed.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700203func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) {
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900204 p.additionalDependencies = &paths
205}
206
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700207func (p *PrebuiltEtc) OutputFile() android.OutputPath {
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900208 return p.outputFilePath
209}
210
211func (p *PrebuiltEtc) SubDir() string {
Liz Kammer0449a632020-06-26 10:12:36 -0700212 if subDir := proptools.String(p.properties.Sub_dir); subDir != "" {
213 return subDir
214 }
215 return proptools.String(p.properties.Relative_install_path)
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900216}
217
Jooyung Han0703fd82020-08-26 22:11:53 +0900218func (p *PrebuiltEtc) BaseDir() string {
Jooyung Han8e5685d2020-09-21 11:02:57 +0900219 return p.installDirBase
Jooyung Han0703fd82020-08-26 22:11:53 +0900220}
221
Jiyong Parkad9ce042018-10-31 22:49:57 +0900222func (p *PrebuiltEtc) Installable() bool {
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800223 return p.properties.Installable == nil || proptools.Bool(p.properties.Installable)
Jiyong Parkad9ce042018-10-31 22:49:57 +0900224}
225
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700226func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800227 if p.properties.Src == nil {
228 ctx.PropertyErrorf("src", "missing prebuilt source file")
229 return
230 }
231 p.sourceFilePath = android.PathForModuleSrc(ctx, proptools.String(p.properties.Src))
Yo Chiang803c40d2020-11-16 20:32:51 +0800232
233 // Determine the output file basename.
234 // If Filename is set, use the name specified by the property.
235 // If Filename_from_src is set, use the source file name.
236 // Otherwise use the module name.
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800237 filename := proptools.String(p.properties.Filename)
238 filenameFromSrc := proptools.Bool(p.properties.Filename_from_src)
239 if filename != "" {
240 if filenameFromSrc {
241 ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true")
242 return
Jiyong Park1a7cf082018-11-13 11:59:12 +0900243 }
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800244 } else if filenameFromSrc {
245 filename = p.sourceFilePath.Base()
246 } else {
247 filename = ctx.ModuleName()
Jiyong Park139a2e62018-10-26 21:49:39 +0900248 }
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700249 p.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath
Patrice Arruda057a8b12019-06-03 15:29:27 -0700250
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800251 // Check that `sub_dir` and `relative_install_path` are not set at the same time.
Liz Kammer0449a632020-06-26 10:12:36 -0700252 if p.properties.Sub_dir != nil && p.properties.Relative_install_path != nil {
253 ctx.PropertyErrorf("sub_dir", "relative_install_path is set. Cannot set sub_dir")
254 }
255
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800256 // If soc install dir was specified and SOC specific is set, set the installDirPath to the
257 // specified socInstallDirBase.
Jooyung Han8e5685d2020-09-21 11:02:57 +0900258 installBaseDir := p.installDirBase
259 if p.SocSpecific() && p.socInstallDirBase != "" {
260 installBaseDir = p.socInstallDirBase
261 }
262 p.installDirPath = android.PathForModuleInstall(ctx, installBaseDir, p.SubDir())
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900263
Dan Willemsenb0552672019-01-25 16:04:11 -0800264 // This ensures that outputFilePath has the correct name for others to
265 // use, as the source file may have a different name.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700266 ctx.Build(pctx, android.BuildParams{
267 Rule: android.Cp,
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900268 Output: p.outputFilePath,
269 Input: p.sourceFilePath,
270 })
Jiyong Parkf9f68052020-09-29 20:15:08 +0900271
272 if p.Installable() {
273 installPath := ctx.InstallFile(p.installDirPath, p.outputFilePath.Base(), p.outputFilePath)
274 for _, sl := range p.properties.Symlinks {
275 ctx.InstallSymlink(p.installDirPath, sl, installPath)
276 }
277 }
Jiyong Parkc678ad32018-04-10 13:07:10 +0900278}
279
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700280func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries {
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700281 nameSuffix := ""
Yifan Hong1b3348d2020-01-21 15:53:22 -0800282 if p.inRamdisk() && !p.onlyInRamdisk() {
283 nameSuffix = ".ramdisk"
284 }
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700285 if p.inVendorRamdisk() && !p.onlyInVendorRamdisk() {
286 nameSuffix = ".vendor_ramdisk"
287 }
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700288 if p.inRecovery() && !p.onlyInRecovery() {
289 nameSuffix = ".recovery"
290 }
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700291 return []android.AndroidMkEntries{android.AndroidMkEntries{
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700292 Class: "ETC",
293 SubName: nameSuffix,
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700294 OutputFile: android.OptionalPathForPath(p.outputFilePath),
295 ExtraEntries: []android.AndroidMkExtraEntriesFunc{
296 func(entries *android.AndroidMkEntries) {
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700297 entries.SetString("LOCAL_MODULE_TAGS", "optional")
Colin Crossff6c33d2019-10-02 16:01:35 -0700298 entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String())
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700299 entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base())
Yo Chiang3d64d492020-05-27 17:56:39 +0800300 if len(p.properties.Symlinks) > 0 {
301 entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...)
302 }
Yo Chiang803c40d2020-11-16 20:32:51 +0800303 entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.Installable())
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700304 if p.additionalDependencies != nil {
Yo Chiang803c40d2020-11-16 20:32:51 +0800305 entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", p.additionalDependencies.Strings()...)
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900306 }
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700307 },
Jiyong Parkc678ad32018-04-10 13:07:10 +0900308 },
Jiyong Park0b0e1b92019-12-03 13:24:29 +0900309 }}
Jiyong Parkc678ad32018-04-10 13:07:10 +0900310}
311
Jooyung Hana0171822019-07-22 15:48:36 +0900312func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {
313 p.installDirBase = dirBase
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900314 p.AddProperties(&p.properties)
315}
Jiyong Parkc678ad32018-04-10 13:07:10 +0900316
Patrice Arruda9e14b962019-03-11 15:58:50 -0700317// prebuilt_etc is for a prebuilt artifact that is installed in
318// <partition>/etc/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700319func PrebuiltEtcFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900320 module := &PrebuiltEtc{}
321 InitPrebuiltEtcModule(module, "etc")
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900322 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700323 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Jiyong Parkc678ad32018-04-10 13:07:10 +0900324 return module
325}
Tao Bao0ba5c942018-08-14 22:20:22 -0700326
Patrice Arruda9e14b962019-03-11 15:58:50 -0700327// prebuilt_etc_host is for a host prebuilt artifact that is installed in
328// $(HOST_OUT)/etc/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700329func PrebuiltEtcHostFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900330 module := &PrebuiltEtc{}
331 InitPrebuiltEtcModule(module, "etc")
Jaewoong Jung24788182019-02-04 14:34:10 -0800332 // This module is host-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700333 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
Jaewoong Jung24788182019-02-04 14:34:10 -0800334 return module
335}
336
Patrice Arruda9e14b962019-03-11 15:58:50 -0700337// prebuilt_usr_share is for a prebuilt artifact that is installed in
338// <partition>/usr/share/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700339func PrebuiltUserShareFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900340 module := &PrebuiltEtc{}
341 InitPrebuiltEtcModule(module, "usr/share")
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800342 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700343 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800344 return module
345}
346
Patrice Arruda9e14b962019-03-11 15:58:50 -0700347// prebuild_usr_share_host is for a host prebuilt artifact that is installed in
348// $(HOST_OUT)/usr/share/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700349func PrebuiltUserShareHostFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900350 module := &PrebuiltEtc{}
351 InitPrebuiltEtcModule(module, "usr/share")
Patrice Arruda300cef92019-02-22 15:47:57 -0800352 // This module is host-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700353 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
Patrice Arruda300cef92019-02-22 15:47:57 -0800354 return module
355}
356
Patrice Arruda61583eb2019-05-14 08:20:45 -0700357// prebuilt_font installs a font in <partition>/fonts directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700358func PrebuiltFontFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900359 module := &PrebuiltEtc{}
360 InitPrebuiltEtcModule(module, "fonts")
Patrice Arruda61583eb2019-05-14 08:20:45 -0700361 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700362 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Patrice Arruda61583eb2019-05-14 08:20:45 -0700363 return module
364}
Patrice Arruda057a8b12019-06-03 15:29:27 -0700365
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800366// prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system
367// image.
368// If soc_specific property is set to true, the firmware file is installed to the
369// vendor <partition>/firmware directory for vendor image.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700370func PrebuiltFirmwareFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900371 module := &PrebuiltEtc{}
372 module.socInstallDirBase = "firmware"
373 InitPrebuiltEtcModule(module, "etc/firmware")
Patrice Arruda057a8b12019-06-03 15:29:27 -0700374 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700375 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Patrice Arruda057a8b12019-06-03 15:29:27 -0700376 return module
377}
Patrice Arruda0f688002020-06-08 21:40:25 +0000378
379// prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image.
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800380// If soc_specific property is set to true, the DSP related file is installed to the
381// vendor <partition>/dsp directory for vendor image.
Patrice Arruda0f688002020-06-08 21:40:25 +0000382func PrebuiltDSPFactory() android.Module {
383 module := &PrebuiltEtc{}
384 module.socInstallDirBase = "dsp"
385 InitPrebuiltEtcModule(module, "etc/dsp")
386 // This module is device-only
387 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
388 return module
389}