blob: 3b0c0329d94816bb4531b01060dc7adb67f6a76c [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)
81 ctx.RegisterModuleType("prebuilt_wlc_upt", PrebuiltWlcUptFactory)
82 ctx.RegisterModuleType("prebuilt_odm", PrebuiltOdmFactory)
Jihoon Kang2e2b7442024-11-05 00:26:20 +000083 ctx.RegisterModuleType("prebuilt_vendor_dlkm", PrebuiltVendorDlkmFactory)
Artem Borisov49f074b2025-03-11 23:19:26 +030084 ctx.RegisterModuleType("prebuilt_vendor_overlay", PrebuiltVendorOverlayFactory)
Jihoon Kang2e2b7442024-11-05 00:26:20 +000085 ctx.RegisterModuleType("prebuilt_bt_firmware", PrebuiltBtFirmwareFactory)
Jihoon Kangdca2f2b2024-11-06 18:43:19 +000086 ctx.RegisterModuleType("prebuilt_tvservice", PrebuiltTvServiceFactory)
87 ctx.RegisterModuleType("prebuilt_optee", PrebuiltOpteeFactory)
Jihoon Kangecf76dd2024-11-12 05:24:46 +000088 ctx.RegisterModuleType("prebuilt_tvconfig", PrebuiltTvConfigFactory)
Jihoon Kang3ca07a12024-12-02 19:14:30 +000089 ctx.RegisterModuleType("prebuilt_vendor", PrebuiltVendorFactory)
Jihoon Kang320ca7c2024-12-03 18:14:50 +000090 ctx.RegisterModuleType("prebuilt_sbin", PrebuiltSbinFactory)
91 ctx.RegisterModuleType("prebuilt_system", PrebuiltSystemFactory)
92 ctx.RegisterModuleType("prebuilt_first_stage_ramdisk", PrebuiltFirstStageRamdiskFactory)
Jihoon Kang002767b2025-03-12 22:14:39 +000093 ctx.RegisterModuleType("prebuilt_any", PrebuiltAnyFactory)
Inseob Kim1e27a142021-05-06 11:46:11 +000094
95 ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory)
Rupert Shuttleworth378fc1b2021-07-28 08:03:16 -040096
Jiyong Parkc678ad32018-04-10 13:07:10 +090097}
98
Yu Liu0a37d422025-02-13 02:05:00 +000099type PrebuiltEtcInfo struct {
100 // Returns the base install directory, such as "etc", "usr/share".
101 BaseDir string
102 // Returns the sub install directory relative to BaseDir().
103 SubDir string
104}
105
106var PrebuiltEtcInfoProvider = blueprint.NewProvider[PrebuiltEtcInfo]()
107
Paul Duffin1172fed2021-03-08 11:28:18 +0000108var PrepareForTestWithPrebuiltEtc = android.FixtureRegisterWithContext(RegisterPrebuiltEtcBuildComponents)
109
Jihoon Kang69725b32024-11-12 03:08:49 +0000110type PrebuiltEtcProperties struct {
Yo Chiang803c40d2020-11-16 20:32:51 +0800111 // Source file of this prebuilt. Can reference a genrule type module with the ":module" syntax.
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100112 // Mutually exclusive with srcs.
Cole Faustfdec8722024-05-22 11:38:29 -0700113 Src proptools.Configurable[string] `android:"path,arch_variant,replace_instead_of_append"`
Jiyong Parkc678ad32018-04-10 13:07:10 +0900114
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100115 // Source files of this prebuilt. Can reference a genrule type module with the ":module" syntax.
Douglas Anderson79688ff2024-09-27 15:08:33 -0700116 // Mutually exclusive with src. When used, filename_from_src is set to true unless dsts is also
117 // set. May use globs in filenames.
Cole Faustfdec8722024-05-22 11:38:29 -0700118 Srcs proptools.Configurable[[]string] `android:"path,arch_variant"`
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100119
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800120 // 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 +1100121 // name. Only available when using a single source (src).
Jiyong Park139a2e62018-10-26 21:49:39 +0900122 Filename *string `android:"arch_variant"`
123
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800124 // When set to true, and filename property is not set, the name for the installed file
Jiyong Park1a7cf082018-11-13 11:59:12 +0900125 // is the same as the file name of the source file.
126 Filename_from_src *bool `android:"arch_variant"`
127
Yifan Hong1b3348d2020-01-21 15:53:22 -0800128 // Make this module available when building for ramdisk.
Yifan Hong39143a92020-10-26 12:43:12 -0700129 // On device without a dedicated recovery partition, the module is only
130 // available after switching root into
131 // /first_stage_ramdisk. To expose the module before switching root, install
132 // the recovery variant instead.
Yifan Hong1b3348d2020-01-21 15:53:22 -0800133 Ramdisk_available *bool
134
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700135 // Make this module available when building for vendor ramdisk.
Yifan Hong39143a92020-10-26 12:43:12 -0700136 // On device without a dedicated recovery partition, the module is only
137 // available after switching root into
138 // /first_stage_ramdisk. To expose the module before switching root, install
139 // the recovery variant instead.
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700140 Vendor_ramdisk_available *bool
141
Inseob Kim08758f02021-04-08 21:13:22 +0900142 // Make this module available when building for debug ramdisk.
143 Debug_ramdisk_available *bool
144
Tao Bao0ba5c942018-08-14 22:20:22 -0700145 // Make this module available when building for recovery.
146 Recovery_available *bool
147
Jiyong Parkad9ce042018-10-31 22:49:57 +0900148 // Whether this module is directly installable to one of the partitions. Default: true.
149 Installable *bool
Yo Chiang3d64d492020-05-27 17:56:39 +0800150
151 // Install symlinks to the installed file.
152 Symlinks []string `android:"arch_variant"`
Wei Li59586252024-11-04 09:25:54 -0800153
Wei Li59586252024-11-04 09:25:54 -0800154 // Install to partition oem when set to true.
155 Oem_specific *bool `android:"arch_variant"`
Jiyong Parkc678ad32018-04-10 13:07:10 +0900156}
157
Jihoon Kangf729d2e2025-03-12 22:24:52 +0000158// Dsts is useful in that it allows prebuilt_* modules to easily map the source files to the
159// install path within the partition. Dsts values are allowed to contain filepath separator
160// so that the source files can be installed in subdirectories within the partition.
161// However, this functionality should not be supported for prebuilt_root module type, as it
162// allows the module to install to any arbitrary location. Thus, this property is defined in
163// a separate struct so that it's not available to be set in prebuilt_root module type.
164type PrebuiltDstsProperties struct {
165 // Destination files of this prebuilt. Requires srcs to be used and causes srcs not to implicitly
166 // set filename_from_src. This can be used to install each source file to a different directory
167 // and/or change filenames when files are installed. Must be exactly one entry per source file,
168 // which means care must be taken if srcs has globs.
169 Dsts proptools.Configurable[[]string] `android:"path,arch_variant"`
170}
171
Inseob Kim27408bf2021-04-06 21:00:17 +0900172type prebuiltSubdirProperties struct {
173 // Optional subdirectory under which this file is installed into, cannot be specified with
174 // relative_install_path, prefer relative_install_path.
175 Sub_dir *string `android:"arch_variant"`
176
177 // Optional subdirectory under which this file is installed into, cannot be specified with
178 // sub_dir.
179 Relative_install_path *string `android:"arch_variant"`
180}
181
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900182type prebuiltRootProperties struct {
183 // Install this module to the root directory, without partition subdirs. When this module is
184 // added to PRODUCT_PACKAGES, this module will be installed to $PRODUCT_OUT/root, which will
185 // then be copied to the root of system.img. When this module is packaged by other modules like
186 // android_filesystem, this module will be installed to the root ("/"), unlike normal
187 // prebuilt_root modules which are installed to the partition subdir (e.g. "/system/").
188 Install_in_root *bool
189}
190
Jooyung Han39edb6c2019-11-06 16:53:07 +0900191type PrebuiltEtcModule interface {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700192 android.Module
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800193
194 // Returns the base install directory, such as "etc", "usr/share".
Jooyung Han0703fd82020-08-26 22:11:53 +0900195 BaseDir() string
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800196
197 // Returns the sub install directory relative to BaseDir().
Jooyung Han39edb6c2019-11-06 16:53:07 +0900198 SubDir() string
Jooyung Han39edb6c2019-11-06 16:53:07 +0900199}
200
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900201type PrebuiltEtc struct {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700202 android.ModuleBase
Inseob Kim1e27a142021-05-06 11:46:11 +0000203 android.DefaultableModuleBase
Jiyong Parkc678ad32018-04-10 13:07:10 +0900204
Jihoon Kang69725b32024-11-12 03:08:49 +0000205 properties PrebuiltEtcProperties
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900206
Jihoon Kangf729d2e2025-03-12 22:24:52 +0000207 dstsProperties PrebuiltDstsProperties
208
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900209 // rootProperties is used to return the value of the InstallInRoot() method. Currently, only
210 // prebuilt_avb and prebuilt_root modules use this.
211 rootProperties prebuiltRootProperties
212
Inseob Kim27408bf2021-04-06 21:00:17 +0900213 subdirProperties prebuiltSubdirProperties
Jiyong Parkc678ad32018-04-10 13:07:10 +0900214
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100215 sourceFilePaths android.Paths
Cole Faust4e9f5922024-11-13 16:09:23 -0800216 outputFilePaths android.WritablePaths
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800217 // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share.
Colin Cross2f634572023-11-13 12:12:06 -0800218 installDirBase string
219 installDirBase64 string
220 installAvoidMultilibConflict bool
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800221 // The base install location when soc_specific property is set to true, e.g. "firmware" for
222 // prebuilt_firmware.
Patrice Arruda057a8b12019-06-03 15:29:27 -0700223 socInstallDirBase string
Douglas Anderson79688ff2024-09-27 15:08:33 -0700224 installDirPaths []android.InstallPath
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700225 additionalDependencies *android.Paths
Colin Crossf17e2b52023-10-30 15:17:25 -0700226
Cole Faustfdec8722024-05-22 11:38:29 -0700227 usedSrcsProperty bool
228
Colin Crossf17e2b52023-10-30 15:17:25 -0700229 makeClass string
Jiyong Parkc678ad32018-04-10 13:07:10 +0900230}
231
Inseob Kim1e27a142021-05-06 11:46:11 +0000232type Defaults struct {
233 android.ModuleBase
234 android.DefaultsModuleBase
235}
236
Yifan Hong1b3348d2020-01-21 15:53:22 -0800237func (p *PrebuiltEtc) inRamdisk() bool {
238 return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk()
239}
240
241func (p *PrebuiltEtc) onlyInRamdisk() bool {
242 return p.ModuleBase.InstallInRamdisk()
243}
244
245func (p *PrebuiltEtc) InstallInRamdisk() bool {
246 return p.inRamdisk()
247}
248
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700249func (p *PrebuiltEtc) inVendorRamdisk() bool {
250 return p.ModuleBase.InVendorRamdisk() || p.ModuleBase.InstallInVendorRamdisk()
251}
252
253func (p *PrebuiltEtc) onlyInVendorRamdisk() bool {
254 return p.ModuleBase.InstallInVendorRamdisk()
255}
256
257func (p *PrebuiltEtc) InstallInVendorRamdisk() bool {
258 return p.inVendorRamdisk()
259}
260
Inseob Kim08758f02021-04-08 21:13:22 +0900261func (p *PrebuiltEtc) inDebugRamdisk() bool {
262 return p.ModuleBase.InDebugRamdisk() || p.ModuleBase.InstallInDebugRamdisk()
263}
264
265func (p *PrebuiltEtc) onlyInDebugRamdisk() bool {
266 return p.ModuleBase.InstallInDebugRamdisk()
267}
268
269func (p *PrebuiltEtc) InstallInDebugRamdisk() bool {
270 return p.inDebugRamdisk()
271}
272
Kiyoung Kimae11c232021-07-19 11:38:04 +0900273func (p *PrebuiltEtc) InRecovery() bool {
Colin Cross7228ecd2019-11-18 16:00:16 -0800274 return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery()
Tao Bao0ba5c942018-08-14 22:20:22 -0700275}
276
277func (p *PrebuiltEtc) onlyInRecovery() bool {
278 return p.ModuleBase.InstallInRecovery()
279}
280
281func (p *PrebuiltEtc) InstallInRecovery() bool {
Kiyoung Kimae11c232021-07-19 11:38:04 +0900282 return p.InRecovery()
Tao Bao0ba5c942018-08-14 22:20:22 -0700283}
284
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700285var _ android.ImageInterface = (*PrebuiltEtc)(nil)
Colin Cross7228ecd2019-11-18 16:00:16 -0800286
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700287func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.ImageInterfaceContext) {}
Colin Cross7228ecd2019-11-18 16:00:16 -0800288
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700289func (p *PrebuiltEtc) VendorVariantNeeded(ctx android.ImageInterfaceContext) bool {
Jihoon Kang47e91842024-06-19 00:51:16 +0000290 return false
291}
292
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700293func (p *PrebuiltEtc) ProductVariantNeeded(ctx android.ImageInterfaceContext) bool {
Jihoon Kang47e91842024-06-19 00:51:16 +0000294 return false
295}
296
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700297func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.ImageInterfaceContext) bool {
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700298 return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() &&
Inseob Kim08758f02021-04-08 21:13:22 +0900299 !p.ModuleBase.InstallInVendorRamdisk() && !p.ModuleBase.InstallInDebugRamdisk()
Yifan Hong1b3348d2020-01-21 15:53:22 -0800300}
301
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700302func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700303 return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk()
Colin Cross7228ecd2019-11-18 16:00:16 -0800304}
305
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700306func (p *PrebuiltEtc) VendorRamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool {
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700307 return proptools.Bool(p.properties.Vendor_ramdisk_available) || p.ModuleBase.InstallInVendorRamdisk()
308}
309
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700310func (p *PrebuiltEtc) DebugRamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool {
Inseob Kim08758f02021-04-08 21:13:22 +0900311 return proptools.Bool(p.properties.Debug_ramdisk_available) || p.ModuleBase.InstallInDebugRamdisk()
312}
313
Nelson Li1fb94b22024-07-09 17:04:52 +0800314func (p *PrebuiltEtc) InstallInRoot() bool {
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900315 return proptools.Bool(p.rootProperties.Install_in_root)
Nelson Li1fb94b22024-07-09 17:04:52 +0800316}
317
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700318func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.ImageInterfaceContext) bool {
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700319 return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery()
Colin Cross7228ecd2019-11-18 16:00:16 -0800320}
321
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700322func (p *PrebuiltEtc) ExtraImageVariations(ctx android.ImageInterfaceContext) []string {
Colin Cross7228ecd2019-11-18 16:00:16 -0800323 return nil
324}
325
Cole Faustfa6e0fd2024-10-15 15:22:57 -0700326func (p *PrebuiltEtc) SetImageVariation(ctx android.ImageInterfaceContext, variation string) {
Colin Cross7228ecd2019-11-18 16:00:16 -0800327}
328
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700329func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path {
Cole Faustfdec8722024-05-22 11:38:29 -0700330 if len(p.properties.Srcs.GetOrDefault(ctx, nil)) > 0 {
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100331 panic(fmt.Errorf("SourceFilePath not available on multi-source prebuilt %q", p.Name()))
332 }
Cole Faustfdec8722024-05-22 11:38:29 -0700333 return android.PathForModuleSrc(ctx, p.properties.Src.GetOrDefault(ctx, ""))
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900334}
335
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700336func (p *PrebuiltEtc) InstallDirPath() android.InstallPath {
Douglas Anderson79688ff2024-09-27 15:08:33 -0700337 if len(p.installDirPaths) != 1 {
338 panic(fmt.Errorf("InstallDirPath not available on multi-source prebuilt %q", p.Name()))
339 }
340 return p.installDirPaths[0]
Jooyung Hana0171822019-07-22 15:48:36 +0900341}
342
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900343// This allows other derivative modules (e.g. prebuilt_etc_xml) to perform
344// additional steps (like validating the src) before the file is installed.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700345func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) {
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900346 p.additionalDependencies = &paths
347}
348
Cole Faust4e9f5922024-11-13 16:09:23 -0800349func (p *PrebuiltEtc) OutputFile() android.Path {
Cole Faustfdec8722024-05-22 11:38:29 -0700350 if p.usedSrcsProperty {
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100351 panic(fmt.Errorf("OutputFile not available on multi-source prebuilt %q", p.Name()))
352 }
353 return p.outputFilePaths[0]
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900354}
355
356func (p *PrebuiltEtc) SubDir() string {
Inseob Kim27408bf2021-04-06 21:00:17 +0900357 if subDir := proptools.String(p.subdirProperties.Sub_dir); subDir != "" {
Liz Kammer0449a632020-06-26 10:12:36 -0700358 return subDir
359 }
Inseob Kim27408bf2021-04-06 21:00:17 +0900360 return proptools.String(p.subdirProperties.Relative_install_path)
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900361}
362
Jooyung Han0703fd82020-08-26 22:11:53 +0900363func (p *PrebuiltEtc) BaseDir() string {
Jooyung Han8e5685d2020-09-21 11:02:57 +0900364 return p.installDirBase
Jooyung Han0703fd82020-08-26 22:11:53 +0900365}
366
Jiyong Parkad9ce042018-10-31 22:49:57 +0900367func (p *PrebuiltEtc) Installable() bool {
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800368 return p.properties.Installable == nil || proptools.Bool(p.properties.Installable)
Jiyong Parkad9ce042018-10-31 22:49:57 +0900369}
370
Kiyoung Kimae11c232021-07-19 11:38:04 +0900371func (p *PrebuiltEtc) InVendor() bool {
372 return p.ModuleBase.InstallInVendor()
373}
374
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100375func (p *PrebuiltEtc) installBaseDir(ctx android.ModuleContext) string {
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800376 // If soc install dir was specified and SOC specific is set, set the installDirPath to the
377 // specified socInstallDirBase.
Jooyung Han8e5685d2020-09-21 11:02:57 +0900378 installBaseDir := p.installDirBase
Colin Crossf17e2b52023-10-30 15:17:25 -0700379 if p.Target().Arch.ArchType.Multilib == "lib64" && p.installDirBase64 != "" {
380 installBaseDir = p.installDirBase64
381 }
Jooyung Han8e5685d2020-09-21 11:02:57 +0900382 if p.SocSpecific() && p.socInstallDirBase != "" {
383 installBaseDir = p.socInstallDirBase
384 }
Colin Cross2f634572023-11-13 12:12:06 -0800385 if p.installAvoidMultilibConflict && !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
386 installBaseDir = filepath.Join(installBaseDir, ctx.Arch().ArchType.String())
387 }
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100388 return installBaseDir
389}
Colin Cross2f634572023-11-13 12:12:06 -0800390
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100391func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
392 var installs []installProperties
Jiyong Parkc43e0ac2018-10-04 20:27:15 +0900393
Cole Faustfdec8722024-05-22 11:38:29 -0700394 srcProperty := p.properties.Src.Get(ctx)
395 srcsProperty := p.properties.Srcs.GetOrDefault(ctx, nil)
396 if srcProperty.IsPresent() && len(srcsProperty) > 0 {
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100397 ctx.PropertyErrorf("src", "src is set. Cannot set srcs")
Spandan Das756d3402023-06-05 22:49:50 +0000398 }
Jihoon Kangf729d2e2025-03-12 22:24:52 +0000399 dstsProperty := p.dstsProperties.Dsts.GetOrDefault(ctx, nil)
Douglas Anderson79688ff2024-09-27 15:08:33 -0700400 if len(dstsProperty) > 0 && len(srcsProperty) == 0 {
401 ctx.PropertyErrorf("dsts", "dsts is set. Must use srcs")
402 }
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100403
404 // Check that `sub_dir` and `relative_install_path` are not set at the same time.
405 if p.subdirProperties.Sub_dir != nil && p.subdirProperties.Relative_install_path != nil {
406 ctx.PropertyErrorf("sub_dir", "relative_install_path is set. Cannot set sub_dir")
407 }
Douglas Anderson79688ff2024-09-27 15:08:33 -0700408 baseInstallDirPath := android.PathForModuleInstall(ctx, p.installBaseDir(ctx), p.SubDir())
Wei Li59586252024-11-04 09:25:54 -0800409 // TODO(b/377304441)
Spandan Das27ff7672024-11-06 19:23:57 +0000410 if android.Bool(p.properties.Oem_specific) {
Wei Li59586252024-11-04 09:25:54 -0800411 baseInstallDirPath = android.PathForModuleInPartitionInstall(ctx, ctx.DeviceConfig().OemPath(), p.installBaseDir(ctx), p.SubDir())
412 }
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100413
414 filename := proptools.String(p.properties.Filename)
415 filenameFromSrc := proptools.Bool(p.properties.Filename_from_src)
Cole Faustfdec8722024-05-22 11:38:29 -0700416 if srcProperty.IsPresent() {
417 p.sourceFilePaths = android.PathsForModuleSrc(ctx, []string{srcProperty.Get()})
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100418 // If the source was not found, set a fake source path to
419 // support AllowMissingDependencies executions.
420 if len(p.sourceFilePaths) == 0 {
421 p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)}
422 }
423
424 // Determine the output file basename.
425 // If Filename is set, use the name specified by the property.
426 // If Filename_from_src is set, use the source file name.
427 // Otherwise use the module name.
428 if filename != "" {
429 if filenameFromSrc {
430 ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true")
431 return
432 }
433 } else if filenameFromSrc {
434 filename = p.sourceFilePaths[0].Base()
435 } else {
436 filename = ctx.ModuleName()
437 }
438 if strings.Contains(filename, "/") {
439 ctx.PropertyErrorf("filename", "filename cannot contain separator '/'")
440 return
441 }
Cole Faust4e9f5922024-11-13 16:09:23 -0800442 p.outputFilePaths = android.WritablePaths{android.PathForModuleOut(ctx, filename)}
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100443
444 ip := installProperties{
445 filename: filename,
446 sourceFilePath: p.sourceFilePaths[0],
447 outputFilePath: p.outputFilePaths[0],
Douglas Anderson79688ff2024-09-27 15:08:33 -0700448 installDirPath: baseInstallDirPath,
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100449 symlinks: p.properties.Symlinks,
450 }
451 installs = append(installs, ip)
Douglas Anderson79688ff2024-09-27 15:08:33 -0700452 p.installDirPaths = append(p.installDirPaths, baseInstallDirPath)
Cole Faustfdec8722024-05-22 11:38:29 -0700453 } else if len(srcsProperty) > 0 {
454 p.usedSrcsProperty = true
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100455 if filename != "" {
456 ctx.PropertyErrorf("filename", "filename cannot be set when using srcs")
457 }
458 if len(p.properties.Symlinks) > 0 {
459 ctx.PropertyErrorf("symlinks", "symlinks cannot be set when using srcs")
460 }
461 if p.properties.Filename_from_src != nil {
Douglas Anderson79688ff2024-09-27 15:08:33 -0700462 if len(dstsProperty) > 0 {
463 ctx.PropertyErrorf("filename_from_src", "dsts is set. Cannot set filename_from_src")
464 } else {
465 ctx.PropertyErrorf("filename_from_src", "filename_from_src is implicitly set to true when using srcs")
466 }
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100467 }
Cole Faustfdec8722024-05-22 11:38:29 -0700468 p.sourceFilePaths = android.PathsForModuleSrc(ctx, srcsProperty)
Douglas Anderson79688ff2024-09-27 15:08:33 -0700469 if len(dstsProperty) > 0 && len(p.sourceFilePaths) != len(dstsProperty) {
470 ctx.PropertyErrorf("dsts", "Must have one entry in dsts per source file")
471 }
472 for i, src := range p.sourceFilePaths {
473 var filename string
474 var installDirPath android.InstallPath
475
476 if len(dstsProperty) > 0 {
477 var dstdir string
478
479 dstdir, filename = filepath.Split(dstsProperty[i])
480 installDirPath = baseInstallDirPath.Join(ctx, dstdir)
481 } else {
482 filename = src.Base()
483 installDirPath = baseInstallDirPath
484 }
Cole Faust4e9f5922024-11-13 16:09:23 -0800485 output := android.PathForModuleOut(ctx, filename)
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100486 ip := installProperties{
487 filename: filename,
488 sourceFilePath: src,
489 outputFilePath: output,
Douglas Anderson79688ff2024-09-27 15:08:33 -0700490 installDirPath: installDirPath,
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100491 }
492 p.outputFilePaths = append(p.outputFilePaths, output)
493 installs = append(installs, ip)
Douglas Anderson79688ff2024-09-27 15:08:33 -0700494 p.installDirPaths = append(p.installDirPaths, installDirPath)
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100495 }
496 } else if ctx.Config().AllowMissingDependencies() {
497 // If no srcs was set and AllowMissingDependencies is enabled then
498 // mark the module as missing dependencies and set a fake source path
499 // and file name.
500 ctx.AddMissingDependencies([]string{"MISSING_PREBUILT_SRC_FILE"})
501 p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)}
502 if filename == "" {
503 filename = ctx.ModuleName()
504 }
Cole Faust4e9f5922024-11-13 16:09:23 -0800505 p.outputFilePaths = android.WritablePaths{android.PathForModuleOut(ctx, filename)}
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100506 ip := installProperties{
507 filename: filename,
508 sourceFilePath: p.sourceFilePaths[0],
509 outputFilePath: p.outputFilePaths[0],
Douglas Anderson79688ff2024-09-27 15:08:33 -0700510 installDirPath: baseInstallDirPath,
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100511 }
512 installs = append(installs, ip)
Douglas Anderson79688ff2024-09-27 15:08:33 -0700513 p.installDirPaths = append(p.installDirPaths, baseInstallDirPath)
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100514 } else {
515 ctx.PropertyErrorf("src", "missing prebuilt source file")
516 return
517 }
518
519 // Call InstallFile even when uninstallable to make the module included in the package.
520 if !p.Installable() {
521 p.SkipInstall()
522 }
523 for _, ip := range installs {
524 ip.addInstallRules(ctx)
525 }
mrziwang89371762024-06-11 12:42:24 -0700526
mrziwanga25adf32025-02-05 23:50:55 +0000527 p.updateModuleInfoJSON(ctx)
528
mrziwang89371762024-06-11 12:42:24 -0700529 ctx.SetOutputFiles(p.outputFilePaths.Paths(), "")
Yu Liu0a37d422025-02-13 02:05:00 +0000530
531 SetCommonPrebuiltEtcInfo(ctx, p)
532}
533
534func SetCommonPrebuiltEtcInfo(ctx android.ModuleContext, p PrebuiltEtcModule) {
535 android.SetProvider(ctx, PrebuiltEtcInfoProvider, PrebuiltEtcInfo{
536 BaseDir: p.BaseDir(),
537 SubDir: p.SubDir(),
538 })
Spandan Das756d3402023-06-05 22:49:50 +0000539}
Jiyong Parkf9f68052020-09-29 20:15:08 +0900540
mrziwanga25adf32025-02-05 23:50:55 +0000541func (p *PrebuiltEtc) updateModuleInfoJSON(ctx android.ModuleContext) {
542 moduleInfoJSON := ctx.ModuleInfoJSON()
543 moduleInfoJSON.Class = []string{"ETC"}
544 if p.makeClass != "" {
545 moduleInfoJSON.Class = []string{p.makeClass}
546 }
547 moduleInfoJSON.SystemSharedLibs = []string{"none"}
548 moduleInfoJSON.Tags = []string{"optional"}
549}
550
Spandan Das756d3402023-06-05 22:49:50 +0000551type installProperties struct {
Spandan Das756d3402023-06-05 22:49:50 +0000552 filename string
553 sourceFilePath android.Path
Cole Faust4e9f5922024-11-13 16:09:23 -0800554 outputFilePath android.WritablePath
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100555 installDirPath android.InstallPath
Spandan Das756d3402023-06-05 22:49:50 +0000556 symlinks []string
557}
558
559// utility function to add install rules to the build graph.
560// Reduces code duplication between Soong and Mixed build analysis
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100561func (ip *installProperties) addInstallRules(ctx android.ModuleContext) {
Spandan Das756d3402023-06-05 22:49:50 +0000562 // Copy the file from src to a location in out/ with the correct `filename`
563 // This ensures that outputFilePath has the correct name for others to
564 // use, as the source file may have a different name.
Spandan Das756d3402023-06-05 22:49:50 +0000565 ctx.Build(pctx, android.BuildParams{
566 Rule: android.Cp,
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100567 Output: ip.outputFilePath,
Spandan Das756d3402023-06-05 22:49:50 +0000568 Input: ip.sourceFilePath,
569 })
570
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100571 installPath := ctx.InstallFile(ip.installDirPath, ip.filename, ip.outputFilePath)
Spandan Das756d3402023-06-05 22:49:50 +0000572 for _, sl := range ip.symlinks {
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100573 ctx.InstallSymlink(ip.installDirPath, sl, installPath)
Jiyong Parkf9f68052020-09-29 20:15:08 +0900574 }
Jiyong Parkc678ad32018-04-10 13:07:10 +0900575}
576
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700577func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries {
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700578 nameSuffix := ""
Yifan Hong1b3348d2020-01-21 15:53:22 -0800579 if p.inRamdisk() && !p.onlyInRamdisk() {
580 nameSuffix = ".ramdisk"
581 }
Yifan Hong60e0cfb2020-10-21 15:17:56 -0700582 if p.inVendorRamdisk() && !p.onlyInVendorRamdisk() {
583 nameSuffix = ".vendor_ramdisk"
584 }
Inseob Kim08758f02021-04-08 21:13:22 +0900585 if p.inDebugRamdisk() && !p.onlyInDebugRamdisk() {
586 nameSuffix = ".debug_ramdisk"
587 }
Kiyoung Kimae11c232021-07-19 11:38:04 +0900588 if p.InRecovery() && !p.onlyInRecovery() {
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700589 nameSuffix = ".recovery"
590 }
Colin Crossf17e2b52023-10-30 15:17:25 -0700591
592 class := p.makeClass
593 if class == "" {
594 class = "ETC"
595 }
596
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100597 return []android.AndroidMkEntries{{
Colin Crossf17e2b52023-10-30 15:17:25 -0700598 Class: class,
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700599 SubName: nameSuffix,
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100600 OutputFile: android.OptionalPathForPath(p.outputFilePaths[0]),
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700601 ExtraEntries: []android.AndroidMkExtraEntriesFunc{
Colin Crossaa255532020-07-03 13:18:24 -0700602 func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700603 entries.SetString("LOCAL_MODULE_TAGS", "optional")
Douglas Anderson79688ff2024-09-27 15:08:33 -0700604 entries.SetString("LOCAL_MODULE_PATH", p.installDirPaths[0].String())
ThiƩbaud Weksteen00e8b312024-03-18 14:06:00 +1100605 entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePaths[0].Base())
Yo Chiang3d64d492020-05-27 17:56:39 +0800606 if len(p.properties.Symlinks) > 0 {
607 entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...)
608 }
Yo Chiang803c40d2020-11-16 20:32:51 +0800609 entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.Installable())
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700610 if p.additionalDependencies != nil {
Yo Chiang803c40d2020-11-16 20:32:51 +0800611 entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", p.additionalDependencies.Strings()...)
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900612 }
Jaewoong Junge0dc8df2019-08-27 17:33:16 -0700613 },
Jiyong Parkc678ad32018-04-10 13:07:10 +0900614 },
Jiyong Park0b0e1b92019-12-03 13:24:29 +0900615 }}
Jiyong Parkc678ad32018-04-10 13:07:10 +0900616}
617
LaMont Jonesafe7baf2024-01-09 22:47:39 +0000618func (p *PrebuiltEtc) AndroidModuleBase() *android.ModuleBase {
619 return &p.ModuleBase
620}
621
Jooyung Hana0171822019-07-22 15:48:36 +0900622func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {
623 p.installDirBase = dirBase
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900624 p.AddProperties(&p.properties)
Inseob Kim27408bf2021-04-06 21:00:17 +0900625 p.AddProperties(&p.subdirProperties)
Jihoon Kang320ca7c2024-12-03 18:14:50 +0000626 p.AddProperties(&p.rootProperties)
Jihoon Kangf729d2e2025-03-12 22:24:52 +0000627 p.AddProperties(&p.dstsProperties)
Inseob Kim27408bf2021-04-06 21:00:17 +0900628}
629
630func InitPrebuiltRootModule(p *PrebuiltEtc) {
631 p.installDirBase = "."
Nelson Li1fb94b22024-07-09 17:04:52 +0800632 p.AddProperties(&p.properties)
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900633 p.AddProperties(&p.rootProperties)
Nelson Li1fb94b22024-07-09 17:04:52 +0800634}
635
636func InitPrebuiltAvbModule(p *PrebuiltEtc) {
637 p.installDirBase = "avb"
Inseob Kim27408bf2021-04-06 21:00:17 +0900638 p.AddProperties(&p.properties)
Jihoon Kangf729d2e2025-03-12 22:24:52 +0000639 p.AddProperties(&p.dstsProperties)
Inseob Kimbe6a66d2024-07-11 15:43:44 +0900640 p.rootProperties.Install_in_root = proptools.BoolPtr(true)
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900641}
Jiyong Parkc678ad32018-04-10 13:07:10 +0900642
Patrice Arruda9e14b962019-03-11 15:58:50 -0700643// prebuilt_etc is for a prebuilt artifact that is installed in
644// <partition>/etc/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700645func PrebuiltEtcFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900646 module := &PrebuiltEtc{}
647 InitPrebuiltEtcModule(module, "etc")
Jiyong Park5a8d1be2018-04-25 22:57:34 +0900648 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700649 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Inseob Kim1e27a142021-05-06 11:46:11 +0000650 android.InitDefaultableModule(module)
651 return module
652}
653
654func defaultsFactory() android.Module {
655 return DefaultsFactory()
656}
657
658func DefaultsFactory(props ...interface{}) android.Module {
659 module := &Defaults{}
660
661 module.AddProperties(props...)
662 module.AddProperties(
Jihoon Kang69725b32024-11-12 03:08:49 +0000663 &PrebuiltEtcProperties{},
Inseob Kim1e27a142021-05-06 11:46:11 +0000664 &prebuiltSubdirProperties{},
665 )
666
667 android.InitDefaultsModule(module)
668
Jiyong Parkc678ad32018-04-10 13:07:10 +0900669 return module
670}
Tao Bao0ba5c942018-08-14 22:20:22 -0700671
Patrice Arruda9e14b962019-03-11 15:58:50 -0700672// prebuilt_etc_host is for a host prebuilt artifact that is installed in
673// $(HOST_OUT)/etc/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700674func PrebuiltEtcHostFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900675 module := &PrebuiltEtc{}
676 InitPrebuiltEtcModule(module, "etc")
Jaewoong Jung24788182019-02-04 14:34:10 -0800677 // This module is host-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700678 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100679 android.InitDefaultableModule(module)
Jaewoong Jung24788182019-02-04 14:34:10 -0800680 return module
681}
682
Jihoon Kang002767b2025-03-12 22:14:39 +0000683// prebuilt_any is a special module where the module can define the subdirectory that the files
684// are installed to. This is only used for converting the PRODUCT_COPY_FILES entries to Soong
685// modules, and should never be defined in the bp files. If none of the existing prebuilt_*
686// modules allow installing the file at the desired location, introduce a new prebuilt_* module
687// type instead.
688func PrebuiltAnyFactory() android.Module {
689 module := &PrebuiltEtc{}
690 InitPrebuiltEtcModule(module, ".")
691 // This module is device-only
692 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
693 android.InitDefaultableModule(module)
694 return module
695}
696
Miguel32b02802022-12-01 18:38:26 +0000697// prebuilt_etc_host is for a host prebuilt artifact that is installed in
698// <partition>/etc/<sub_dir> directory.
699func PrebuiltEtcCaCertsFactory() android.Module {
700 module := &PrebuiltEtc{}
701 InitPrebuiltEtcModule(module, "cacerts")
702 // This module is device-only
703 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Miguel32b02802022-12-01 18:38:26 +0000704 return module
705}
706
Nelson Li1fb94b22024-07-09 17:04:52 +0800707// Generally, a <partition> directory will contain a `system` subdirectory, but the <partition> of
708// `prebuilt_avb` will not have a `system` subdirectory.
709// Ultimately, prebuilt_avb will install the prebuilt artifact to the `avb` subdirectory under the
710// root directory of the partition: <partition_root>/avb.
711// prebuilt_avb does not allow adding any other subdirectories.
712func PrebuiltAvbFactory() android.Module {
713 module := &PrebuiltEtc{}
714 InitPrebuiltAvbModule(module)
715 // This module is device-only
716 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
717 android.InitDefaultableModule(module)
718 return module
719}
720
Inseob Kim27408bf2021-04-06 21:00:17 +0900721// prebuilt_root is for a prebuilt artifact that is installed in
722// <partition>/ directory. Can't have any sub directories.
723func PrebuiltRootFactory() android.Module {
724 module := &PrebuiltEtc{}
725 InitPrebuiltRootModule(module)
726 // This module is device-only
727 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100728 android.InitDefaultableModule(module)
Inseob Kim27408bf2021-04-06 21:00:17 +0900729 return module
730}
731
Liz Kammere9ecddc2022-01-04 17:27:52 -0500732// prebuilt_root_host is for a host prebuilt artifact that is installed in $(HOST_OUT)/<sub_dir>
733// directory.
734func PrebuiltRootHostFactory() android.Module {
735 module := &PrebuiltEtc{}
736 InitPrebuiltEtcModule(module, ".")
737 // This module is host-only
738 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
739 android.InitDefaultableModule(module)
740 return module
741}
742
Patrice Arruda9e14b962019-03-11 15:58:50 -0700743// prebuilt_usr_share is for a prebuilt artifact that is installed in
744// <partition>/usr/share/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700745func PrebuiltUserShareFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900746 module := &PrebuiltEtc{}
747 InitPrebuiltEtcModule(module, "usr/share")
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800748 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700749 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100750 android.InitDefaultableModule(module)
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800751 return module
752}
753
Patrice Arruda9e14b962019-03-11 15:58:50 -0700754// prebuild_usr_share_host is for a host prebuilt artifact that is installed in
755// $(HOST_OUT)/usr/share/<sub_dir> directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700756func PrebuiltUserShareHostFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900757 module := &PrebuiltEtc{}
758 InitPrebuiltEtcModule(module, "usr/share")
Patrice Arruda300cef92019-02-22 15:47:57 -0800759 // This module is host-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700760 android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100761 android.InitDefaultableModule(module)
Patrice Arruda300cef92019-02-22 15:47:57 -0800762 return module
763}
764
yangbill63c5e192024-03-27 09:02:12 +0000765// prebuilt_usr_hyphendata is for a prebuilt artifact that is installed in
766// <partition>/usr/hyphen-data/<sub_dir> directory.
767func PrebuiltUserHyphenDataFactory() android.Module {
768 module := &PrebuiltEtc{}
769 InitPrebuiltEtcModule(module, "usr/hyphen-data")
770 // This module is device-only
771 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
772 android.InitDefaultableModule(module)
773 return module
774}
775
yangbill85527e62024-04-30 08:24:50 +0000776// prebuilt_usr_keylayout is for a prebuilt artifact that is installed in
777// <partition>/usr/keylayout/<sub_dir> directory.
778func PrebuiltUserKeyLayoutFactory() android.Module {
779 module := &PrebuiltEtc{}
780 InitPrebuiltEtcModule(module, "usr/keylayout")
781 // This module is device-only
782 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
783 android.InitDefaultableModule(module)
784 return module
785}
786
787// prebuilt_usr_keychars is for a prebuilt artifact that is installed in
788// <partition>/usr/keychars/<sub_dir> directory.
789func PrebuiltUserKeyCharsFactory() android.Module {
790 module := &PrebuiltEtc{}
791 InitPrebuiltEtcModule(module, "usr/keychars")
792 // This module is device-only
793 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
794 android.InitDefaultableModule(module)
795 return module
796}
797
798// prebuilt_usr_idc is for a prebuilt artifact that is installed in
799// <partition>/usr/idc/<sub_dir> directory.
800func PrebuiltUserIdcFactory() android.Module {
801 module := &PrebuiltEtc{}
802 InitPrebuiltEtcModule(module, "usr/idc")
803 // This module is device-only
804 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
805 android.InitDefaultableModule(module)
806 return module
807}
808
Jihoon Kang0da5ae92024-10-29 23:24:17 +0000809// prebuilt_usr_srec is for a prebuilt artifact that is installed in
810// <partition>/usr/srec/<sub_dir> directory.
811func PrebuiltUserSrecFactory() android.Module {
812 module := &PrebuiltEtc{}
813 InitPrebuiltEtcModule(module, "usr/srec")
814 // This module is device-only
815 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
816 android.InitDefaultableModule(module)
817 return module
818}
819
Agi Sferro243c7d72025-02-24 15:45:53 -0800820// prebuilt_usr_odml is for a prebuilt artifact that is installed in
821// <partition>/usr/odml/<sub_dir> directory.
822func PrebuiltUserOdmlFactory() android.Module {
823 module := &PrebuiltEtc{}
824 InitPrebuiltEtcModule(module, "usr/odml")
825 // This module is device-only
826 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
827 android.InitDefaultableModule(module)
828 return module
829}
830
Patrice Arruda61583eb2019-05-14 08:20:45 -0700831// prebuilt_font installs a font in <partition>/fonts directory.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700832func PrebuiltFontFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900833 module := &PrebuiltEtc{}
834 InitPrebuiltEtcModule(module, "fonts")
Patrice Arruda61583eb2019-05-14 08:20:45 -0700835 // This module is device-only
Cole Faustc49443e2024-10-29 11:15:34 -0700836 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100837 android.InitDefaultableModule(module)
Patrice Arruda61583eb2019-05-14 08:20:45 -0700838 return module
839}
Patrice Arruda057a8b12019-06-03 15:29:27 -0700840
Kevin93f7cd82024-05-02 12:37:59 +0200841// prebuilt_overlay is for a prebuilt artifact in <partition>/overlay directory.
842func PrebuiltOverlayFactory() android.Module {
843 module := &PrebuiltEtc{}
844 InitPrebuiltEtcModule(module, "overlay")
845 // This module is device-only
846 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
847 return module
848}
849
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800850// prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system
851// image.
852// If soc_specific property is set to true, the firmware file is installed to the
853// vendor <partition>/firmware directory for vendor image.
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700854func PrebuiltFirmwareFactory() android.Module {
Jooyung Hana0171822019-07-22 15:48:36 +0900855 module := &PrebuiltEtc{}
856 module.socInstallDirBase = "firmware"
857 InitPrebuiltEtcModule(module, "etc/firmware")
Patrice Arruda057a8b12019-06-03 15:29:27 -0700858 // This module is device-only
Jaewoong Jung4b79e982020-06-01 10:45:49 -0700859 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100860 android.InitDefaultableModule(module)
Patrice Arruda057a8b12019-06-03 15:29:27 -0700861 return module
862}
Patrice Arruda0f688002020-06-08 21:40:25 +0000863
Luca Stefani04812eb2025-03-09 12:41:06 +0100864// prebuilt_gpu is for a prebuilt artifact in <partition>/gpu directory.
865func PrebuiltGPUFactory() android.Module {
866 module := &PrebuiltEtc{}
867 InitPrebuiltEtcModule(module, "gpu")
868 // This module is device-only
869 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
870 return module
871}
872
Patrice Arruda0f688002020-06-08 21:40:25 +0000873// prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image.
Yo Chiangf0e19fe2020-11-18 15:28:42 +0800874// If soc_specific property is set to true, the DSP related file is installed to the
875// vendor <partition>/dsp directory for vendor image.
Patrice Arruda0f688002020-06-08 21:40:25 +0000876func PrebuiltDSPFactory() android.Module {
877 module := &PrebuiltEtc{}
878 module.socInstallDirBase = "dsp"
879 InitPrebuiltEtcModule(module, "etc/dsp")
880 // This module is device-only
881 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100882 android.InitDefaultableModule(module)
Patrice Arruda0f688002020-06-08 21:40:25 +0000883 return module
884}
Colin Cross83ebf232021-04-09 09:41:23 -0700885
Colin Crossf17e2b52023-10-30 15:17:25 -0700886// prebuilt_renderscript_bitcode installs a *.bc file into /system/lib or /system/lib64.
887func PrebuiltRenderScriptBitcodeFactory() android.Module {
888 module := &PrebuiltEtc{}
889 module.makeClass = "RENDERSCRIPT_BITCODE"
890 module.installDirBase64 = "lib64"
Colin Cross2f634572023-11-13 12:12:06 -0800891 module.installAvoidMultilibConflict = true
Colin Crossf17e2b52023-10-30 15:17:25 -0700892 InitPrebuiltEtcModule(module, "lib")
893 // This module is device-only
894 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth)
895 android.InitDefaultableModule(module)
896 return module
897}
898
Colin Cross83ebf232021-04-09 09:41:23 -0700899// prebuilt_rfsa installs a firmware file that will be available through Qualcomm's RFSA
900// to the <partition>/lib/rfsa directory.
901func PrebuiltRFSAFactory() android.Module {
902 module := &PrebuiltEtc{}
903 // Ideally these would go in /vendor/dsp, but the /vendor/lib/rfsa paths are hardcoded in too
904 // many places outside of the application processor. They could be moved to /vendor/dsp once
905 // that is cleaned up.
906 InitPrebuiltEtcModule(module, "lib/rfsa")
907 // This module is device-only
908 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
Martin Stjernholmdc6525e2021-10-14 00:42:59 +0100909 android.InitDefaultableModule(module)
Colin Cross83ebf232021-04-09 09:41:23 -0700910 return module
911}
Jihoon Kang2ecf8622024-10-23 21:20:30 +0000912
Jihoon Kang0da5ae92024-10-29 23:24:17 +0000913// prebuilt_media installs media files in <partition>/media directory.
914func PrebuiltMediaFactory() android.Module {
Jihoon Kang2ecf8622024-10-23 21:20:30 +0000915 module := &PrebuiltEtc{}
Jihoon Kang0da5ae92024-10-29 23:24:17 +0000916 InitPrebuiltEtcModule(module, "media")
Jihoon Kang2ecf8622024-10-23 21:20:30 +0000917 // This module is device-only
918 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
919 android.InitDefaultableModule(module)
920 return module
921}
Jihoon Kangec62d842024-10-25 20:27:18 +0000922
923// prebuilt_voicepack installs voice pack files in <partition>/tts directory.
924func PrebuiltVoicepackFactory() android.Module {
925 module := &PrebuiltEtc{}
926 InitPrebuiltEtcModule(module, "tts")
927 // This module is device-only
928 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
929 android.InitDefaultableModule(module)
930 return module
931}
932
933// prebuilt_bin installs files in <partition>/bin directory.
934func PrebuiltBinaryFactory() android.Module {
935 module := &PrebuiltEtc{}
936 InitPrebuiltEtcModule(module, "bin")
937 // This module is device-only
938 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
939 android.InitDefaultableModule(module)
940 return module
941}
942
943// prebuilt_wallpaper installs image files in <partition>/wallpaper directory.
944func PrebuiltWallpaperFactory() android.Module {
945 module := &PrebuiltEtc{}
946 InitPrebuiltEtcModule(module, "wallpaper")
947 // This module is device-only
948 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
949 android.InitDefaultableModule(module)
950 return module
951}
Jihoon Kang0da5ae92024-10-29 23:24:17 +0000952
953// prebuilt_priv_app installs files in <partition>/priv-app directory.
954func PrebuiltPrivAppFactory() android.Module {
955 module := &PrebuiltEtc{}
956 InitPrebuiltEtcModule(module, "priv-app")
957 // This module is device-only
958 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
959 android.InitDefaultableModule(module)
960 return module
961}
962
Michael Bestas137fab42025-03-08 20:44:34 +0200963// prebuilt_radio installs files in <partition>/radio directory.
964func PrebuiltRadioFactory() android.Module {
965 module := &PrebuiltEtc{}
966 InitPrebuiltEtcModule(module, "radio")
967 // This module is device-only
968 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
969 android.InitDefaultableModule(module)
970 return module
971}
972
Jihoon Kang0da5ae92024-10-29 23:24:17 +0000973// prebuilt_rfs installs files in <partition>/rfs directory.
974func PrebuiltRfsFactory() android.Module {
975 module := &PrebuiltEtc{}
976 InitPrebuiltEtcModule(module, "rfs")
977 // This module is device-only
978 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
979 android.InitDefaultableModule(module)
980 return module
981}
982
983// prebuilt_framework installs files in <partition>/framework directory.
984func PrebuiltFrameworkFactory() android.Module {
985 module := &PrebuiltEtc{}
986 InitPrebuiltEtcModule(module, "framework")
987 // This module is device-only
988 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
989 android.InitDefaultableModule(module)
990 return module
991}
992
993// prebuilt_res installs files in <partition>/res directory.
994func PrebuiltResFactory() android.Module {
995 module := &PrebuiltEtc{}
996 InitPrebuiltEtcModule(module, "res")
997 // This module is device-only
998 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
999 android.InitDefaultableModule(module)
1000 return module
1001}
1002
1003// prebuilt_wlc_upt installs files in <partition>/wlc_upt directory.
1004func PrebuiltWlcUptFactory() android.Module {
1005 module := &PrebuiltEtc{}
1006 InitPrebuiltEtcModule(module, "wlc_upt")
1007 // This module is device-only
1008 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1009 android.InitDefaultableModule(module)
1010 return module
1011}
1012
1013// prebuilt_odm installs files in <partition>/odm directory.
1014func PrebuiltOdmFactory() android.Module {
1015 module := &PrebuiltEtc{}
1016 InitPrebuiltEtcModule(module, "odm")
1017 // This module is device-only
1018 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1019 android.InitDefaultableModule(module)
1020 return module
1021}
Jihoon Kang2e2b7442024-11-05 00:26:20 +00001022
1023// prebuilt_vendor_dlkm installs files in <partition>/vendor_dlkm directory.
1024func PrebuiltVendorDlkmFactory() android.Module {
1025 module := &PrebuiltEtc{}
1026 InitPrebuiltEtcModule(module, "vendor_dlkm")
1027 // This module is device-only
1028 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1029 android.InitDefaultableModule(module)
1030 return module
1031}
1032
1033// prebuilt_bt_firmware installs files in <partition>/bt_firmware directory.
1034func PrebuiltBtFirmwareFactory() android.Module {
1035 module := &PrebuiltEtc{}
1036 InitPrebuiltEtcModule(module, "bt_firmware")
1037 // This module is device-only
1038 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1039 android.InitDefaultableModule(module)
1040 return module
1041}
Jihoon Kangdca2f2b2024-11-06 18:43:19 +00001042
1043// prebuilt_tvservice installs files in <partition>/tvservice directory.
1044func PrebuiltTvServiceFactory() android.Module {
1045 module := &PrebuiltEtc{}
1046 InitPrebuiltEtcModule(module, "tvservice")
1047 // This module is device-only
1048 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1049 android.InitDefaultableModule(module)
1050 return module
1051}
1052
1053// prebuilt_optee installs files in <partition>/optee directory.
1054func PrebuiltOpteeFactory() android.Module {
1055 module := &PrebuiltEtc{}
1056 InitPrebuiltEtcModule(module, "optee")
1057 // This module is device-only
1058 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1059 android.InitDefaultableModule(module)
1060 return module
1061}
Jihoon Kangecf76dd2024-11-12 05:24:46 +00001062
1063// prebuilt_tvconfig installs files in <partition>/tvconfig directory.
1064func PrebuiltTvConfigFactory() android.Module {
1065 module := &PrebuiltEtc{}
1066 InitPrebuiltEtcModule(module, "tvconfig")
1067 // This module is device-only
1068 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1069 android.InitDefaultableModule(module)
1070 return module
1071}
Jihoon Kang3ca07a12024-12-02 19:14:30 +00001072
1073// prebuilt_vendor installs files in <partition>/vendor directory.
1074func PrebuiltVendorFactory() android.Module {
1075 module := &PrebuiltEtc{}
1076 InitPrebuiltEtcModule(module, "vendor")
1077 // This module is device-only
1078 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1079 android.InitDefaultableModule(module)
1080 return module
1081}
Jihoon Kang320ca7c2024-12-03 18:14:50 +00001082
Artem Borisov49f074b2025-03-11 23:19:26 +03001083// prebuilt_vendor_overlay is for a prebuilt artifact in <partition>/vendor_overlay directory.
1084func PrebuiltVendorOverlayFactory() android.Module {
1085 module := &PrebuiltEtc{}
1086 InitPrebuiltEtcModule(module, "vendor_overlay")
1087 // This module is device-only
1088 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1089 android.InitDefaultableModule(module)
1090 return module
1091}
1092
Jihoon Kang320ca7c2024-12-03 18:14:50 +00001093// prebuilt_sbin installs files in <partition>/sbin directory.
1094func PrebuiltSbinFactory() android.Module {
1095 module := &PrebuiltEtc{}
1096 InitPrebuiltEtcModule(module, "sbin")
1097 // This module is device-only
1098 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1099 android.InitDefaultableModule(module)
1100 return module
1101}
1102
1103// prebuilt_system installs files in <partition>/system directory.
1104func PrebuiltSystemFactory() android.Module {
1105 module := &PrebuiltEtc{}
1106 InitPrebuiltEtcModule(module, "system")
1107 // This module is device-only
1108 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1109 android.InitDefaultableModule(module)
1110 return module
1111}
1112
1113// prebuilt_first_stage_ramdisk installs files in <partition>/first_stage_ramdisk directory.
1114func PrebuiltFirstStageRamdiskFactory() android.Module {
1115 module := &PrebuiltEtc{}
1116 InitPrebuiltEtcModule(module, "first_stage_ramdisk")
1117 // This module is device-only
1118 android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
1119 android.InitDefaultableModule(module)
1120 return module
1121}