Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 1 | // 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 Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 15 | package etc |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 16 | |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 17 | // 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 Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 29 | |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 30 | import ( |
Jiyong Park | 76a42f5 | 2021-02-16 06:50:37 +0900 | [diff] [blame] | 31 | "fmt" |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 32 | "path/filepath" |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 33 | "strings" |
Jiyong Park | 76a42f5 | 2021-02-16 06:50:37 +0900 | [diff] [blame] | 34 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 35 | "github.com/google/blueprint/proptools" |
| 36 | |
| 37 | "android/soong/android" |
| 38 | ) |
| 39 | |
| 40 | var pctx = android.NewPackageContext("android/soong/etc") |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 41 | |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 42 | // TODO(jungw): Now that it handles more than the ones in etc/, consider renaming this file. |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 43 | |
| 44 | func init() { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 45 | pctx.Import("android/soong/android") |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 46 | RegisterPrebuiltEtcBuildComponents(android.InitRegistrationContext) |
| 47 | } |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 48 | |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 49 | func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) { |
| 50 | ctx.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory) |
| 51 | ctx.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory) |
Miguel | 32b0280 | 2022-12-01 18:38:26 +0000 | [diff] [blame] | 52 | ctx.RegisterModuleType("prebuilt_etc_cacerts", PrebuiltEtcCaCertsFactory) |
Nelson Li | 1fb94b2 | 2024-07-09 17:04:52 +0800 | [diff] [blame] | 53 | ctx.RegisterModuleType("prebuilt_avb", PrebuiltAvbFactory) |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 54 | ctx.RegisterModuleType("prebuilt_root", PrebuiltRootFactory) |
Liz Kammer | e9ecddc | 2022-01-04 17:27:52 -0500 | [diff] [blame] | 55 | ctx.RegisterModuleType("prebuilt_root_host", PrebuiltRootHostFactory) |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 56 | ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory) |
| 57 | ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory) |
yangbill | 63c5e19 | 2024-03-27 09:02:12 +0000 | [diff] [blame] | 58 | ctx.RegisterModuleType("prebuilt_usr_hyphendata", PrebuiltUserHyphenDataFactory) |
yangbill | 85527e6 | 2024-04-30 08:24:50 +0000 | [diff] [blame] | 59 | ctx.RegisterModuleType("prebuilt_usr_keylayout", PrebuiltUserKeyLayoutFactory) |
| 60 | ctx.RegisterModuleType("prebuilt_usr_keychars", PrebuiltUserKeyCharsFactory) |
| 61 | ctx.RegisterModuleType("prebuilt_usr_idc", PrebuiltUserIdcFactory) |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 62 | ctx.RegisterModuleType("prebuilt_usr_srec", PrebuiltUserSrecFactory) |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 63 | ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory) |
Kevin | 93f7cd8 | 2024-05-02 12:37:59 +0200 | [diff] [blame] | 64 | ctx.RegisterModuleType("prebuilt_overlay", PrebuiltOverlayFactory) |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 65 | ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory) |
| 66 | ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory) |
Colin Cross | 83ebf23 | 2021-04-09 09:41:23 -0700 | [diff] [blame] | 67 | ctx.RegisterModuleType("prebuilt_rfsa", PrebuiltRFSAFactory) |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 68 | ctx.RegisterModuleType("prebuilt_renderscript_bitcode", PrebuiltRenderScriptBitcodeFactory) |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 69 | ctx.RegisterModuleType("prebuilt_media", PrebuiltMediaFactory) |
Jihoon Kang | ec62d84 | 2024-10-25 20:27:18 +0000 | [diff] [blame] | 70 | ctx.RegisterModuleType("prebuilt_voicepack", PrebuiltVoicepackFactory) |
| 71 | ctx.RegisterModuleType("prebuilt_bin", PrebuiltBinaryFactory) |
| 72 | ctx.RegisterModuleType("prebuilt_wallpaper", PrebuiltWallpaperFactory) |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 73 | ctx.RegisterModuleType("prebuilt_priv_app", PrebuiltPrivAppFactory) |
| 74 | ctx.RegisterModuleType("prebuilt_rfs", PrebuiltRfsFactory) |
| 75 | ctx.RegisterModuleType("prebuilt_framework", PrebuiltFrameworkFactory) |
| 76 | ctx.RegisterModuleType("prebuilt_res", PrebuiltResFactory) |
| 77 | ctx.RegisterModuleType("prebuilt_wlc_upt", PrebuiltWlcUptFactory) |
| 78 | ctx.RegisterModuleType("prebuilt_odm", PrebuiltOdmFactory) |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 79 | |
| 80 | ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory) |
Rupert Shuttleworth | 378fc1b | 2021-07-28 08:03:16 -0400 | [diff] [blame] | 81 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 82 | } |
| 83 | |
Paul Duffin | 1172fed | 2021-03-08 11:28:18 +0000 | [diff] [blame] | 84 | var PrepareForTestWithPrebuiltEtc = android.FixtureRegisterWithContext(RegisterPrebuiltEtcBuildComponents) |
| 85 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 86 | type prebuiltEtcProperties struct { |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 87 | // Source file of this prebuilt. Can reference a genrule type module with the ":module" syntax. |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 88 | // Mutually exclusive with srcs. |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 89 | Src proptools.Configurable[string] `android:"path,arch_variant,replace_instead_of_append"` |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 90 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 91 | // Source files of this prebuilt. Can reference a genrule type module with the ":module" syntax. |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 92 | // Mutually exclusive with src. When used, filename_from_src is set to true unless dsts is also |
| 93 | // set. May use globs in filenames. |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 94 | Srcs proptools.Configurable[[]string] `android:"path,arch_variant"` |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 95 | |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 96 | // Destination files of this prebuilt. Requires srcs to be used and causes srcs not to implicitly |
| 97 | // set filename_from_src. This can be used to install each source file to a different directory |
| 98 | // and/or change filenames when files are installed. Must be exactly one entry per source file, |
| 99 | // which means care must be taken if srcs has globs. |
| 100 | Dsts proptools.Configurable[[]string] `android:"path,arch_variant"` |
| 101 | |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 102 | // Optional name for the installed file. If unspecified, name of the module is used as the file |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 103 | // name. Only available when using a single source (src). |
Jiyong Park | 139a2e6 | 2018-10-26 21:49:39 +0900 | [diff] [blame] | 104 | Filename *string `android:"arch_variant"` |
| 105 | |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 106 | // When set to true, and filename property is not set, the name for the installed file |
Jiyong Park | 1a7cf08 | 2018-11-13 11:59:12 +0900 | [diff] [blame] | 107 | // is the same as the file name of the source file. |
| 108 | Filename_from_src *bool `android:"arch_variant"` |
| 109 | |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 110 | // Make this module available when building for ramdisk. |
Yifan Hong | 39143a9 | 2020-10-26 12:43:12 -0700 | [diff] [blame] | 111 | // On device without a dedicated recovery partition, the module is only |
| 112 | // available after switching root into |
| 113 | // /first_stage_ramdisk. To expose the module before switching root, install |
| 114 | // the recovery variant instead. |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 115 | Ramdisk_available *bool |
| 116 | |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 117 | // Make this module available when building for vendor ramdisk. |
Yifan Hong | 39143a9 | 2020-10-26 12:43:12 -0700 | [diff] [blame] | 118 | // On device without a dedicated recovery partition, the module is only |
| 119 | // available after switching root into |
| 120 | // /first_stage_ramdisk. To expose the module before switching root, install |
| 121 | // the recovery variant instead. |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 122 | Vendor_ramdisk_available *bool |
| 123 | |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 124 | // Make this module available when building for debug ramdisk. |
| 125 | Debug_ramdisk_available *bool |
| 126 | |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 127 | // Make this module available when building for recovery. |
| 128 | Recovery_available *bool |
| 129 | |
Jiyong Park | ad9ce04 | 2018-10-31 22:49:57 +0900 | [diff] [blame] | 130 | // Whether this module is directly installable to one of the partitions. Default: true. |
| 131 | Installable *bool |
Yo Chiang | 3d64d49 | 2020-05-27 17:56:39 +0800 | [diff] [blame] | 132 | |
| 133 | // Install symlinks to the installed file. |
| 134 | Symlinks []string `android:"arch_variant"` |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 135 | } |
| 136 | |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 137 | type prebuiltSubdirProperties struct { |
| 138 | // Optional subdirectory under which this file is installed into, cannot be specified with |
| 139 | // relative_install_path, prefer relative_install_path. |
| 140 | Sub_dir *string `android:"arch_variant"` |
| 141 | |
| 142 | // Optional subdirectory under which this file is installed into, cannot be specified with |
| 143 | // sub_dir. |
| 144 | Relative_install_path *string `android:"arch_variant"` |
| 145 | } |
| 146 | |
Inseob Kim | be6a66d | 2024-07-11 15:43:44 +0900 | [diff] [blame] | 147 | type prebuiltRootProperties struct { |
| 148 | // Install this module to the root directory, without partition subdirs. When this module is |
| 149 | // added to PRODUCT_PACKAGES, this module will be installed to $PRODUCT_OUT/root, which will |
| 150 | // then be copied to the root of system.img. When this module is packaged by other modules like |
| 151 | // android_filesystem, this module will be installed to the root ("/"), unlike normal |
| 152 | // prebuilt_root modules which are installed to the partition subdir (e.g. "/system/"). |
| 153 | Install_in_root *bool |
| 154 | } |
| 155 | |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 156 | type PrebuiltEtcModule interface { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 157 | android.Module |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 158 | |
| 159 | // Returns the base install directory, such as "etc", "usr/share". |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 160 | BaseDir() string |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 161 | |
| 162 | // Returns the sub install directory relative to BaseDir(). |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 163 | SubDir() string |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 164 | } |
| 165 | |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 166 | type PrebuiltEtc struct { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 167 | android.ModuleBase |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 168 | android.DefaultableModuleBase |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 169 | |
Inseob Kim | be6a66d | 2024-07-11 15:43:44 +0900 | [diff] [blame] | 170 | properties prebuiltEtcProperties |
| 171 | |
| 172 | // rootProperties is used to return the value of the InstallInRoot() method. Currently, only |
| 173 | // prebuilt_avb and prebuilt_root modules use this. |
| 174 | rootProperties prebuiltRootProperties |
| 175 | |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 176 | subdirProperties prebuiltSubdirProperties |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 177 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 178 | sourceFilePaths android.Paths |
| 179 | outputFilePaths android.OutputPaths |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 180 | // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share. |
Colin Cross | 2f63457 | 2023-11-13 12:12:06 -0800 | [diff] [blame] | 181 | installDirBase string |
| 182 | installDirBase64 string |
| 183 | installAvoidMultilibConflict bool |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 184 | // The base install location when soc_specific property is set to true, e.g. "firmware" for |
| 185 | // prebuilt_firmware. |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 186 | socInstallDirBase string |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 187 | installDirPaths []android.InstallPath |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 188 | additionalDependencies *android.Paths |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 189 | |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 190 | usedSrcsProperty bool |
| 191 | |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 192 | makeClass string |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 193 | } |
| 194 | |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 195 | type Defaults struct { |
| 196 | android.ModuleBase |
| 197 | android.DefaultsModuleBase |
| 198 | } |
| 199 | |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 200 | func (p *PrebuiltEtc) inRamdisk() bool { |
| 201 | return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk() |
| 202 | } |
| 203 | |
| 204 | func (p *PrebuiltEtc) onlyInRamdisk() bool { |
| 205 | return p.ModuleBase.InstallInRamdisk() |
| 206 | } |
| 207 | |
| 208 | func (p *PrebuiltEtc) InstallInRamdisk() bool { |
| 209 | return p.inRamdisk() |
| 210 | } |
| 211 | |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 212 | func (p *PrebuiltEtc) inVendorRamdisk() bool { |
| 213 | return p.ModuleBase.InVendorRamdisk() || p.ModuleBase.InstallInVendorRamdisk() |
| 214 | } |
| 215 | |
| 216 | func (p *PrebuiltEtc) onlyInVendorRamdisk() bool { |
| 217 | return p.ModuleBase.InstallInVendorRamdisk() |
| 218 | } |
| 219 | |
| 220 | func (p *PrebuiltEtc) InstallInVendorRamdisk() bool { |
| 221 | return p.inVendorRamdisk() |
| 222 | } |
| 223 | |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 224 | func (p *PrebuiltEtc) inDebugRamdisk() bool { |
| 225 | return p.ModuleBase.InDebugRamdisk() || p.ModuleBase.InstallInDebugRamdisk() |
| 226 | } |
| 227 | |
| 228 | func (p *PrebuiltEtc) onlyInDebugRamdisk() bool { |
| 229 | return p.ModuleBase.InstallInDebugRamdisk() |
| 230 | } |
| 231 | |
| 232 | func (p *PrebuiltEtc) InstallInDebugRamdisk() bool { |
| 233 | return p.inDebugRamdisk() |
| 234 | } |
| 235 | |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 236 | func (p *PrebuiltEtc) InRecovery() bool { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 237 | return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery() |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | func (p *PrebuiltEtc) onlyInRecovery() bool { |
| 241 | return p.ModuleBase.InstallInRecovery() |
| 242 | } |
| 243 | |
| 244 | func (p *PrebuiltEtc) InstallInRecovery() bool { |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 245 | return p.InRecovery() |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 246 | } |
| 247 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 248 | var _ android.ImageInterface = (*PrebuiltEtc)(nil) |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 249 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 250 | func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.ImageInterfaceContext) {} |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 251 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 252 | func (p *PrebuiltEtc) VendorVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Jihoon Kang | 47e9184 | 2024-06-19 00:51:16 +0000 | [diff] [blame] | 253 | return false |
| 254 | } |
| 255 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 256 | func (p *PrebuiltEtc) ProductVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Jihoon Kang | 47e9184 | 2024-06-19 00:51:16 +0000 | [diff] [blame] | 257 | return false |
| 258 | } |
| 259 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 260 | func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 261 | return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() && |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 262 | !p.ModuleBase.InstallInVendorRamdisk() && !p.ModuleBase.InstallInDebugRamdisk() |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 263 | } |
| 264 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 265 | func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 266 | return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk() |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 267 | } |
| 268 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 269 | func (p *PrebuiltEtc) VendorRamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 270 | return proptools.Bool(p.properties.Vendor_ramdisk_available) || p.ModuleBase.InstallInVendorRamdisk() |
| 271 | } |
| 272 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 273 | func (p *PrebuiltEtc) DebugRamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 274 | return proptools.Bool(p.properties.Debug_ramdisk_available) || p.ModuleBase.InstallInDebugRamdisk() |
| 275 | } |
| 276 | |
Nelson Li | 1fb94b2 | 2024-07-09 17:04:52 +0800 | [diff] [blame] | 277 | func (p *PrebuiltEtc) InstallInRoot() bool { |
Inseob Kim | be6a66d | 2024-07-11 15:43:44 +0900 | [diff] [blame] | 278 | return proptools.Bool(p.rootProperties.Install_in_root) |
Nelson Li | 1fb94b2 | 2024-07-09 17:04:52 +0800 | [diff] [blame] | 279 | } |
| 280 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 281 | func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 282 | return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery() |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 283 | } |
| 284 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 285 | func (p *PrebuiltEtc) ExtraImageVariations(ctx android.ImageInterfaceContext) []string { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 286 | return nil |
| 287 | } |
| 288 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 289 | func (p *PrebuiltEtc) SetImageVariation(ctx android.ImageInterfaceContext, variation string) { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 290 | } |
| 291 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 292 | func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path { |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 293 | if len(p.properties.Srcs.GetOrDefault(ctx, nil)) > 0 { |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 294 | panic(fmt.Errorf("SourceFilePath not available on multi-source prebuilt %q", p.Name())) |
| 295 | } |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 296 | return android.PathForModuleSrc(ctx, p.properties.Src.GetOrDefault(ctx, "")) |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 297 | } |
| 298 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 299 | func (p *PrebuiltEtc) InstallDirPath() android.InstallPath { |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 300 | if len(p.installDirPaths) != 1 { |
| 301 | panic(fmt.Errorf("InstallDirPath not available on multi-source prebuilt %q", p.Name())) |
| 302 | } |
| 303 | return p.installDirPaths[0] |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 304 | } |
| 305 | |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 306 | // This allows other derivative modules (e.g. prebuilt_etc_xml) to perform |
| 307 | // additional steps (like validating the src) before the file is installed. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 308 | func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) { |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 309 | p.additionalDependencies = &paths |
| 310 | } |
| 311 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 312 | func (p *PrebuiltEtc) OutputFile() android.OutputPath { |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 313 | if p.usedSrcsProperty { |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 314 | panic(fmt.Errorf("OutputFile not available on multi-source prebuilt %q", p.Name())) |
| 315 | } |
| 316 | return p.outputFilePaths[0] |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | func (p *PrebuiltEtc) SubDir() string { |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 320 | if subDir := proptools.String(p.subdirProperties.Sub_dir); subDir != "" { |
Liz Kammer | 0449a63 | 2020-06-26 10:12:36 -0700 | [diff] [blame] | 321 | return subDir |
| 322 | } |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 323 | return proptools.String(p.subdirProperties.Relative_install_path) |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 324 | } |
| 325 | |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 326 | func (p *PrebuiltEtc) BaseDir() string { |
Jooyung Han | 8e5685d | 2020-09-21 11:02:57 +0900 | [diff] [blame] | 327 | return p.installDirBase |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 328 | } |
| 329 | |
Jiyong Park | ad9ce04 | 2018-10-31 22:49:57 +0900 | [diff] [blame] | 330 | func (p *PrebuiltEtc) Installable() bool { |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 331 | return p.properties.Installable == nil || proptools.Bool(p.properties.Installable) |
Jiyong Park | ad9ce04 | 2018-10-31 22:49:57 +0900 | [diff] [blame] | 332 | } |
| 333 | |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 334 | func (p *PrebuiltEtc) InVendor() bool { |
| 335 | return p.ModuleBase.InstallInVendor() |
| 336 | } |
| 337 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 338 | func (p *PrebuiltEtc) installBaseDir(ctx android.ModuleContext) string { |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 339 | // If soc install dir was specified and SOC specific is set, set the installDirPath to the |
| 340 | // specified socInstallDirBase. |
Jooyung Han | 8e5685d | 2020-09-21 11:02:57 +0900 | [diff] [blame] | 341 | installBaseDir := p.installDirBase |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 342 | if p.Target().Arch.ArchType.Multilib == "lib64" && p.installDirBase64 != "" { |
| 343 | installBaseDir = p.installDirBase64 |
| 344 | } |
Jooyung Han | 8e5685d | 2020-09-21 11:02:57 +0900 | [diff] [blame] | 345 | if p.SocSpecific() && p.socInstallDirBase != "" { |
| 346 | installBaseDir = p.socInstallDirBase |
| 347 | } |
Colin Cross | 2f63457 | 2023-11-13 12:12:06 -0800 | [diff] [blame] | 348 | if p.installAvoidMultilibConflict && !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) { |
| 349 | installBaseDir = filepath.Join(installBaseDir, ctx.Arch().ArchType.String()) |
| 350 | } |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 351 | return installBaseDir |
| 352 | } |
Colin Cross | 2f63457 | 2023-11-13 12:12:06 -0800 | [diff] [blame] | 353 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 354 | func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 355 | var installs []installProperties |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 356 | |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 357 | srcProperty := p.properties.Src.Get(ctx) |
| 358 | srcsProperty := p.properties.Srcs.GetOrDefault(ctx, nil) |
| 359 | if srcProperty.IsPresent() && len(srcsProperty) > 0 { |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 360 | ctx.PropertyErrorf("src", "src is set. Cannot set srcs") |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 361 | } |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 362 | dstsProperty := p.properties.Dsts.GetOrDefault(ctx, nil) |
| 363 | if len(dstsProperty) > 0 && len(srcsProperty) == 0 { |
| 364 | ctx.PropertyErrorf("dsts", "dsts is set. Must use srcs") |
| 365 | } |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 366 | |
| 367 | // Check that `sub_dir` and `relative_install_path` are not set at the same time. |
| 368 | if p.subdirProperties.Sub_dir != nil && p.subdirProperties.Relative_install_path != nil { |
| 369 | ctx.PropertyErrorf("sub_dir", "relative_install_path is set. Cannot set sub_dir") |
| 370 | } |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 371 | baseInstallDirPath := android.PathForModuleInstall(ctx, p.installBaseDir(ctx), p.SubDir()) |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 372 | |
| 373 | filename := proptools.String(p.properties.Filename) |
| 374 | filenameFromSrc := proptools.Bool(p.properties.Filename_from_src) |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 375 | if srcProperty.IsPresent() { |
| 376 | p.sourceFilePaths = android.PathsForModuleSrc(ctx, []string{srcProperty.Get()}) |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 377 | // If the source was not found, set a fake source path to |
| 378 | // support AllowMissingDependencies executions. |
| 379 | if len(p.sourceFilePaths) == 0 { |
| 380 | p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)} |
| 381 | } |
| 382 | |
| 383 | // Determine the output file basename. |
| 384 | // If Filename is set, use the name specified by the property. |
| 385 | // If Filename_from_src is set, use the source file name. |
| 386 | // Otherwise use the module name. |
| 387 | if filename != "" { |
| 388 | if filenameFromSrc { |
| 389 | ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true") |
| 390 | return |
| 391 | } |
| 392 | } else if filenameFromSrc { |
| 393 | filename = p.sourceFilePaths[0].Base() |
| 394 | } else { |
| 395 | filename = ctx.ModuleName() |
| 396 | } |
| 397 | if strings.Contains(filename, "/") { |
| 398 | ctx.PropertyErrorf("filename", "filename cannot contain separator '/'") |
| 399 | return |
| 400 | } |
| 401 | p.outputFilePaths = android.OutputPaths{android.PathForModuleOut(ctx, filename).OutputPath} |
| 402 | |
| 403 | ip := installProperties{ |
| 404 | filename: filename, |
| 405 | sourceFilePath: p.sourceFilePaths[0], |
| 406 | outputFilePath: p.outputFilePaths[0], |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 407 | installDirPath: baseInstallDirPath, |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 408 | symlinks: p.properties.Symlinks, |
| 409 | } |
| 410 | installs = append(installs, ip) |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 411 | p.installDirPaths = append(p.installDirPaths, baseInstallDirPath) |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 412 | } else if len(srcsProperty) > 0 { |
| 413 | p.usedSrcsProperty = true |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 414 | if filename != "" { |
| 415 | ctx.PropertyErrorf("filename", "filename cannot be set when using srcs") |
| 416 | } |
| 417 | if len(p.properties.Symlinks) > 0 { |
| 418 | ctx.PropertyErrorf("symlinks", "symlinks cannot be set when using srcs") |
| 419 | } |
| 420 | if p.properties.Filename_from_src != nil { |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 421 | if len(dstsProperty) > 0 { |
| 422 | ctx.PropertyErrorf("filename_from_src", "dsts is set. Cannot set filename_from_src") |
| 423 | } else { |
| 424 | ctx.PropertyErrorf("filename_from_src", "filename_from_src is implicitly set to true when using srcs") |
| 425 | } |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 426 | } |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 427 | p.sourceFilePaths = android.PathsForModuleSrc(ctx, srcsProperty) |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 428 | if len(dstsProperty) > 0 && len(p.sourceFilePaths) != len(dstsProperty) { |
| 429 | ctx.PropertyErrorf("dsts", "Must have one entry in dsts per source file") |
| 430 | } |
| 431 | for i, src := range p.sourceFilePaths { |
| 432 | var filename string |
| 433 | var installDirPath android.InstallPath |
| 434 | |
| 435 | if len(dstsProperty) > 0 { |
| 436 | var dstdir string |
| 437 | |
| 438 | dstdir, filename = filepath.Split(dstsProperty[i]) |
| 439 | installDirPath = baseInstallDirPath.Join(ctx, dstdir) |
| 440 | } else { |
| 441 | filename = src.Base() |
| 442 | installDirPath = baseInstallDirPath |
| 443 | } |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 444 | output := android.PathForModuleOut(ctx, filename).OutputPath |
| 445 | ip := installProperties{ |
| 446 | filename: filename, |
| 447 | sourceFilePath: src, |
| 448 | outputFilePath: output, |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 449 | installDirPath: installDirPath, |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 450 | } |
| 451 | p.outputFilePaths = append(p.outputFilePaths, output) |
| 452 | installs = append(installs, ip) |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 453 | p.installDirPaths = append(p.installDirPaths, installDirPath) |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 454 | } |
| 455 | } else if ctx.Config().AllowMissingDependencies() { |
| 456 | // If no srcs was set and AllowMissingDependencies is enabled then |
| 457 | // mark the module as missing dependencies and set a fake source path |
| 458 | // and file name. |
| 459 | ctx.AddMissingDependencies([]string{"MISSING_PREBUILT_SRC_FILE"}) |
| 460 | p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)} |
| 461 | if filename == "" { |
| 462 | filename = ctx.ModuleName() |
| 463 | } |
| 464 | p.outputFilePaths = android.OutputPaths{android.PathForModuleOut(ctx, filename).OutputPath} |
| 465 | ip := installProperties{ |
| 466 | filename: filename, |
| 467 | sourceFilePath: p.sourceFilePaths[0], |
| 468 | outputFilePath: p.outputFilePaths[0], |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 469 | installDirPath: baseInstallDirPath, |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 470 | } |
| 471 | installs = append(installs, ip) |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 472 | p.installDirPaths = append(p.installDirPaths, baseInstallDirPath) |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 473 | } else { |
| 474 | ctx.PropertyErrorf("src", "missing prebuilt source file") |
| 475 | return |
| 476 | } |
| 477 | |
| 478 | // Call InstallFile even when uninstallable to make the module included in the package. |
| 479 | if !p.Installable() { |
| 480 | p.SkipInstall() |
| 481 | } |
| 482 | for _, ip := range installs { |
| 483 | ip.addInstallRules(ctx) |
| 484 | } |
mrziwang | 8937176 | 2024-06-11 12:42:24 -0700 | [diff] [blame] | 485 | |
| 486 | ctx.SetOutputFiles(p.outputFilePaths.Paths(), "") |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 487 | } |
Jiyong Park | f9f6805 | 2020-09-29 20:15:08 +0900 | [diff] [blame] | 488 | |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 489 | type installProperties struct { |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 490 | filename string |
| 491 | sourceFilePath android.Path |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 492 | outputFilePath android.OutputPath |
| 493 | installDirPath android.InstallPath |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 494 | symlinks []string |
| 495 | } |
| 496 | |
| 497 | // utility function to add install rules to the build graph. |
| 498 | // Reduces code duplication between Soong and Mixed build analysis |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 499 | func (ip *installProperties) addInstallRules(ctx android.ModuleContext) { |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 500 | // Copy the file from src to a location in out/ with the correct `filename` |
| 501 | // This ensures that outputFilePath has the correct name for others to |
| 502 | // use, as the source file may have a different name. |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 503 | ctx.Build(pctx, android.BuildParams{ |
| 504 | Rule: android.Cp, |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 505 | Output: ip.outputFilePath, |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 506 | Input: ip.sourceFilePath, |
| 507 | }) |
| 508 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 509 | installPath := ctx.InstallFile(ip.installDirPath, ip.filename, ip.outputFilePath) |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 510 | for _, sl := range ip.symlinks { |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 511 | ctx.InstallSymlink(ip.installDirPath, sl, installPath) |
Jiyong Park | f9f6805 | 2020-09-29 20:15:08 +0900 | [diff] [blame] | 512 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 513 | } |
| 514 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 515 | func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries { |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 516 | nameSuffix := "" |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 517 | if p.inRamdisk() && !p.onlyInRamdisk() { |
| 518 | nameSuffix = ".ramdisk" |
| 519 | } |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 520 | if p.inVendorRamdisk() && !p.onlyInVendorRamdisk() { |
| 521 | nameSuffix = ".vendor_ramdisk" |
| 522 | } |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 523 | if p.inDebugRamdisk() && !p.onlyInDebugRamdisk() { |
| 524 | nameSuffix = ".debug_ramdisk" |
| 525 | } |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 526 | if p.InRecovery() && !p.onlyInRecovery() { |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 527 | nameSuffix = ".recovery" |
| 528 | } |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 529 | |
| 530 | class := p.makeClass |
| 531 | if class == "" { |
| 532 | class = "ETC" |
| 533 | } |
| 534 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 535 | return []android.AndroidMkEntries{{ |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 536 | Class: class, |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 537 | SubName: nameSuffix, |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 538 | OutputFile: android.OptionalPathForPath(p.outputFilePaths[0]), |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 539 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 540 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 541 | entries.SetString("LOCAL_MODULE_TAGS", "optional") |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 542 | entries.SetString("LOCAL_MODULE_PATH", p.installDirPaths[0].String()) |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 543 | entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePaths[0].Base()) |
Yo Chiang | 3d64d49 | 2020-05-27 17:56:39 +0800 | [diff] [blame] | 544 | if len(p.properties.Symlinks) > 0 { |
| 545 | entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...) |
| 546 | } |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 547 | entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.Installable()) |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 548 | if p.additionalDependencies != nil { |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 549 | entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", p.additionalDependencies.Strings()...) |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 550 | } |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 551 | }, |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 552 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 553 | }} |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 554 | } |
| 555 | |
LaMont Jones | afe7baf | 2024-01-09 22:47:39 +0000 | [diff] [blame] | 556 | func (p *PrebuiltEtc) AndroidModuleBase() *android.ModuleBase { |
| 557 | return &p.ModuleBase |
| 558 | } |
| 559 | |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 560 | func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) { |
| 561 | p.installDirBase = dirBase |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 562 | p.AddProperties(&p.properties) |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 563 | p.AddProperties(&p.subdirProperties) |
| 564 | } |
| 565 | |
| 566 | func InitPrebuiltRootModule(p *PrebuiltEtc) { |
| 567 | p.installDirBase = "." |
Nelson Li | 1fb94b2 | 2024-07-09 17:04:52 +0800 | [diff] [blame] | 568 | p.AddProperties(&p.properties) |
Inseob Kim | be6a66d | 2024-07-11 15:43:44 +0900 | [diff] [blame] | 569 | p.AddProperties(&p.rootProperties) |
Nelson Li | 1fb94b2 | 2024-07-09 17:04:52 +0800 | [diff] [blame] | 570 | } |
| 571 | |
| 572 | func InitPrebuiltAvbModule(p *PrebuiltEtc) { |
| 573 | p.installDirBase = "avb" |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 574 | p.AddProperties(&p.properties) |
Inseob Kim | be6a66d | 2024-07-11 15:43:44 +0900 | [diff] [blame] | 575 | p.rootProperties.Install_in_root = proptools.BoolPtr(true) |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 576 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 577 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 578 | // prebuilt_etc is for a prebuilt artifact that is installed in |
| 579 | // <partition>/etc/<sub_dir> directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 580 | func PrebuiltEtcFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 581 | module := &PrebuiltEtc{} |
| 582 | InitPrebuiltEtcModule(module, "etc") |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 583 | // This module is device-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 584 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 585 | android.InitDefaultableModule(module) |
| 586 | return module |
| 587 | } |
| 588 | |
| 589 | func defaultsFactory() android.Module { |
| 590 | return DefaultsFactory() |
| 591 | } |
| 592 | |
| 593 | func DefaultsFactory(props ...interface{}) android.Module { |
| 594 | module := &Defaults{} |
| 595 | |
| 596 | module.AddProperties(props...) |
| 597 | module.AddProperties( |
| 598 | &prebuiltEtcProperties{}, |
| 599 | &prebuiltSubdirProperties{}, |
| 600 | ) |
| 601 | |
| 602 | android.InitDefaultsModule(module) |
| 603 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 604 | return module |
| 605 | } |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 606 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 607 | // prebuilt_etc_host is for a host prebuilt artifact that is installed in |
| 608 | // $(HOST_OUT)/etc/<sub_dir> directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 609 | func PrebuiltEtcHostFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 610 | module := &PrebuiltEtc{} |
| 611 | InitPrebuiltEtcModule(module, "etc") |
Jaewoong Jung | 2478818 | 2019-02-04 14:34:10 -0800 | [diff] [blame] | 612 | // This module is host-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 613 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 614 | android.InitDefaultableModule(module) |
Jaewoong Jung | 2478818 | 2019-02-04 14:34:10 -0800 | [diff] [blame] | 615 | return module |
| 616 | } |
| 617 | |
Miguel | 32b0280 | 2022-12-01 18:38:26 +0000 | [diff] [blame] | 618 | // prebuilt_etc_host is for a host prebuilt artifact that is installed in |
| 619 | // <partition>/etc/<sub_dir> directory. |
| 620 | func PrebuiltEtcCaCertsFactory() android.Module { |
| 621 | module := &PrebuiltEtc{} |
| 622 | InitPrebuiltEtcModule(module, "cacerts") |
| 623 | // This module is device-only |
| 624 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Miguel | 32b0280 | 2022-12-01 18:38:26 +0000 | [diff] [blame] | 625 | return module |
| 626 | } |
| 627 | |
Nelson Li | 1fb94b2 | 2024-07-09 17:04:52 +0800 | [diff] [blame] | 628 | // Generally, a <partition> directory will contain a `system` subdirectory, but the <partition> of |
| 629 | // `prebuilt_avb` will not have a `system` subdirectory. |
| 630 | // Ultimately, prebuilt_avb will install the prebuilt artifact to the `avb` subdirectory under the |
| 631 | // root directory of the partition: <partition_root>/avb. |
| 632 | // prebuilt_avb does not allow adding any other subdirectories. |
| 633 | func PrebuiltAvbFactory() android.Module { |
| 634 | module := &PrebuiltEtc{} |
| 635 | InitPrebuiltAvbModule(module) |
| 636 | // This module is device-only |
| 637 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 638 | android.InitDefaultableModule(module) |
| 639 | return module |
| 640 | } |
| 641 | |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 642 | // prebuilt_root is for a prebuilt artifact that is installed in |
| 643 | // <partition>/ directory. Can't have any sub directories. |
| 644 | func PrebuiltRootFactory() android.Module { |
| 645 | module := &PrebuiltEtc{} |
| 646 | InitPrebuiltRootModule(module) |
| 647 | // This module is device-only |
| 648 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 649 | android.InitDefaultableModule(module) |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 650 | return module |
| 651 | } |
| 652 | |
Liz Kammer | e9ecddc | 2022-01-04 17:27:52 -0500 | [diff] [blame] | 653 | // prebuilt_root_host is for a host prebuilt artifact that is installed in $(HOST_OUT)/<sub_dir> |
| 654 | // directory. |
| 655 | func PrebuiltRootHostFactory() android.Module { |
| 656 | module := &PrebuiltEtc{} |
| 657 | InitPrebuiltEtcModule(module, ".") |
| 658 | // This module is host-only |
| 659 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) |
| 660 | android.InitDefaultableModule(module) |
| 661 | return module |
| 662 | } |
| 663 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 664 | // prebuilt_usr_share is for a prebuilt artifact that is installed in |
| 665 | // <partition>/usr/share/<sub_dir> directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 666 | func PrebuiltUserShareFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 667 | module := &PrebuiltEtc{} |
| 668 | InitPrebuiltEtcModule(module, "usr/share") |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 669 | // This module is device-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 670 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 671 | android.InitDefaultableModule(module) |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 672 | return module |
| 673 | } |
| 674 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 675 | // prebuild_usr_share_host is for a host prebuilt artifact that is installed in |
| 676 | // $(HOST_OUT)/usr/share/<sub_dir> directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 677 | func PrebuiltUserShareHostFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 678 | module := &PrebuiltEtc{} |
| 679 | InitPrebuiltEtcModule(module, "usr/share") |
Patrice Arruda | 300cef9 | 2019-02-22 15:47:57 -0800 | [diff] [blame] | 680 | // This module is host-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 681 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 682 | android.InitDefaultableModule(module) |
Patrice Arruda | 300cef9 | 2019-02-22 15:47:57 -0800 | [diff] [blame] | 683 | return module |
| 684 | } |
| 685 | |
yangbill | 63c5e19 | 2024-03-27 09:02:12 +0000 | [diff] [blame] | 686 | // prebuilt_usr_hyphendata is for a prebuilt artifact that is installed in |
| 687 | // <partition>/usr/hyphen-data/<sub_dir> directory. |
| 688 | func PrebuiltUserHyphenDataFactory() android.Module { |
| 689 | module := &PrebuiltEtc{} |
| 690 | InitPrebuiltEtcModule(module, "usr/hyphen-data") |
| 691 | // This module is device-only |
| 692 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 693 | android.InitDefaultableModule(module) |
| 694 | return module |
| 695 | } |
| 696 | |
yangbill | 85527e6 | 2024-04-30 08:24:50 +0000 | [diff] [blame] | 697 | // prebuilt_usr_keylayout is for a prebuilt artifact that is installed in |
| 698 | // <partition>/usr/keylayout/<sub_dir> directory. |
| 699 | func PrebuiltUserKeyLayoutFactory() android.Module { |
| 700 | module := &PrebuiltEtc{} |
| 701 | InitPrebuiltEtcModule(module, "usr/keylayout") |
| 702 | // This module is device-only |
| 703 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 704 | android.InitDefaultableModule(module) |
| 705 | return module |
| 706 | } |
| 707 | |
| 708 | // prebuilt_usr_keychars is for a prebuilt artifact that is installed in |
| 709 | // <partition>/usr/keychars/<sub_dir> directory. |
| 710 | func PrebuiltUserKeyCharsFactory() android.Module { |
| 711 | module := &PrebuiltEtc{} |
| 712 | InitPrebuiltEtcModule(module, "usr/keychars") |
| 713 | // This module is device-only |
| 714 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 715 | android.InitDefaultableModule(module) |
| 716 | return module |
| 717 | } |
| 718 | |
| 719 | // prebuilt_usr_idc is for a prebuilt artifact that is installed in |
| 720 | // <partition>/usr/idc/<sub_dir> directory. |
| 721 | func PrebuiltUserIdcFactory() android.Module { |
| 722 | module := &PrebuiltEtc{} |
| 723 | InitPrebuiltEtcModule(module, "usr/idc") |
| 724 | // This module is device-only |
| 725 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 726 | android.InitDefaultableModule(module) |
| 727 | return module |
| 728 | } |
| 729 | |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 730 | // prebuilt_usr_srec is for a prebuilt artifact that is installed in |
| 731 | // <partition>/usr/srec/<sub_dir> directory. |
| 732 | func PrebuiltUserSrecFactory() android.Module { |
| 733 | module := &PrebuiltEtc{} |
| 734 | InitPrebuiltEtcModule(module, "usr/srec") |
| 735 | // This module is device-only |
| 736 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 737 | android.InitDefaultableModule(module) |
| 738 | return module |
| 739 | } |
| 740 | |
Patrice Arruda | 61583eb | 2019-05-14 08:20:45 -0700 | [diff] [blame] | 741 | // prebuilt_font installs a font in <partition>/fonts directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 742 | func PrebuiltFontFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 743 | module := &PrebuiltEtc{} |
| 744 | InitPrebuiltEtcModule(module, "fonts") |
Patrice Arruda | 61583eb | 2019-05-14 08:20:45 -0700 | [diff] [blame] | 745 | // This module is device-only |
Cole Faust | c49443e | 2024-10-29 11:15:34 -0700 | [diff] [blame] | 746 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 747 | android.InitDefaultableModule(module) |
Patrice Arruda | 61583eb | 2019-05-14 08:20:45 -0700 | [diff] [blame] | 748 | return module |
| 749 | } |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 750 | |
Kevin | 93f7cd8 | 2024-05-02 12:37:59 +0200 | [diff] [blame] | 751 | // prebuilt_overlay is for a prebuilt artifact in <partition>/overlay directory. |
| 752 | func PrebuiltOverlayFactory() android.Module { |
| 753 | module := &PrebuiltEtc{} |
| 754 | InitPrebuiltEtcModule(module, "overlay") |
| 755 | // This module is device-only |
| 756 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 757 | return module |
| 758 | } |
| 759 | |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 760 | // prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system |
| 761 | // image. |
| 762 | // If soc_specific property is set to true, the firmware file is installed to the |
| 763 | // vendor <partition>/firmware directory for vendor image. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 764 | func PrebuiltFirmwareFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 765 | module := &PrebuiltEtc{} |
| 766 | module.socInstallDirBase = "firmware" |
| 767 | InitPrebuiltEtcModule(module, "etc/firmware") |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 768 | // This module is device-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 769 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 770 | android.InitDefaultableModule(module) |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 771 | return module |
| 772 | } |
Patrice Arruda | 0f68800 | 2020-06-08 21:40:25 +0000 | [diff] [blame] | 773 | |
| 774 | // prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image. |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 775 | // If soc_specific property is set to true, the DSP related file is installed to the |
| 776 | // vendor <partition>/dsp directory for vendor image. |
Patrice Arruda | 0f68800 | 2020-06-08 21:40:25 +0000 | [diff] [blame] | 777 | func PrebuiltDSPFactory() android.Module { |
| 778 | module := &PrebuiltEtc{} |
| 779 | module.socInstallDirBase = "dsp" |
| 780 | InitPrebuiltEtcModule(module, "etc/dsp") |
| 781 | // This module is device-only |
| 782 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 783 | android.InitDefaultableModule(module) |
Patrice Arruda | 0f68800 | 2020-06-08 21:40:25 +0000 | [diff] [blame] | 784 | return module |
| 785 | } |
Colin Cross | 83ebf23 | 2021-04-09 09:41:23 -0700 | [diff] [blame] | 786 | |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 787 | // prebuilt_renderscript_bitcode installs a *.bc file into /system/lib or /system/lib64. |
| 788 | func PrebuiltRenderScriptBitcodeFactory() android.Module { |
| 789 | module := &PrebuiltEtc{} |
| 790 | module.makeClass = "RENDERSCRIPT_BITCODE" |
| 791 | module.installDirBase64 = "lib64" |
Colin Cross | 2f63457 | 2023-11-13 12:12:06 -0800 | [diff] [blame] | 792 | module.installAvoidMultilibConflict = true |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 793 | InitPrebuiltEtcModule(module, "lib") |
| 794 | // This module is device-only |
| 795 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth) |
| 796 | android.InitDefaultableModule(module) |
| 797 | return module |
| 798 | } |
| 799 | |
Colin Cross | 83ebf23 | 2021-04-09 09:41:23 -0700 | [diff] [blame] | 800 | // prebuilt_rfsa installs a firmware file that will be available through Qualcomm's RFSA |
| 801 | // to the <partition>/lib/rfsa directory. |
| 802 | func PrebuiltRFSAFactory() android.Module { |
| 803 | module := &PrebuiltEtc{} |
| 804 | // Ideally these would go in /vendor/dsp, but the /vendor/lib/rfsa paths are hardcoded in too |
| 805 | // many places outside of the application processor. They could be moved to /vendor/dsp once |
| 806 | // that is cleaned up. |
| 807 | InitPrebuiltEtcModule(module, "lib/rfsa") |
| 808 | // This module is device-only |
| 809 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 810 | android.InitDefaultableModule(module) |
Colin Cross | 83ebf23 | 2021-04-09 09:41:23 -0700 | [diff] [blame] | 811 | return module |
| 812 | } |
Jihoon Kang | 2ecf862 | 2024-10-23 21:20:30 +0000 | [diff] [blame] | 813 | |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 814 | // prebuilt_media installs media files in <partition>/media directory. |
| 815 | func PrebuiltMediaFactory() android.Module { |
Jihoon Kang | 2ecf862 | 2024-10-23 21:20:30 +0000 | [diff] [blame] | 816 | module := &PrebuiltEtc{} |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 817 | InitPrebuiltEtcModule(module, "media") |
Jihoon Kang | 2ecf862 | 2024-10-23 21:20:30 +0000 | [diff] [blame] | 818 | // This module is device-only |
| 819 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 820 | android.InitDefaultableModule(module) |
| 821 | return module |
| 822 | } |
Jihoon Kang | ec62d84 | 2024-10-25 20:27:18 +0000 | [diff] [blame] | 823 | |
| 824 | // prebuilt_voicepack installs voice pack files in <partition>/tts directory. |
| 825 | func PrebuiltVoicepackFactory() android.Module { |
| 826 | module := &PrebuiltEtc{} |
| 827 | InitPrebuiltEtcModule(module, "tts") |
| 828 | // This module is device-only |
| 829 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 830 | android.InitDefaultableModule(module) |
| 831 | return module |
| 832 | } |
| 833 | |
| 834 | // prebuilt_bin installs files in <partition>/bin directory. |
| 835 | func PrebuiltBinaryFactory() android.Module { |
| 836 | module := &PrebuiltEtc{} |
| 837 | InitPrebuiltEtcModule(module, "bin") |
| 838 | // This module is device-only |
| 839 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 840 | android.InitDefaultableModule(module) |
| 841 | return module |
| 842 | } |
| 843 | |
| 844 | // prebuilt_wallpaper installs image files in <partition>/wallpaper directory. |
| 845 | func PrebuiltWallpaperFactory() android.Module { |
| 846 | module := &PrebuiltEtc{} |
| 847 | InitPrebuiltEtcModule(module, "wallpaper") |
| 848 | // This module is device-only |
| 849 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 850 | android.InitDefaultableModule(module) |
| 851 | return module |
| 852 | } |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 853 | |
| 854 | // prebuilt_priv_app installs files in <partition>/priv-app directory. |
| 855 | func PrebuiltPrivAppFactory() android.Module { |
| 856 | module := &PrebuiltEtc{} |
| 857 | InitPrebuiltEtcModule(module, "priv-app") |
| 858 | // This module is device-only |
| 859 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 860 | android.InitDefaultableModule(module) |
| 861 | return module |
| 862 | } |
| 863 | |
| 864 | // prebuilt_rfs installs files in <partition>/rfs directory. |
| 865 | func PrebuiltRfsFactory() android.Module { |
| 866 | module := &PrebuiltEtc{} |
| 867 | InitPrebuiltEtcModule(module, "rfs") |
| 868 | // This module is device-only |
| 869 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 870 | android.InitDefaultableModule(module) |
| 871 | return module |
| 872 | } |
| 873 | |
| 874 | // prebuilt_framework installs files in <partition>/framework directory. |
| 875 | func PrebuiltFrameworkFactory() android.Module { |
| 876 | module := &PrebuiltEtc{} |
| 877 | InitPrebuiltEtcModule(module, "framework") |
| 878 | // This module is device-only |
| 879 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 880 | android.InitDefaultableModule(module) |
| 881 | return module |
| 882 | } |
| 883 | |
| 884 | // prebuilt_res installs files in <partition>/res directory. |
| 885 | func PrebuiltResFactory() android.Module { |
| 886 | module := &PrebuiltEtc{} |
| 887 | InitPrebuiltEtcModule(module, "res") |
| 888 | // This module is device-only |
| 889 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 890 | android.InitDefaultableModule(module) |
| 891 | return module |
| 892 | } |
| 893 | |
| 894 | // prebuilt_wlc_upt installs files in <partition>/wlc_upt directory. |
| 895 | func PrebuiltWlcUptFactory() android.Module { |
| 896 | module := &PrebuiltEtc{} |
| 897 | InitPrebuiltEtcModule(module, "wlc_upt") |
| 898 | // This module is device-only |
| 899 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 900 | android.InitDefaultableModule(module) |
| 901 | return module |
| 902 | } |
| 903 | |
| 904 | // prebuilt_odm installs files in <partition>/odm directory. |
| 905 | func PrebuiltOdmFactory() android.Module { |
| 906 | module := &PrebuiltEtc{} |
| 907 | InitPrebuiltEtcModule(module, "odm") |
| 908 | // This module is device-only |
| 909 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 910 | android.InitDefaultableModule(module) |
| 911 | return module |
| 912 | } |