blob: 7820047abfe77a5462ffe264d4cd1b67cbeeb86d [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
Yu Liu0a37d422025-02-13 02:05:00 +000035 "github.com/google/blueprint"
Jaewoong Jung4b79e982020-06-01 10:45:49 -070036 "github.com/google/blueprint/proptools"
37
38 "android/soong/android"
39)
40
41var pctx = android.NewPackageContext("android/soong/etc")
Jiyong Parkc678ad32018-04-10 13:07:10 +090042
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -080043// TODO(jungw): Now that it handles more than the ones in etc/, consider renaming this file.
Jiyong Parkc678ad32018-04-10 13:07:10 +090044
45func init() {
Jaewoong Jung4b79e982020-06-01 10:45:49 -070046 pctx.Import("android/soong/android")
Jooyung Han0703fd82020-08-26 22:11:53 +090047 RegisterPrebuiltEtcBuildComponents(android.InitRegistrationContext)
48}
Jaewoong Jung4b79e982020-06-01 10:45:49 -070049
Jooyung Han0703fd82020-08-26 22:11:53 +090050func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) {
51 ctx.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory)
52 ctx.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
Miguel32b02802022-12-01 18:38:26 +000053 ctx.RegisterModuleType("prebuilt_etc_cacerts", PrebuiltEtcCaCertsFactory)
Nelson Li1fb94b22024-07-09 17:04:52 +080054 ctx.RegisterModuleType("prebuilt_avb", PrebuiltAvbFactory)
Inseob Kim27408bf2021-04-06 21:00:17 +090055 ctx.RegisterModuleType("prebuilt_root", PrebuiltRootFactory)
Liz Kammere9ecddc2022-01-04 17:27:52 -050056 ctx.RegisterModuleType("prebuilt_root_host", PrebuiltRootHostFactory)
Jooyung Han0703fd82020-08-26 22:11:53 +090057 ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
58 ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
yangbill63c5e192024-03-27 09:02:12 +000059 ctx.RegisterModuleType("prebuilt_usr_hyphendata", PrebuiltUserHyphenDataFactory)
yangbill85527e62024-04-30 08:24:50 +000060 ctx.RegisterModuleType("prebuilt_usr_keylayout", PrebuiltUserKeyLayoutFactory)
61 ctx.RegisterModuleType("prebuilt_usr_keychars", PrebuiltUserKeyCharsFactory)
62 ctx.RegisterModuleType("prebuilt_usr_idc", PrebuiltUserIdcFactory)
Jihoon Kang0da5ae92024-10-29 23:24:17 +000063 ctx.RegisterModuleType("prebuilt_usr_srec", PrebuiltUserSrecFactory)
Agi Sferro243c7d72025-02-24 15:45:53 -080064 ctx.RegisterModuleType("prebuilt_usr_odml", PrebuiltUserOdmlFactory)
Jooyung Han0703fd82020-08-26 22:11:53 +090065 ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
Kevin93f7cd82024-05-02 12:37:59 +020066 ctx.RegisterModuleType("prebuilt_overlay", PrebuiltOverlayFactory)
Jooyung Han0703fd82020-08-26 22:11:53 +090067 ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
Luca Stefani04812eb2025-03-09 12:41:06 +010068 ctx.RegisterModuleType("prebuilt_gpu", PrebuiltGPUFactory)
Jooyung Han0703fd82020-08-26 22:11:53 +090069 ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory)
Colin Cross83ebf232021-04-09 09:41:23 -070070 ctx.RegisterModuleType("prebuilt_rfsa", PrebuiltRFSAFactory)
Colin Crossf17e2b52023-10-30 15:17:25 -070071 ctx.RegisterModuleType("prebuilt_renderscript_bitcode", PrebuiltRenderScriptBitcodeFactory)
Jihoon Kang0da5ae92024-10-29 23:24:17 +000072 ctx.RegisterModuleType("prebuilt_media", PrebuiltMediaFactory)
Jihoon Kangec62d842024-10-25 20:27:18 +000073 ctx.RegisterModuleType("prebuilt_voicepack", PrebuiltVoicepackFactory)
74 ctx.RegisterModuleType("prebuilt_bin", PrebuiltBinaryFactory)
75 ctx.RegisterModuleType("prebuilt_wallpaper", PrebuiltWallpaperFactory)
Jihoon Kang0da5ae92024-10-29 23:24:17 +000076 ctx.RegisterModuleType("prebuilt_priv_app", PrebuiltPrivAppFactory)
Michael Bestas137fab42025-03-08 20:44:34 +020077 ctx.RegisterModuleType("prebuilt_radio", PrebuiltRadioFactory)
Jihoon Kang0da5ae92024-10-29 23:24:17 +000078 ctx.RegisterModuleType("prebuilt_rfs", PrebuiltRfsFactory)
79 ctx.RegisterModuleType("prebuilt_framework", PrebuiltFrameworkFactory)
80 ctx.RegisterModuleType("prebuilt_res", PrebuiltResFactory)
Tim Zimmermann82c066d2025-03-12 06:28:34 +010081 ctx.RegisterModuleType("prebuilt_tee", PrebuiltTeeFactory)
Jihoon Kang0da5ae92024-10-29 23:24:17 +000082 ctx.RegisterModuleType("prebuilt_wlc_upt", PrebuiltWlcUptFactory)
83 ctx.RegisterModuleType("prebuilt_odm", PrebuiltOdmFactory)
Jihoon Kang2e2b7442024-11-05 00:26:20 +000084 ctx.RegisterModuleType("prebuilt_vendor_dlkm", PrebuiltVendorDlkmFactory)
Artem Borisov49f074b2025-03-11 23:19:26 +030085 ctx.RegisterModuleType("prebuilt_vendor_overlay", PrebuiltVendorOverlayFactory)
Jihoon Kang2e2b7442024-11-05 00:26:20 +000086 ctx.RegisterModuleType("prebuilt_bt_firmware", PrebuiltBtFirmwareFactory)
Jihoon Kangdca2f2b2024-11-06 18:43:19 +000087 ctx.RegisterModuleType("prebuilt_tvservice", PrebuiltTvServiceFactory)
88 ctx.RegisterModuleType("prebuilt_optee", PrebuiltOpteeFactory)
Jihoon Kangecf76dd2024-11-12 05:24:46 +000089 ctx.RegisterModuleType("prebuilt_tvconfig", PrebuiltTvConfigFactory)
Jihoon Kang3ca07a12024-12-02 19:14:30 +000090 ctx.RegisterModuleType("prebuilt_vendor", PrebuiltVendorFactory)
Jihoon Kang320ca7c2024-12-03 18:14:50 +000091 ctx.RegisterModuleType("prebuilt_sbin", PrebuiltSbinFactory)
92 ctx.RegisterModuleType("prebuilt_system", PrebuiltSystemFactory)
93 ctx.RegisterModuleType("prebuilt_first_stage_ramdisk", PrebuiltFirstStageRamdiskFactory)
Jihoon Kang002767b2025-03-12 22:14:39 +000094 ctx.RegisterModuleType("prebuilt_any", PrebuiltAnyFactory)
Inseob Kim1e27a142021-05-06 11:46:11 +000095
96 ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory)
Rupert Shuttleworth378fc1b2021-07-28 08:03:16 -040097
Jiyong Parkc678ad32018-04-10 13:07:10 +090098}
99
Yu Liu0a37d422025-02-13 02:05:00 +0000100type PrebuiltEtcInfo struct {
101 // Returns the base install directory, such as "etc", "usr/share".
102 BaseDir string
103 // Returns the sub install directory relative to BaseDir().
104 SubDir string
105}
106
107var PrebuiltEtcInfoProvider = blueprint.NewProvider[PrebuiltEtcInfo]()
108
Paul Duffin1172fed2021-03-08 11:28:18 +0000109var PrepareForTestWithPrebuiltEtc = android.FixtureRegisterWithContext(RegisterPrebuiltEtcBuildComponents)
110
Jihoon Kang69725b32024-11-12 03:08:49 +0000111type PrebuiltEtcProperties struct {
Yo Chiang803c40d2020-11-16 20:32:51 +0800112 // Source file of this prebuilt. Can reference a genrule type module with the ":module" syntax.
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100113 // Mutually exclusive with srcs.
Cole Faustfdec8722024-05-22 11:38:29 -0700114 Src proptools.Configurable[string] `android:"path,arch_variant,replace_instead_of_append"`
Jiyong Parkc678ad32018-04-10 13:07:10 +0900115
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100116 // Source files of this prebuilt. Can reference a genrule type module with the ":module" syntax.
Douglas Anderson79688ff2024-09-27 15:08:33 -0700117 // Mutually exclusive with src. When used, filename_from_src is set to true unless dsts is also
118 // set. May use globs in filenames.
Cole Faustfdec8722024-05-22 11:38:29 -0700119 Srcs proptools.Configurable[[]string] `android:"path,arch_variant"`
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100120
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800121 // 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 +1100122 // name. Only available when using a single source (src).
Jiyong Park139a2e62018-10-26 21:49:39 +0900123 Filename *string `android:"arch_variant"`
124
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800125 // When set to true, and filename property is not set, the name for the installed file
Jiyong Park1a7cf082018-11-13 11:59:12 +0900126 // is the same as the file name of the source file.
127 Filename_from_src *bool `android:"arch_variant"`
128
Yifan Hong1b3348d2020-01-21 15:53:22 -0800129 // Make this module available when building for ramdisk.
Yifan Hong39143a92020-10-26 12:43:12 -0700130 // On device without a dedicated recovery partition, the module is only
131 // available after switching root into
132 // /first_stage_ramdisk. To expose the module before switching root, install
133 // the recovery variant instead.
Yifan Hong1b3348d2020-01-21 15:53:22 -0800134 Ramdisk_available *bool
135
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700136 // Make this module available when building for vendor ramdisk.
Yifan Hong39143a92020-10-26 12:43:12 -0700137 // On device without a dedicated recovery partition, the module is only
138 // available after switching root into
139 // /first_stage_ramdisk. To expose the module before switching root, install
140 // the recovery variant instead.
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700141 Vendor_ramdisk_available *bool
142
Inseob Kim08758f02021-04-08 21:13:22 +0900143 // Make this module available when building for debug ramdisk.
144 Debug_ramdisk_available *bool
145
Tao Bao0ba5c942018-08-14 22:20:22 -0700146 // Make this module available when building for recovery.
147 Recovery_available *bool
148
Jiyong Parkad9ce042018-10-31 22:49:57 +0900149 // Whether this module is directly installable to one of the partitions. Default: true.
150 Installable *bool
Yo Chiang3d64d492020-05-27 17:56:39 +0800151
152 // Install symlinks to the installed file.
153 Symlinks []string `android:"arch_variant"`
Wei Li59586252024-11-04 09:25:54 -0800154
Wei Li59586252024-11-04 09:25:54 -0800155 // Install to partition oem when set to true.
156 Oem_specific *bool `android:"arch_variant"`
Jiyong Parkc678ad32018-04-10 13:07:10 +0900157}
158
Jihoon Kangf729d2e2025-03-12 22:24:52 +0000159// Dsts is useful in that it allows prebuilt_* modules to easily map the source files to the
160// install path within the partition. Dsts values are allowed to contain filepath separator
161// so that the source files can be installed in subdirectories within the partition.
162// However, this functionality should not be supported for prebuilt_root module type, as it
163// allows the module to install to any arbitrary location. Thus, this property is defined in
164// a separate struct so that it's not available to be set in prebuilt_root module type.
165type PrebuiltDstsProperties struct {
166 // Destination files of this prebuilt. Requires srcs to be used and causes srcs not to implicitly
167 // set filename_from_src. This can be used to install each source file to a different directory
168 // and/or change filenames when files are installed. Must be exactly one entry per source file,
169 // which means care must be taken if srcs has globs.
170 Dsts proptools.Configurable[[]string] `android:"path,arch_variant"`
171}
172
Inseob Kim27408bf2021-04-06 21:00:17 +0900173type prebuiltSubdirProperties struct {
174 // Optional subdirectory under which this file is installed into, cannot be specified with
175 // relative_install_path, prefer relative_install_path.
176 Sub_dir *string `android:"arch_variant"`
177
178 // Optional subdirectory under which this file is installed into, cannot be specified with
179 // sub_dir.
180 Relative_install_path *string `android:"arch_variant"`
181}
182
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900183type prebuiltRootProperties struct {
184 // Install this module to the root directory, without partition subdirs. When this module is
185 // added to PRODUCT_PACKAGES, this module will be installed to $PRODUCT_OUT/root, which will
186 // then be copied to the root of system.img. When this module is packaged by other modules like
187 // android_filesystem, this module will be installed to the root ("/"), unlike normal
188 // prebuilt_root modules which are installed to the partition subdir (e.g. "/system/").
189 Install_in_root *bool
190}
191
Jooyung Han39edb6c2019-11-06 16:53:07 +0900192type PrebuiltEtcModule interface {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700193 android.Module
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800194
195 // Returns the base install directory, such as "etc", "usr/share".
Jooyung Han0703fd82020-08-26 22:11:53 +0900196 BaseDir() string
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800197
198 // Returns the sub install directory relative to BaseDir().
Jooyung Han39edb6c2019-11-06 16:53:07 +0900199 SubDir() string
Jooyung Han39edb6c2019-11-06 16:53:07 +0900200}
201
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900202type PrebuiltEtc struct {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700203 android.ModuleBase
Inseob Kim1e27a142021-05-06 11:46:11 +0000204 android.DefaultableModuleBase
Jiyong Parkc678ad32018-04-10 13:07:10 +0900205
Jihoon Kang69725b32024-11-12 03:08:49 +0000206 properties PrebuiltEtcProperties
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900207
Jihoon Kangf729d2e2025-03-12 22:24:52 +0000208 dstsProperties PrebuiltDstsProperties
209
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900210 // rootProperties is used to return the value of the InstallInRoot() method. Currently, only
211 // prebuilt_avb and prebuilt_root modules use this.
212 rootProperties prebuiltRootProperties
213
Inseob Kim27408bf2021-04-06 21:00:17 +0900214 subdirProperties prebuiltSubdirProperties
Jiyong Parkc678ad32018-04-10 13:07:10 +0900215
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100216 sourceFilePaths android.Paths
Cole Faust4e9f5922024-11-13 16:09:23 -0800217 outputFilePaths android.WritablePaths
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800218 // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share.
Colin Cross2f634572023-11-13 12:12:06 -0800219 installDirBase string
220 installDirBase64 string
221 installAvoidMultilibConflict bool
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800222 // The base install location when soc_specific property is set to true, e.g. "firmware" for
223 // prebuilt_firmware.
Patrice Arruda057a8b12019-06-03 15:29:27 -0700224 socInstallDirBase string
Douglas Anderson79688ff2024-09-27 15:08:33 -0700225 installDirPaths []android.InstallPath
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700226 additionalDependencies *android.Paths
Colin Crossf17e2b52023-10-30 15:17:25 -0700227
Cole Faustfdec8722024-05-22 11:38:29 -0700228 usedSrcsProperty bool
229
Colin Crossf17e2b52023-10-30 15:17:25 -0700230 makeClass string
Jiyong Parkc678ad32018-04-10 13:07:10 +0900231}
232
Inseob Kim1e27a142021-05-06 11:46:11 +0000233type Defaults struct {
234 android.ModuleBase
235 android.DefaultsModuleBase
236}
237
Yifan Hong1b3348d2020-01-21 15:53:22 -0800238func (p *PrebuiltEtc) inRamdisk() bool {
239 return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk()
240}
241
242func (p *PrebuiltEtc) onlyInRamdisk() bool {
243 return p.ModuleBase.InstallInRamdisk()
244}
245
246func (p *PrebuiltEtc) InstallInRamdisk() bool {
247 return p.inRamdisk()
248}
249
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700250func (p *PrebuiltEtc) inVendorRamdisk() bool {
251 return p.ModuleBase.InVendorRamdisk() || p.ModuleBase.InstallInVendorRamdisk()
252}
253
254func (p *PrebuiltEtc) onlyInVendorRamdisk() bool {
255 return p.ModuleBase.InstallInVendorRamdisk()
256}
257
258func (p *PrebuiltEtc) InstallInVendorRamdisk() bool {
259 return p.inVendorRamdisk()
260}
261
Inseob Kim08758f02021-04-08 21:13:22 +0900262func (p *PrebuiltEtc) inDebugRamdisk() bool {
263 return p.ModuleBase.InDebugRamdisk() || p.ModuleBase.InstallInDebugRamdisk()
264}
265
266func (p *PrebuiltEtc) onlyInDebugRamdisk() bool {
267 return p.ModuleBase.InstallInDebugRamdisk()
268}
269
270func (p *PrebuiltEtc) InstallInDebugRamdisk() bool {
271 return p.inDebugRamdisk()
272}
273
Kiyoung Kimae11c232021-07-19 11:38:04 +0900274func (p *PrebuiltEtc) InRecovery() bool {
Colin Cross7228ecd2019-11-18 16:00:16 -0800275 return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery()
Tao Bao0ba5c942018-08-14 22:20:22 -0700276}
277
278func (p *PrebuiltEtc) onlyInRecovery() bool {
279 return p.ModuleBase.InstallInRecovery()
280}
281
282func (p *PrebuiltEtc) InstallInRecovery() bool {
Kiyoung Kimae11c232021-07-19 11:38:04 +0900283 return p.InRecovery()
Tao Bao0ba5c942018-08-14 22:20:22 -0700284}
285
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700286var _ android.ImageInterface = (*PrebuiltEtc)(nil)
Colin Cross7228ecd2019-11-18 16:00:16 -0800287
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700288func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.ImageInterfaceContext) {}
Colin Cross7228ecd2019-11-18 16:00:16 -0800289
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700290func (p *PrebuiltEtc) VendorVariantNeeded(ctx android.ImageInterfaceContext) bool {
Jihoon Kang47e91842024-06-19 00:51:16 +0000291 return false
292}
293
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700294func (p *PrebuiltEtc) ProductVariantNeeded(ctx android.ImageInterfaceContext) bool {
Jihoon Kang47e91842024-06-19 00:51:16 +0000295 return false
296}
297
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700298func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.ImageInterfaceContext) bool {
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700299 return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() &&
Inseob Kim08758f02021-04-08 21:13:22 +0900300 !p.ModuleBase.InstallInVendorRamdisk() && !p.ModuleBase.InstallInDebugRamdisk()
Yifan Hong1b3348d2020-01-21 15:53:22 -0800301}
302
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700303func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700304 return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk()
Colin Cross7228ecd2019-11-18 16:00:16 -0800305}
306
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700307func (p *PrebuiltEtc) VendorRamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool {
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700308 return proptools.Bool(p.properties.Vendor_ramdisk_available) || p.ModuleBase.InstallInVendorRamdisk()
309}
310
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700311func (p *PrebuiltEtc) DebugRamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool {
Inseob Kim08758f02021-04-08 21:13:22 +0900312 return proptools.Bool(p.properties.Debug_ramdisk_available) || p.ModuleBase.InstallInDebugRamdisk()
313}
314
Nelson Li1fb94b22024-07-09 17:04:52 +0800315func (p *PrebuiltEtc) InstallInRoot() bool {
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900316 return proptools.Bool(p.rootProperties.Install_in_root)
Nelson Li1fb94b22024-07-09 17:04:52 +0800317}
318
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700319func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.ImageInterfaceContext) bool {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700320 return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery()
Colin Cross7228ecd2019-11-18 16:00:16 -0800321}
322
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700323func (p *PrebuiltEtc) ExtraImageVariations(ctx android.ImageInterfaceContext) []string {
Colin Cross7228ecd2019-11-18 16:00:16 -0800324 return nil
325}
326
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700327func (p *PrebuiltEtc) SetImageVariation(ctx android.ImageInterfaceContext, variation string) {
Colin Cross7228ecd2019-11-18 16:00:16 -0800328}
329
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700330func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path {
Cole Faustfdec8722024-05-22 11:38:29 -0700331 if len(p.properties.Srcs.GetOrDefault(ctx, nil)) > 0 {
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100332 panic(fmt.Errorf("SourceFilePath not available on multi-source prebuilt %q", p.Name()))
333 }
Cole Faustfdec8722024-05-22 11:38:29 -0700334 return android.PathForModuleSrc(ctx, p.properties.Src.GetOrDefault(ctx, ""))
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900335}
336
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700337func (p *PrebuiltEtc) InstallDirPath() android.InstallPath {
Douglas Anderson79688ff2024-09-27 15:08:33 -0700338 if len(p.installDirPaths) != 1 {
339 panic(fmt.Errorf("InstallDirPath not available on multi-source prebuilt %q", p.Name()))
340 }
341 return p.installDirPaths[0]
Jooyung Hana0171822019-07-22 15:48:36 +0900342}
343
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900344// This allows other derivative modules (e.g. prebuilt_etc_xml) to perform
345// additional steps (like validating the src) before the file is installed.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700346func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) {
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900347 p.additionalDependencies = &paths
348}
349
Cole Faust4e9f5922024-11-13 16:09:23 -0800350func (p *PrebuiltEtc) OutputFile() android.Path {
Cole Faustfdec8722024-05-22 11:38:29 -0700351 if p.usedSrcsProperty {
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100352 panic(fmt.Errorf("OutputFile not available on multi-source prebuilt %q", p.Name()))
353 }
354 return p.outputFilePaths[0]
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900355}
356
357func (p *PrebuiltEtc) SubDir() string {
Inseob Kim27408bf2021-04-06 21:00:17 +0900358 if subDir := proptools.String(p.subdirProperties.Sub_dir); subDir != "" {
Liz Kammer0449a632020-06-26 10:12:36 -0700359 return subDir
360 }
Inseob Kim27408bf2021-04-06 21:00:17 +0900361 return proptools.String(p.subdirProperties.Relative_install_path)
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900362}
363
Jooyung Han0703fd82020-08-26 22:11:53 +0900364func (p *PrebuiltEtc) BaseDir() string {
Jooyung Han8e5685d2020-09-21 11:02:57 +0900365 return p.installDirBase
Jooyung Han0703fd82020-08-26 22:11:53 +0900366}
367
Jiyong Parkad9ce042018-10-31 22:49:57 +0900368func (p *PrebuiltEtc) Installable() bool {
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800369 return p.properties.Installable == nil || proptools.Bool(p.properties.Installable)
Jiyong Parkad9ce042018-10-31 22:49:57 +0900370}
371
Kiyoung Kimae11c232021-07-19 11:38:04 +0900372func (p *PrebuiltEtc) InVendor() bool {
373 return p.ModuleBase.InstallInVendor()
374}
375
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100376func (p *PrebuiltEtc) installBaseDir(ctx android.ModuleContext) string {
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800377 // If soc install dir was specified and SOC specific is set, set the installDirPath to the
378 // specified socInstallDirBase.
Jooyung Han8e5685d2020-09-21 11:02:57 +0900379 installBaseDir := p.installDirBase
Colin Crossf17e2b52023-10-30 15:17:25 -0700380 if p.Target().Arch.ArchType.Multilib == "lib64" && p.installDirBase64 != "" {
381 installBaseDir = p.installDirBase64
382 }
Jooyung Han8e5685d2020-09-21 11:02:57 +0900383 if p.SocSpecific() && p.socInstallDirBase != "" {
384 installBaseDir = p.socInstallDirBase
385 }
Colin Cross2f634572023-11-13 12:12:06 -0800386 if p.installAvoidMultilibConflict && !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
387 installBaseDir = filepath.Join(installBaseDir, ctx.Arch().ArchType.String())
388 }
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100389 return installBaseDir
390}
Colin Cross2f634572023-11-13 12:12:06 -0800391
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100392func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
393 var installs []installProperties
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900394
Cole Faustfdec8722024-05-22 11:38:29 -0700395 srcProperty := p.properties.Src.Get(ctx)
396 srcsProperty := p.properties.Srcs.GetOrDefault(ctx, nil)
397 if srcProperty.IsPresent() && len(srcsProperty) > 0 {
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100398 ctx.PropertyErrorf("src", "src is set. Cannot set srcs")
Spandan Das756d3402023-06-05 22:49:50 +0000399 }
Jihoon Kangf729d2e2025-03-12 22:24:52 +0000400 dstsProperty := p.dstsProperties.Dsts.GetOrDefault(ctx, nil)
Douglas Anderson79688ff2024-09-27 15:08:33 -0700401 if len(dstsProperty) > 0 && len(srcsProperty) == 0 {
402 ctx.PropertyErrorf("dsts", "dsts is set. Must use srcs")
403 }
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100404
405 // Check that `sub_dir` and `relative_install_path` are not set at the same time.
406 if p.subdirProperties.Sub_dir != nil && p.subdirProperties.Relative_install_path != nil {
407 ctx.PropertyErrorf("sub_dir", "relative_install_path is set. Cannot set sub_dir")
408 }
Douglas Anderson79688ff2024-09-27 15:08:33 -0700409 baseInstallDirPath := android.PathForModuleInstall(ctx, p.installBaseDir(ctx), p.SubDir())
Wei Li59586252024-11-04 09:25:54 -0800410 // TODO(b/377304441)
Spandan Das27ff7672024-11-06 19:23:57 +0000411 if android.Bool(p.properties.Oem_specific) {
Wei Li59586252024-11-04 09:25:54 -0800412 baseInstallDirPath = android.PathForModuleInPartitionInstall(ctx, ctx.DeviceConfig().OemPath(), p.installBaseDir(ctx), p.SubDir())
413 }
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100414
415 filename := proptools.String(p.properties.Filename)
416 filenameFromSrc := proptools.Bool(p.properties.Filename_from_src)
Cole Faustfdec8722024-05-22 11:38:29 -0700417 if srcProperty.IsPresent() {
418 p.sourceFilePaths = android.PathsForModuleSrc(ctx, []string{srcProperty.Get()})
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100419 // If the source was not found, set a fake source path to
420 // support AllowMissingDependencies executions.
421 if len(p.sourceFilePaths) == 0 {
422 p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)}
423 }
424
425 // Determine the output file basename.
426 // If Filename is set, use the name specified by the property.
427 // If Filename_from_src is set, use the source file name.
428 // Otherwise use the module name.
429 if filename != "" {
430 if filenameFromSrc {
431 ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true")
432 return
433 }
434 } else if filenameFromSrc {
435 filename = p.sourceFilePaths[0].Base()
436 } else {
437 filename = ctx.ModuleName()
438 }
439 if strings.Contains(filename, "/") {
440 ctx.PropertyErrorf("filename", "filename cannot contain separator '/'")
441 return
442 }
Cole Faust4e9f5922024-11-13 16:09:23 -0800443 p.outputFilePaths = android.WritablePaths{android.PathForModuleOut(ctx, filename)}
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100444
445 ip := installProperties{
446 filename: filename,
447 sourceFilePath: p.sourceFilePaths[0],
448 outputFilePath: p.outputFilePaths[0],
Douglas Anderson79688ff2024-09-27 15:08:33 -0700449 installDirPath: baseInstallDirPath,
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100450 symlinks: p.properties.Symlinks,
451 }
452 installs = append(installs, ip)
Douglas Anderson79688ff2024-09-27 15:08:33 -0700453 p.installDirPaths = append(p.installDirPaths, baseInstallDirPath)
Cole Faustfdec8722024-05-22 11:38:29 -0700454 } else if len(srcsProperty) > 0 {
455 p.usedSrcsProperty = true
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100456 if filename != "" {
457 ctx.PropertyErrorf("filename", "filename cannot be set when using srcs")
458 }
459 if len(p.properties.Symlinks) > 0 {
460 ctx.PropertyErrorf("symlinks", "symlinks cannot be set when using srcs")
461 }
462 if p.properties.Filename_from_src != nil {
Douglas Anderson79688ff2024-09-27 15:08:33 -0700463 if len(dstsProperty) > 0 {
464 ctx.PropertyErrorf("filename_from_src", "dsts is set. Cannot set filename_from_src")
465 } else {
466 ctx.PropertyErrorf("filename_from_src", "filename_from_src is implicitly set to true when using srcs")
467 }
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100468 }
Cole Faustfdec8722024-05-22 11:38:29 -0700469 p.sourceFilePaths = android.PathsForModuleSrc(ctx, srcsProperty)
Douglas Anderson79688ff2024-09-27 15:08:33 -0700470 if len(dstsProperty) > 0 && len(p.sourceFilePaths) != len(dstsProperty) {
471 ctx.PropertyErrorf("dsts", "Must have one entry in dsts per source file")
472 }
473 for i, src := range p.sourceFilePaths {
474 var filename string
475 var installDirPath android.InstallPath
476
477 if len(dstsProperty) > 0 {
478 var dstdir string
479
480 dstdir, filename = filepath.Split(dstsProperty[i])
481 installDirPath = baseInstallDirPath.Join(ctx, dstdir)
482 } else {
483 filename = src.Base()
484 installDirPath = baseInstallDirPath
485 }
Cole Faust4e9f5922024-11-13 16:09:23 -0800486 output := android.PathForModuleOut(ctx, filename)
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100487 ip := installProperties{
488 filename: filename,
489 sourceFilePath: src,
490 outputFilePath: output,
Douglas Anderson79688ff2024-09-27 15:08:33 -0700491 installDirPath: installDirPath,
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100492 }
493 p.outputFilePaths = append(p.outputFilePaths, output)
494 installs = append(installs, ip)
Douglas Anderson79688ff2024-09-27 15:08:33 -0700495 p.installDirPaths = append(p.installDirPaths, installDirPath)
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100496 }
497 } else if ctx.Config().AllowMissingDependencies() {
498 // If no srcs was set and AllowMissingDependencies is enabled then
499 // mark the module as missing dependencies and set a fake source path
500 // and file name.
501 ctx.AddMissingDependencies([]string{"MISSING_PREBUILT_SRC_FILE"})
502 p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)}
503 if filename == "" {
504 filename = ctx.ModuleName()
505 }
Cole Faust4e9f5922024-11-13 16:09:23 -0800506 p.outputFilePaths = android.WritablePaths{android.PathForModuleOut(ctx, filename)}
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100507 ip := installProperties{
508 filename: filename,
509 sourceFilePath: p.sourceFilePaths[0],
510 outputFilePath: p.outputFilePaths[0],
Douglas Anderson79688ff2024-09-27 15:08:33 -0700511 installDirPath: baseInstallDirPath,
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100512 }
513 installs = append(installs, ip)
Douglas Anderson79688ff2024-09-27 15:08:33 -0700514 p.installDirPaths = append(p.installDirPaths, baseInstallDirPath)
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100515 } else {
516 ctx.PropertyErrorf("src", "missing prebuilt source file")
517 return
518 }
519
520 // Call InstallFile even when uninstallable to make the module included in the package.
521 if !p.Installable() {
522 p.SkipInstall()
523 }
524 for _, ip := range installs {
525 ip.addInstallRules(ctx)
526 }
mrziwang89371762024-06-11 12:42:24 -0700527
mrziwanga25adf32025-02-05 23:50:55 +0000528 p.updateModuleInfoJSON(ctx)
529
mrziwang89371762024-06-11 12:42:24 -0700530 ctx.SetOutputFiles(p.outputFilePaths.Paths(), "")
Yu Liu0a37d422025-02-13 02:05:00 +0000531
532 SetCommonPrebuiltEtcInfo(ctx, p)
533}
534
535func SetCommonPrebuiltEtcInfo(ctx android.ModuleContext, p PrebuiltEtcModule) {
536 android.SetProvider(ctx, PrebuiltEtcInfoProvider, PrebuiltEtcInfo{
537 BaseDir: p.BaseDir(),
538 SubDir: p.SubDir(),
539 })
Spandan Das756d3402023-06-05 22:49:50 +0000540}
Jiyong Parkf9f68052020-09-29 20:15:08 +0900541
mrziwanga25adf32025-02-05 23:50:55 +0000542func (p *PrebuiltEtc) updateModuleInfoJSON(ctx android.ModuleContext) {
543 moduleInfoJSON := ctx.ModuleInfoJSON()
544 moduleInfoJSON.Class = []string{"ETC"}
545 if p.makeClass != "" {
546 moduleInfoJSON.Class = []string{p.makeClass}
547 }
548 moduleInfoJSON.SystemSharedLibs = []string{"none"}
549 moduleInfoJSON.Tags = []string{"optional"}
550}
551
Spandan Das756d3402023-06-05 22:49:50 +0000552type installProperties struct {
Spandan Das756d3402023-06-05 22:49:50 +0000553 filename string
554 sourceFilePath android.Path
Cole Faust4e9f5922024-11-13 16:09:23 -0800555 outputFilePath android.WritablePath
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100556 installDirPath android.InstallPath
Spandan Das756d3402023-06-05 22:49:50 +0000557 symlinks []string
558}
559
560// utility function to add install rules to the build graph.
561// Reduces code duplication between Soong and Mixed build analysis
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100562func (ip *installProperties) addInstallRules(ctx android.ModuleContext) {
Spandan Das756d3402023-06-05 22:49:50 +0000563 // Copy the file from src to a location in out/ with the correct `filename`
564 // This ensures that outputFilePath has the correct name for others to
565 // use, as the source file may have a different name.
Spandan Das756d3402023-06-05 22:49:50 +0000566 ctx.Build(pctx, android.BuildParams{
567 Rule: android.Cp,
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100568 Output: ip.outputFilePath,
Spandan Das756d3402023-06-05 22:49:50 +0000569 Input: ip.sourceFilePath,
570 })
571
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100572 installPath := ctx.InstallFile(ip.installDirPath, ip.filename, ip.outputFilePath)
Spandan Das756d3402023-06-05 22:49:50 +0000573 for _, sl := range ip.symlinks {
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100574 ctx.InstallSymlink(ip.installDirPath, sl, installPath)
Jiyong Parkf9f68052020-09-29 20:15:08 +0900575 }
Jiyong Parkc678ad32018-04-10 13:07:10 +0900576}
577
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700578func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries {
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700579 nameSuffix := ""
Yifan Hong1b3348d2020-01-21 15:53:22 -0800580 if p.inRamdisk() && !p.onlyInRamdisk() {
581 nameSuffix = ".ramdisk"
582 }
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700583 if p.inVendorRamdisk() && !p.onlyInVendorRamdisk() {
584 nameSuffix = ".vendor_ramdisk"
585 }
Inseob Kim08758f02021-04-08 21:13:22 +0900586 if p.inDebugRamdisk() && !p.onlyInDebugRamdisk() {
587 nameSuffix = ".debug_ramdisk"
588 }
Kiyoung Kimae11c232021-07-19 11:38:04 +0900589 if p.InRecovery() && !p.onlyInRecovery() {
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700590 nameSuffix = ".recovery"
591 }
Colin Crossf17e2b52023-10-30 15:17:25 -0700592
593 class := p.makeClass
594 if class == "" {
595 class = "ETC"
596 }
597
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100598 return []android.AndroidMkEntries{{
Colin Crossf17e2b52023-10-30 15:17:25 -0700599 Class: class,
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700600 SubName: nameSuffix,
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100601 OutputFile: android.OptionalPathForPath(p.outputFilePaths[0]),
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700602 ExtraEntries: []android.AndroidMkExtraEntriesFunc{
Colin Crossaa255532020-07-03 13:18:24 -0700603 func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700604 entries.SetString("LOCAL_MODULE_TAGS", "optional")
Douglas Anderson79688ff2024-09-27 15:08:33 -0700605 entries.SetString("LOCAL_MODULE_PATH", p.installDirPaths[0].String())
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100606 entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePaths[0].Base())
Yo Chiang3d64d492020-05-27 17:56:39 +0800607 if len(p.properties.Symlinks) > 0 {
608 entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...)
609 }
Yo Chiang803c40d2020-11-16 20:32:51 +0800610 entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.Installable())
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700611 if p.additionalDependencies != nil {
Yo Chiang803c40d2020-11-16 20:32:51 +0800612 entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", p.additionalDependencies.Strings()...)
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900613 }
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700614 },
Jiyong Parkc678ad32018-04-10 13:07:10 +0900615 },
Jiyong Park0b0e1b92019-12-03 13:24:29 +0900616 }}
Jiyong Parkc678ad32018-04-10 13:07:10 +0900617}
618
LaMont Jonesafe7baf2024-01-09 22:47:39 +0000619func (p *PrebuiltEtc) AndroidModuleBase() *android.ModuleBase {
620 return &p.ModuleBase
621}
622
Jooyung Hana0171822019-07-22 15:48:36 +0900623func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {
624 p.installDirBase = dirBase
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900625 p.AddProperties(&p.properties)
Inseob Kim27408bf2021-04-06 21:00:17 +0900626 p.AddProperties(&p.subdirProperties)
Jihoon Kang320ca7c2024-12-03 18:14:50 +0000627 p.AddProperties(&p.rootProperties)
Jihoon Kangf729d2e2025-03-12 22:24:52 +0000628 p.AddProperties(&p.dstsProperties)
Inseob Kim27408bf2021-04-06 21:00:17 +0900629}
630
631func InitPrebuiltRootModule(p *PrebuiltEtc) {
632 p.installDirBase = "."
Nelson Li1fb94b22024-07-09 17:04:52 +0800633 p.AddProperties(&p.properties)
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900634 p.AddProperties(&p.rootProperties)
Nelson Li1fb94b22024-07-09 17:04:52 +0800635}
636
637func InitPrebuiltAvbModule(p *PrebuiltEtc) {
638 p.installDirBase = "avb"
Inseob Kim27408bf2021-04-06 21:00:17 +0900639 p.AddProperties(&p.properties)
Jihoon Kangf729d2e2025-03-12 22:24:52 +0000640 p.AddProperties(&p.dstsProperties)
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900641 p.rootProperties.Install_in_root = proptools.BoolPtr(true)
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900642}
Jiyong Parkc678ad32018-04-10 13:07:10 +0900643
Patrice Arruda9e14b962019-03-11 15:58:50 -0700644// prebuilt_etc is for a prebuilt artifact that is installed in
645// <partition>/etc/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700646func PrebuiltEtcFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900647 module := &PrebuiltEtc{}
648 InitPrebuiltEtcModule(module, "etc")
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900649 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700650 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Inseob Kim1e27a142021-05-06 11:46:11 +0000651 android.InitDefaultableModule(module)
652 return module
653}
654
655func defaultsFactory() android.Module {
656 return DefaultsFactory()
657}
658
659func DefaultsFactory(props ...interface{}) android.Module {
660 module := &Defaults{}
661
662 module.AddProperties(props...)
663 module.AddProperties(
Jihoon Kang69725b32024-11-12 03:08:49 +0000664 &PrebuiltEtcProperties{},
Inseob Kim1e27a142021-05-06 11:46:11 +0000665 &prebuiltSubdirProperties{},
666 )
667
668 android.InitDefaultsModule(module)
669
Jiyong Parkc678ad32018-04-10 13:07:10 +0900670 return module
671}
Tao Bao0ba5c942018-08-14 22:20:22 -0700672
Patrice Arruda9e14b962019-03-11 15:58:50 -0700673// prebuilt_etc_host is for a host prebuilt artifact that is installed in
674// $(HOST_OUT)/etc/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700675func PrebuiltEtcHostFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900676 module := &PrebuiltEtc{}
677 InitPrebuiltEtcModule(module, "etc")
Jaewoong Jung24788182019-02-04 14:34:10 -0800678 // This module is host-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700679 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100680 android.InitDefaultableModule(module)
Jaewoong Jung24788182019-02-04 14:34:10 -0800681 return module
682}
683
Jihoon Kang002767b2025-03-12 22:14:39 +0000684// prebuilt_any is a special module where the module can define the subdirectory that the files
685// are installed to. This is only used for converting the PRODUCT_COPY_FILES entries to Soong
686// modules, and should never be defined in the bp files. If none of the existing prebuilt_*
687// modules allow installing the file at the desired location, introduce a new prebuilt_* module
688// type instead.
689func PrebuiltAnyFactory() android.Module {
690 module := &PrebuiltEtc{}
691 InitPrebuiltEtcModule(module, ".")
692 // This module is device-only
693 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
694 android.InitDefaultableModule(module)
695 return module
696}
697
Miguel32b02802022-12-01 18:38:26 +0000698// prebuilt_etc_host is for a host prebuilt artifact that is installed in
699// <partition>/etc/<sub_dir> directory.
700func PrebuiltEtcCaCertsFactory() android.Module {
701 module := &PrebuiltEtc{}
702 InitPrebuiltEtcModule(module, "cacerts")
703 // This module is device-only
704 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Miguel32b02802022-12-01 18:38:26 +0000705 return module
706}
707
Nelson Li1fb94b22024-07-09 17:04:52 +0800708// Generally, a <partition> directory will contain a `system` subdirectory, but the <partition> of
709// `prebuilt_avb` will not have a `system` subdirectory.
710// Ultimately, prebuilt_avb will install the prebuilt artifact to the `avb` subdirectory under the
711// root directory of the partition: <partition_root>/avb.
712// prebuilt_avb does not allow adding any other subdirectories.
713func PrebuiltAvbFactory() android.Module {
714 module := &PrebuiltEtc{}
715 InitPrebuiltAvbModule(module)
716 // This module is device-only
717 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
718 android.InitDefaultableModule(module)
719 return module
720}
721
Inseob Kim27408bf2021-04-06 21:00:17 +0900722// prebuilt_root is for a prebuilt artifact that is installed in
723// <partition>/ directory. Can't have any sub directories.
724func PrebuiltRootFactory() android.Module {
725 module := &PrebuiltEtc{}
726 InitPrebuiltRootModule(module)
727 // This module is device-only
728 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100729 android.InitDefaultableModule(module)
Inseob Kim27408bf2021-04-06 21:00:17 +0900730 return module
731}
732
Liz Kammere9ecddc2022-01-04 17:27:52 -0500733// prebuilt_root_host is for a host prebuilt artifact that is installed in $(HOST_OUT)/<sub_dir>
734// directory.
735func PrebuiltRootHostFactory() android.Module {
736 module := &PrebuiltEtc{}
737 InitPrebuiltEtcModule(module, ".")
738 // This module is host-only
739 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
740 android.InitDefaultableModule(module)
741 return module
742}
743
Patrice Arruda9e14b962019-03-11 15:58:50 -0700744// prebuilt_usr_share is for a prebuilt artifact that is installed in
745// <partition>/usr/share/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700746func PrebuiltUserShareFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900747 module := &PrebuiltEtc{}
748 InitPrebuiltEtcModule(module, "usr/share")
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800749 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700750 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100751 android.InitDefaultableModule(module)
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800752 return module
753}
754
Patrice Arruda9e14b962019-03-11 15:58:50 -0700755// prebuild_usr_share_host is for a host prebuilt artifact that is installed in
756// $(HOST_OUT)/usr/share/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700757func PrebuiltUserShareHostFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900758 module := &PrebuiltEtc{}
759 InitPrebuiltEtcModule(module, "usr/share")
Patrice Arruda300cef92019-02-22 15:47:57 -0800760 // This module is host-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700761 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100762 android.InitDefaultableModule(module)
Patrice Arruda300cef92019-02-22 15:47:57 -0800763 return module
764}
765
yangbill63c5e192024-03-27 09:02:12 +0000766// prebuilt_usr_hyphendata is for a prebuilt artifact that is installed in
767// <partition>/usr/hyphen-data/<sub_dir> directory.
768func PrebuiltUserHyphenDataFactory() android.Module {
769 module := &PrebuiltEtc{}
770 InitPrebuiltEtcModule(module, "usr/hyphen-data")
771 // This module is device-only
772 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
773 android.InitDefaultableModule(module)
774 return module
775}
776
yangbill85527e62024-04-30 08:24:50 +0000777// prebuilt_usr_keylayout is for a prebuilt artifact that is installed in
778// <partition>/usr/keylayout/<sub_dir> directory.
779func PrebuiltUserKeyLayoutFactory() android.Module {
780 module := &PrebuiltEtc{}
781 InitPrebuiltEtcModule(module, "usr/keylayout")
782 // This module is device-only
783 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
784 android.InitDefaultableModule(module)
785 return module
786}
787
788// prebuilt_usr_keychars is for a prebuilt artifact that is installed in
789// <partition>/usr/keychars/<sub_dir> directory.
790func PrebuiltUserKeyCharsFactory() android.Module {
791 module := &PrebuiltEtc{}
792 InitPrebuiltEtcModule(module, "usr/keychars")
793 // This module is device-only
794 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
795 android.InitDefaultableModule(module)
796 return module
797}
798
799// prebuilt_usr_idc is for a prebuilt artifact that is installed in
800// <partition>/usr/idc/<sub_dir> directory.
801func PrebuiltUserIdcFactory() android.Module {
802 module := &PrebuiltEtc{}
803 InitPrebuiltEtcModule(module, "usr/idc")
804 // This module is device-only
805 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
806 android.InitDefaultableModule(module)
807 return module
808}
809
Jihoon Kang0da5ae92024-10-29 23:24:17 +0000810// prebuilt_usr_srec is for a prebuilt artifact that is installed in
811// <partition>/usr/srec/<sub_dir> directory.
812func PrebuiltUserSrecFactory() android.Module {
813 module := &PrebuiltEtc{}
814 InitPrebuiltEtcModule(module, "usr/srec")
815 // This module is device-only
816 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
817 android.InitDefaultableModule(module)
818 return module
819}
820
Agi Sferro243c7d72025-02-24 15:45:53 -0800821// prebuilt_usr_odml is for a prebuilt artifact that is installed in
822// <partition>/usr/odml/<sub_dir> directory.
823func PrebuiltUserOdmlFactory() android.Module {
824 module := &PrebuiltEtc{}
825 InitPrebuiltEtcModule(module, "usr/odml")
826 // This module is device-only
827 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
828 android.InitDefaultableModule(module)
829 return module
830}
831
Patrice Arruda61583eb2019-05-14 08:20:45 -0700832// prebuilt_font installs a font in <partition>/fonts directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700833func PrebuiltFontFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900834 module := &PrebuiltEtc{}
835 InitPrebuiltEtcModule(module, "fonts")
Patrice Arruda61583eb2019-05-14 08:20:45 -0700836 // This module is device-only
Cole Faustc49443e2024-10-29 11:15:34 -0700837 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100838 android.InitDefaultableModule(module)
Patrice Arruda61583eb2019-05-14 08:20:45 -0700839 return module
840}
Patrice Arruda057a8b12019-06-03 15:29:27 -0700841
Kevin93f7cd82024-05-02 12:37:59 +0200842// prebuilt_overlay is for a prebuilt artifact in <partition>/overlay directory.
843func PrebuiltOverlayFactory() android.Module {
844 module := &PrebuiltEtc{}
845 InitPrebuiltEtcModule(module, "overlay")
846 // This module is device-only
847 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
848 return module
849}
850
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800851// prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system
852// image.
853// If soc_specific property is set to true, the firmware file is installed to the
854// vendor <partition>/firmware directory for vendor image.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700855func PrebuiltFirmwareFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900856 module := &PrebuiltEtc{}
857 module.socInstallDirBase = "firmware"
858 InitPrebuiltEtcModule(module, "etc/firmware")
Patrice Arruda057a8b12019-06-03 15:29:27 -0700859 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700860 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100861 android.InitDefaultableModule(module)
Patrice Arruda057a8b12019-06-03 15:29:27 -0700862 return module
863}
Patrice Arruda0f688002020-06-08 21:40:25 +0000864
Luca Stefani04812eb2025-03-09 12:41:06 +0100865// prebuilt_gpu is for a prebuilt artifact in <partition>/gpu directory.
866func PrebuiltGPUFactory() android.Module {
867 module := &PrebuiltEtc{}
868 InitPrebuiltEtcModule(module, "gpu")
869 // This module is device-only
870 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
871 return module
872}
873
Patrice Arruda0f688002020-06-08 21:40:25 +0000874// prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image.
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800875// If soc_specific property is set to true, the DSP related file is installed to the
876// vendor <partition>/dsp directory for vendor image.
Patrice Arruda0f688002020-06-08 21:40:25 +0000877func PrebuiltDSPFactory() android.Module {
878 module := &PrebuiltEtc{}
879 module.socInstallDirBase = "dsp"
880 InitPrebuiltEtcModule(module, "etc/dsp")
881 // This module is device-only
882 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100883 android.InitDefaultableModule(module)
Patrice Arruda0f688002020-06-08 21:40:25 +0000884 return module
885}
Colin Cross83ebf232021-04-09 09:41:23 -0700886
Colin Crossf17e2b52023-10-30 15:17:25 -0700887// prebuilt_renderscript_bitcode installs a *.bc file into /system/lib or /system/lib64.
888func PrebuiltRenderScriptBitcodeFactory() android.Module {
889 module := &PrebuiltEtc{}
890 module.makeClass = "RENDERSCRIPT_BITCODE"
891 module.installDirBase64 = "lib64"
Colin Cross2f634572023-11-13 12:12:06 -0800892 module.installAvoidMultilibConflict = true
Colin Crossf17e2b52023-10-30 15:17:25 -0700893 InitPrebuiltEtcModule(module, "lib")
894 // This module is device-only
895 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth)
896 android.InitDefaultableModule(module)
897 return module
898}
899
Colin Cross83ebf232021-04-09 09:41:23 -0700900// prebuilt_rfsa installs a firmware file that will be available through Qualcomm's RFSA
901// to the <partition>/lib/rfsa directory.
902func PrebuiltRFSAFactory() android.Module {
903 module := &PrebuiltEtc{}
904 // Ideally these would go in /vendor/dsp, but the /vendor/lib/rfsa paths are hardcoded in too
905 // many places outside of the application processor. They could be moved to /vendor/dsp once
906 // that is cleaned up.
907 InitPrebuiltEtcModule(module, "lib/rfsa")
908 // This module is device-only
909 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100910 android.InitDefaultableModule(module)
Colin Cross83ebf232021-04-09 09:41:23 -0700911 return module
912}
Jihoon Kang2ecf8622024-10-23 21:20:30 +0000913
Tim Zimmermann82c066d2025-03-12 06:28:34 +0100914// prebuilt_tee installs files in <partition>/tee directory.
915func PrebuiltTeeFactory() android.Module {
916 module := &PrebuiltEtc{}
917 InitPrebuiltEtcModule(module, "tee")
918 // This module is device-only
919 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
920 android.InitDefaultableModule(module)
921 return module
922}
923
Jihoon Kang0da5ae92024-10-29 23:24:17 +0000924// prebuilt_media installs media files in <partition>/media directory.
925func PrebuiltMediaFactory() android.Module {
Jihoon Kang2ecf8622024-10-23 21:20:30 +0000926 module := &PrebuiltEtc{}
Jihoon Kang0da5ae92024-10-29 23:24:17 +0000927 InitPrebuiltEtcModule(module, "media")
Jihoon Kang2ecf8622024-10-23 21:20:30 +0000928 // This module is device-only
929 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
930 android.InitDefaultableModule(module)
931 return module
932}
Jihoon Kangec62d842024-10-25 20:27:18 +0000933
934// prebuilt_voicepack installs voice pack files in <partition>/tts directory.
935func PrebuiltVoicepackFactory() android.Module {
936 module := &PrebuiltEtc{}
937 InitPrebuiltEtcModule(module, "tts")
938 // This module is device-only
939 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
940 android.InitDefaultableModule(module)
941 return module
942}
943
944// prebuilt_bin installs files in <partition>/bin directory.
945func PrebuiltBinaryFactory() android.Module {
946 module := &PrebuiltEtc{}
947 InitPrebuiltEtcModule(module, "bin")
948 // This module is device-only
949 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
950 android.InitDefaultableModule(module)
951 return module
952}
953
954// prebuilt_wallpaper installs image files in <partition>/wallpaper directory.
955func PrebuiltWallpaperFactory() android.Module {
956 module := &PrebuiltEtc{}
957 InitPrebuiltEtcModule(module, "wallpaper")
958 // This module is device-only
959 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
960 android.InitDefaultableModule(module)
961 return module
962}
Jihoon Kang0da5ae92024-10-29 23:24:17 +0000963
964// prebuilt_priv_app installs files in <partition>/priv-app directory.
965func PrebuiltPrivAppFactory() android.Module {
966 module := &PrebuiltEtc{}
967 InitPrebuiltEtcModule(module, "priv-app")
968 // This module is device-only
969 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
970 android.InitDefaultableModule(module)
971 return module
972}
973
Michael Bestas137fab42025-03-08 20:44:34 +0200974// prebuilt_radio installs files in <partition>/radio directory.
975func PrebuiltRadioFactory() android.Module {
976 module := &PrebuiltEtc{}
977 InitPrebuiltEtcModule(module, "radio")
978 // This module is device-only
979 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
980 android.InitDefaultableModule(module)
981 return module
982}
983
Jihoon Kang0da5ae92024-10-29 23:24:17 +0000984// prebuilt_rfs installs files in <partition>/rfs directory.
985func PrebuiltRfsFactory() android.Module {
986 module := &PrebuiltEtc{}
987 InitPrebuiltEtcModule(module, "rfs")
988 // This module is device-only
989 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
990 android.InitDefaultableModule(module)
991 return module
992}
993
994// prebuilt_framework installs files in <partition>/framework directory.
995func PrebuiltFrameworkFactory() android.Module {
996 module := &PrebuiltEtc{}
997 InitPrebuiltEtcModule(module, "framework")
998 // This module is device-only
999 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1000 android.InitDefaultableModule(module)
1001 return module
1002}
1003
1004// prebuilt_res installs files in <partition>/res directory.
1005func PrebuiltResFactory() android.Module {
1006 module := &PrebuiltEtc{}
1007 InitPrebuiltEtcModule(module, "res")
1008 // This module is device-only
1009 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1010 android.InitDefaultableModule(module)
1011 return module
1012}
1013
1014// prebuilt_wlc_upt installs files in <partition>/wlc_upt directory.
1015func PrebuiltWlcUptFactory() android.Module {
1016 module := &PrebuiltEtc{}
1017 InitPrebuiltEtcModule(module, "wlc_upt")
1018 // This module is device-only
1019 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1020 android.InitDefaultableModule(module)
1021 return module
1022}
1023
1024// prebuilt_odm installs files in <partition>/odm directory.
1025func PrebuiltOdmFactory() android.Module {
1026 module := &PrebuiltEtc{}
1027 InitPrebuiltEtcModule(module, "odm")
1028 // This module is device-only
1029 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1030 android.InitDefaultableModule(module)
1031 return module
1032}
Jihoon Kang2e2b7442024-11-05 00:26:20 +00001033
1034// prebuilt_vendor_dlkm installs files in <partition>/vendor_dlkm directory.
1035func PrebuiltVendorDlkmFactory() android.Module {
1036 module := &PrebuiltEtc{}
1037 InitPrebuiltEtcModule(module, "vendor_dlkm")
1038 // This module is device-only
1039 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1040 android.InitDefaultableModule(module)
1041 return module
1042}
1043
1044// prebuilt_bt_firmware installs files in <partition>/bt_firmware directory.
1045func PrebuiltBtFirmwareFactory() android.Module {
1046 module := &PrebuiltEtc{}
1047 InitPrebuiltEtcModule(module, "bt_firmware")
1048 // This module is device-only
1049 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1050 android.InitDefaultableModule(module)
1051 return module
1052}
Jihoon Kangdca2f2b2024-11-06 18:43:19 +00001053
1054// prebuilt_tvservice installs files in <partition>/tvservice directory.
1055func PrebuiltTvServiceFactory() android.Module {
1056 module := &PrebuiltEtc{}
1057 InitPrebuiltEtcModule(module, "tvservice")
1058 // This module is device-only
1059 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1060 android.InitDefaultableModule(module)
1061 return module
1062}
1063
1064// prebuilt_optee installs files in <partition>/optee directory.
1065func PrebuiltOpteeFactory() android.Module {
1066 module := &PrebuiltEtc{}
1067 InitPrebuiltEtcModule(module, "optee")
1068 // This module is device-only
1069 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1070 android.InitDefaultableModule(module)
1071 return module
1072}
Jihoon Kangecf76dd2024-11-12 05:24:46 +00001073
1074// prebuilt_tvconfig installs files in <partition>/tvconfig directory.
1075func PrebuiltTvConfigFactory() android.Module {
1076 module := &PrebuiltEtc{}
1077 InitPrebuiltEtcModule(module, "tvconfig")
1078 // This module is device-only
1079 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1080 android.InitDefaultableModule(module)
1081 return module
1082}
Jihoon Kang3ca07a12024-12-02 19:14:30 +00001083
1084// prebuilt_vendor installs files in <partition>/vendor directory.
1085func PrebuiltVendorFactory() android.Module {
1086 module := &PrebuiltEtc{}
1087 InitPrebuiltEtcModule(module, "vendor")
1088 // This module is device-only
1089 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1090 android.InitDefaultableModule(module)
1091 return module
1092}
Jihoon Kang320ca7c2024-12-03 18:14:50 +00001093
Artem Borisov49f074b2025-03-11 23:19:26 +03001094// prebuilt_vendor_overlay is for a prebuilt artifact in <partition>/vendor_overlay directory.
1095func PrebuiltVendorOverlayFactory() android.Module {
1096 module := &PrebuiltEtc{}
1097 InitPrebuiltEtcModule(module, "vendor_overlay")
1098 // This module is device-only
1099 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1100 android.InitDefaultableModule(module)
1101 return module
1102}
1103
Jihoon Kang320ca7c2024-12-03 18:14:50 +00001104// prebuilt_sbin installs files in <partition>/sbin directory.
1105func PrebuiltSbinFactory() android.Module {
1106 module := &PrebuiltEtc{}
1107 InitPrebuiltEtcModule(module, "sbin")
1108 // This module is device-only
1109 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1110 android.InitDefaultableModule(module)
1111 return module
1112}
1113
1114// prebuilt_system installs files in <partition>/system directory.
1115func PrebuiltSystemFactory() android.Module {
1116 module := &PrebuiltEtc{}
1117 InitPrebuiltEtcModule(module, "system")
1118 // This module is device-only
1119 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1120 android.InitDefaultableModule(module)
1121 return module
1122}
1123
1124// prebuilt_first_stage_ramdisk installs files in <partition>/first_stage_ramdisk directory.
1125func PrebuiltFirstStageRamdiskFactory() android.Module {
1126 module := &PrebuiltEtc{}
1127 InitPrebuiltEtcModule(module, "first_stage_ramdisk")
1128 // This module is device-only
1129 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1130 android.InitDefaultableModule(module)
1131 return module
1132}