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